Re: [PATCH v8 03/11] x86/virt/tdx: Add tdx_alloc/free_control_page() helpers

"Edgecombe, Rick P" <[email protected]> Wed, 29 Jul 2026 22:10:45 +0000
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.kvm
Message-ID <[email protected]>
On Sat, 2026-07-25 at 00:35 +0000, [email protected] wrote:
> [Severity: High]
> Will sequential allocations in the same 2MB region fail here?
> 
> When allocating multiple control pages sequentially, the buddy allocator
> often returns pages in the same 2MB physical region. Since the TDX module
> tracks Dynamic PAMT at a 2MB granularity, the first allocation will
> successfully add the PAMT, but the second allocation will attempt to add
> it again in tdx_pamt_get() in arch/x86/virt/vmx/tdx/tdx.c.
> 
> Because there is no refcounting to check if the 2MB region already has
> PAMT added, tdh_phymem_pamt_add() will return an error on the second page,
> causing the control page allocation to fail and breaking TDX VM creation.
> 
> The commit message mentions leaving concurrency issues for future
> changes, but could this break even single-threaded sequential allocations?

These functions are built over several patches, so it is not intended to be
complete in the first one. There are no callers yet, so there are no real
problems.

Maybe instead of "concurrency issues" for covering simultaneous callers and
multiple calls for the same 2MB physical page, it could be more carefully called
"multiple callers" in the log. So I think this is basically a log nit, but
reasonable.