Re: [PATCH v3 12/16] x86/virt/tdx: Add helpers to allow for pre-allocating pages
From: Edgecombe, Rick P
Date: Fri Sep 26 2025 - 18:05:17 EST
On Fri, 2025-09-26 at 09:44 +0800, Yan Zhao wrote:
> > - return kvm_mmu_topup_memory_cache(&tdx-
> > >mmu_external_spt_cache,
> > - PT64_ROOT_MAX_LEVEL);
> > + /* External page tables */
> > + min_fault_cache_size = PT64_ROOT_MAX_LEVEL;
>
> min_fault_cache_size = PT64_ROOT_MAX_LEVEL - 1?
> We don't need to allocate page for the root page.
Why change it in this patch?
>
> > + /* Dynamic PAMT pages (if enabled) */
> > + min_fault_cache_size += tdx_dpamt_entry_pages() *
> > PT64_ROOT_MAX_LEVEL;
> > +
> What about commenting that it's
> tdx_dpamt_entry_pages() * ((PT64_ROOT_MAX_LEVEL - 1) + 1) ?
> i.e.,
> (PT64_ROOT_MAX_LEVEL - 1) for page table pages, and 1 for guest
> private page.
Yes the comment could be improved. I'll enhance it. Thanks.