Re: [PATCH v3 05/16] x86/virt/tdx: Allocate reference counters for PAMT memory

Edgecombe, Rick P
2025-09-29T17:41:45Z

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?