]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86/mmu: Drop KVM_BUG_ON() on shared lock to zap child external PTEs
authorRick Edgecombe <rick.p.edgecombe@intel.com>
Sat, 9 May 2026 07:56:47 +0000 (15:56 +0800)
committerSean Christopherson <seanjc@google.com>
Thu, 28 May 2026 00:19:19 +0000 (17:19 -0700)
Drop the KVM_BUG_ON() in the KVM MMU core before zapping child external
PTEs, since requiring zapping PTEs to be protected by exclusive mmu_lock is
TDX's specific requirement.

No need to plumb the shared/exclusive info into the remove_external_spte()
op or move the KVM_BUG_ON() to TDX, because
- There's already an assertion of exclusive mmu_lock protection in TDX.
- The KVM_BUG_ON() is a bit redundant given that if there's any bug causing
  zapping of leaf PTEs in S-EPT under shared mmu_lock, SEAMCALL failures
  due to contention would result in TDX_BUG_ON() in TDX.

Link: https://lore.kernel.org/kvm/aYUarHf3KEwHGuJe@google.com/
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Link: https://patch.msgid.link/20260509075647.4290-1-yan.y.zhao@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/tdp_mmu.c

index 3c3e73ce8da984f9793d4abf603158aae0e22cde..3ba7556a8d2fdba8e648c2bfe4a21f954fd84c51 100644 (file)
@@ -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) &&