Re: [PATCH v9 07/11] x86/tdx: Add APIs to support Dynamic PAMT ops from KVM's fault path
From: Vishal Annapurve
Date: Fri Aug 28 2026 - 18:19:24 EST
> +
> +static int alloc_pamt_array(struct page **pamt_pages, struct tdx_pamt_cache *cache)
> {
> int i, j;
>
> for (i = 0; i < TDX_DPAMT_ENTRY_PAGE_CNT; i++) {
> - pamt_pages[i] = alloc_page(GFP_KERNEL_ACCOUNT);
> + pamt_pages[i] = alloc_dpamt_page(cache);
> if (!pamt_pages[i])
> goto err;
> }
If the alloc_dpamt_page() was able to allocate a single page (not
two), should the partial allocation in the "err" handling return the
allocated page back to the cache?
We observed similar failures internally with a slightly customized
setup which had retries for pamt cache allocations in the fault path
due to SEMCALL failures with older TDX module functionality.