Re: [PATCH v3 05/16] x86/virt/tdx: Allocate reference counters for PAMT memory
From: Edgecombe, Rick P
Date: Mon Sep 29 2025 - 13:41:45 EST
On Tue, 2025-09-23 at 15:45 +0800, Binbin Wu wrote:
> > +/*
> > + * Allocate PAMT reference counters for all physical memory.
> > + *
> > + * It consumes 2MiB for every 1TiB of physical memory.
> > + */
> > +static int init_pamt_metadata(void)
> > +{
> > + size_t size = max_pfn / PTRS_PER_PTE * sizeof(*pamt_refcounts);
>
> Is there guarantee that max_pfn is PTRS_PER_PTE aligned?
> If not, it should be rounded up.
Vmalloc() should handle it?