[PATCH 14/17] KVM: x86/mmu: Remove KVM_BUG_ON() that checks lock when removing PTs
From: Rick Edgecombe
Date: Fri Mar 27 2026 - 16:25:58 EST
As part of an ongoing effort to move TDX specific bits from the MMU into
the TDX code, drop the KVM_BUG_ON() that checks the MMU lock is held for
write while removing page tables.
Future changes forward PTE removal mirror EPT updates into the
set_private_spte() and let TDX code parse the PTE to decide what S-EPT
operations to take. This operations does not pass a shared bool for this
KVM_BUG_ON() to use in the logics future home.
But even today there are already MMU write lockdep asserts that mostly
cover the case. Since the KVM_BUG_ON() is already a bit redundant, just
remove it instead of trying to plumb the bool into TDX code.
Link: https://lore.kernel.org/kvm/aYUarHf3KEwHGuJe@xxxxxxxxxx/
Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
---
arch/x86/kvm/mmu/tdp_mmu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index 991870789863..5dc9633c866e 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -473,10 +473,8 @@ static void handle_removed_pt(struct kvm *kvm, tdp_ptep_t pt, bool shared)
}
handle_changed_spte(kvm, sp, gfn, old_spte, FROZEN_SPTE, level, shared);
- if (is_mirror_sp(sp)) {
- KVM_BUG_ON(shared, kvm);
+ if (is_mirror_sp(sp))
remove_external_spte(kvm, gfn, old_spte, level);
- }
}
if (is_mirror_sp(sp) &&
--
2.53.0