Re: [PATCH v2 4/5] x86/virt/tdx: Add extra memory to TDX module for the extensions
From: Edgecombe, Rick P
Date: Tue Sep 15 2026 - 17:21:03 EST
Hey Kiryl,
On Tue, 2026-09-15 at 18:26 +0800, Xu Yilun wrote:
> An alternative solution is to use a loop that gives memory on a memory
> error code - TDX_EXT_MEMORY_POOL_REQUIRED, add one page per iteration
> until TDH.EXT.INIT succeeds. Something like:
>
> do {
> ret = tdh_sys_init();
> if (ret == TDX_EXT_MEMORY_POOL_REQUIRED)
> tdh_ext_mem_add(); //single page
> } while (ret == TDX_EXT_MEMORY_POOL_REQUIRED);
>
> This approach is slightly simpler as we don't have to query the module
> for the total memory, no memory pre-allocation or segmentation math.
> But allocating a single 4K page per iteration may cause permanent memory
> fragmentation.
So this is definitely a bad thing to do? Even if this is running at boot before
much fragmentation could have happened? Don't early boot allocations tend to be
more physically contiguous?