Re: [PATCH v4 04/17] KVM: x86/mmu: Prevent huge page promotion for mirror roots in fault path
From: Edgecombe, Rick P
Date: Tue Oct 06 2026 - 20:32:56 EST
On Mon, 2026-09-28 at 17:09 +0800, Yan Zhao wrote:
> From: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
>
> Disallow huge page promotion in the TDP MMU for mirror roots as KVM doesn't
> currently support promoting S-EPT entries due to the complexity incurred
> by the TDX module's rules for huge page promotion.
>
> - The current TDX module requires all 4KB leafs to be either all PENDING
> or all ACCEPTED before a successful promotion to 2MB. This requirement
> prevents successful page merging after partially converting a 2MB
> range from private to shared and then back to private, which is the
> primary scenario necessitating page promotion.
>
> - The TDX module effectively requires a break-before-make sequence (to
> satisfy its TLB flushing rules), i.e., creates a window of time where a
> different vCPU can encounter faults on a SPTE that KVM is trying to
> promote to a huge page. To avoid unexpected BUSY errors, KVM would need
> to FREEZE the non-leaf SPTE before replacing it with a huge SPTE.
>
> Disable huge page promotion for all map() operations, as supporting page
> promotion when building the initial image is still non-trivial, and the
> vast majority of images are ~4MB or less, i.e., the benefit of creating
> huge pages during TD build time is minimal.
>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
> [sean: check root, add comment, rewrite changelog]
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Co-developed-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> Signed-off-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> ---
LGTM. I'm listed as the patch author I think because I suggested it via diff,
but due to the longish SOB chain after here is this too:
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>