Re: [PATCH v6 05/11] x86/virt/tdx: Handle concurrent callers in tdx_pamt_get/put()

From: Chao Gao

Date: Tue Jul 07 2026 - 01:54:56 EST


>@@ -2057,10 +2061,26 @@ static int tdx_pamt_get(kvm_pfn_t pfn)
> if (ret)
> return ret;
>
>- tdx_status = tdh_phymem_pamt_add(pfn, pamt_pages);
>- if (tdx_status != TDX_SUCCESS) {
>- ret = -EIO;
>- goto out_free;
>+ pamt_refcount = tdx_find_pamt_refcount(pfn);
>+
>+ scoped_guard(spinlock, &pamt_lock) {

I am assuming you will convert this to plain lock/unlock as discussed.

With this fixed,

Reviewed-by: Chao Gao <chao.gao@xxxxxxxxx>