Re: [PATCH] x86/virt/tdx: Add command line param for DPAMT

From: Yan Zhao

Date: Thu Dec 03 2026 - 03:27:53 EST


On Tue, Dec 01, 2026 at 04:12:31PM -0800, Dave Hansen wrote:
> On 11/26/26 00:13, Yan Zhao wrote:
> > Would you like to have an early discussion on this direction?
>
> To be honest, no.
>
> If you think this is wrong, then the right way to challenge the idea is
Sorry, I had no intention of challenging any idea. I should have initiated this
discussion in the huge page thread instead of here.

I fully agree with this patch to make DPAMT optional.

Based on DPAMT being optional, there are 3 options for TDX huge page support
(see detailed analysis at the bottom):

1: Do not include any DPAMT support
2: Include DPAMT support from the beginning
3: Start with DPAMT-off and add append DPAMT support at the end.

Either option 1 or option 2 is ok to me.

> to structure the series with DPAMT support at the end. That'll show us
> how tiny it is and also let the maintainer just chop the patches off the
> end if they don't agree.
The diff is non-tiny.
7 files changed, 130 insertions(+), 43 deletions(-).
Besides, Sean previously pointed out it would be better not to append DPAMT
support at the end. https://lore.kernel.org/all/aXqSg2nUSYJMbcXT@xxxxxxxxxx.

> So, no. I don't want to have an early discussion. I want you to prove me
> wrong with code.
To me, option 3 is less optimal than options 1 and 2. However, I can work on the
formal patches if you would still like to take a look at option 3.


Analysis of current options
--------------------------
Option 1: Do not include any DPAMT support
Pros: Simplicity: by removing all DPAMT-related handing, the huge page
changes would be reduced from
"18 files changed, 633 insertions(+), 57 deletions(-)" to
"17 files changed, 518 insertions(+), 39 deletions(-)".
The tip side would be greatly simplified: with only 1 patch remaining.
On the KVM side, 3 patches can be dropped, and the patch adding
core support for splitting under a non-vCPU context would be greatly
simplified due to the removal of the per-VM DPAMT cache.
Cons: 1. KVM changes are slightly awkward since the current 4KB
mapping/unmapping already include DPAMT support.
2. mutual exclusivity between DPAMT and the initial huge page.


Option 2: Include DPAMT support from the beginning
Pros: 1. The KVM code was largely co-developed with Sean, so it is expected
to face less objection from the KVM side.
2. Sean previously suggested including DPAMT support from the
beginning: "In the end, this fits nicely into *one* patch, with
significantly fewer lines changed overall."
https://lore.kernel.org/all/aXqSg2nUSYJMbcXT@xxxxxxxxxx.

Cons: More code overall.


Option 3: Start with DPAMT-off and append the DPAMT support at the end.
Pros: The first part is simplified. Maintainer can chop the patches off the
end if they don't agree.

Cons: 1. The diff in the 2nd part is non-tiny:
7 files changed, 130 insertions(+), 43 deletions(-).
2. The diff is less clean compared to having DPAMT-on support included
from the start (option 2).