Re: [PATCH v5 3/6] x86/virt/tdx: Add extra memory to TDX module for the extensions
From: Xu Yilun
Date: Thu Nov 19 2026 - 00:00:01 EST
On Wed, Nov 18, 2026 at 10:18:39PM +0000, Edgecombe, Rick P wrote:
> On Wed, 2026-11-11 at 11:48 +0800, Xu Yilun wrote:
> > TDX module extensions need memory for their execution environment to
> > serve SEAMCALL leafs. The TDX architecture implements the extensions
> > in such a way that they use the memory outside of SEAM range, so the
> > kernel should add the memory upfront at initialization time.
> >
> > Introduce a new memory adding process backed by a new SEAMCALL leaf
> > TDH.EXT.MEM.ADD. The kernel queries TDX module how much memory needed,
> > allocates it, adds it to the module, and never gets it back. Note that
> > the process requires Dynamic PAMT backing.
>
> The process requires it, or the memory does?
I'll change to "the memory requires..."
>
> > A subsequent patch adds the
> > support. This doesn't break bisectability cause the extensions can't be
> ^because?
> > enabled yet without a feature that uses them.
>
> Not clear whether the TDX module needs a new feature or the kernel does.
How about:
Note that the memory requires Dynamic PAMT backing, which is supported
via a subsequent patch. This doesn't break bisectability because the
extensions can't be enabled yet until some subsequent kernel change
enables a feature that uses them.
[...]
> > + page = alloc_contig_pages(ext.required_pages, GFP_KERNEL,
> > + numa_mem_id(), &node_online_map);
> > + if (!page) {
> > + ret = -ENOMEM;
> > + goto out_free_hpa_list;
> > + }
> > +
> > + /* Print the amount so users know the cost. */
> > + pr_info("%lu KB allocated for TDX module extensions\n",
> > + ext.required_pages * PAGE_SIZE / 1024);
>
> I wonder if this line is absolutely required for a minimal set?
Yeah I remember the concern is: we enable extensions automatically
because we think people enabling TDX have big servers and won't miss the
memory. But also we print the amount of memory that we use because we
think they will care. They are a bit at odds.
I don't have strong perference, but slightly lean to keeping the print,
so we can keep monitoring how the memory grows, and decide if it's time
to revisit the above "automatically enable whatever is supported" policy.
This print is originally required by Dave [*]. So Dave could you help on
this?
[*]: https://lore.kernel.org/all/62bec236-4716-4326-8342-1863ad8a3f24@xxxxxxxxx/