Re: [PATCH 07/17] KVM: x86/tdp_mmu: Centralize updates to present external PTEs

From: Edgecombe, Rick P

Date: Thu Apr 02 2026 - 19:46:49 EST


On Wed, 2026-04-01 at 16:34 +0800, Yan Zhao wrote:
> Issue #2:
> "Additionally, if an SPTE is atomically zapped, is_present evaluates to false.
>  Because tdp_mmu_set_spte_atomic() lacks a fallback remove_external_spte()
>  call like the non-atomic tdp_mmu_set_spte() has, does this mean the external
>  S-EPT mapping remains fully present while KVM marks it as non-present?
> "
>
> Response:
> Up to this patch, this seems to be a valid concern. But atomic zap on the mirror
> root isn't allowed yet (though warning on such case is dropped in patch 5 [2]).
> Centralizing atomic zap to __handle_changed_spte() will be done in patch 15 [3].
> Maybe move patch 5 to after patch 15?
>
> [2] https://lore.kernel.org/kvm/20260327201421.2824383-6-rick.p.edgecombe@xxxxxxxxx/
> [3] https://lore.kernel.org/kvm/20260327201421.2824383-16-rick.p.edgecombe@xxxxxxxxx/
> [4] https://lore.kernel.org/all/20260106102024.25023-1-yan.y.zhao@xxxxxxxxx/

Thanks for checking the AI reviews. I'll see how it slots in there.

>
> Thinking more about centralizing TDX hooks, could we be more aggressive? i.e.,
> let TDX just have a single hook set_external_spte() for propagation of changes
> from mirror page table to S-EPT?
> (below change is on code base with TDX huge page support).

I was asking Yan internally why this works but Sean's earlier attempt failed.
Yan, let's finish the discussion externally now that Sean is poking around.

I'd be inclined to kind to call the cleanup a win and leave further unification
for the future. At least not going turning over rocks.