Re: [PATCH v2 08/17] x86/virt/tdx: Prepare Quote buffer during extension bringup
From: Dave Hansen
Date: Wed Jul 01 2026 - 18:07:30 EST
On 6/18/26 01:13, Xu Yilun wrote:
> For simplicity, let all guests share a global buffer. Build the buffer's
> HPA_LINKED_LIST at Quoting extension bringup. This saves a bunch of
> va-to-pa conversions at runtime.
va-to-pa conversions are not expensive. Even for vmalloc() memory.If
I don't like the global buffer. It just generally seems like a bad idea.
It needs locking, it wastes memory when nobody is doing quotes, etc..
Is there a way to do this without vmalloc()?
Could userspace provide the memory and then the kernel just does a gup
to keep it in place while the TDX module is writing to it? Or, could it
just be allocated:
void *buffer = vmalloc(size);
mutex_lock();
// talk to TDX module
mutex_unlock();
vfree(buffer);
return ret;
That actually has some nice properties. It doesn't require locking for
the buffer. It also penalizes folks doing lots of quotes. If you hammer
on quoting, you hammer on the memory allocator and TLB flushing code and
slow yourself down more. If you hammer on it from multiple threads, it
gets even worse.
That seems like a feature not a bug.