Skip to content

Commit 38b0ac4

Browse files
committed
KVM: x86/mmu: Demote the WARN on yielded in xxx_cond_resched() to KVM_MMU_WARN_ON
Convert the WARN in tdp_mmu_iter_cond_resched() that the iterator hasn't already yielded to a KVM_MMU_WARN_ON() so the code is compiled out for production kernels (assuming production kernels disable KVM_PROVE_MMU). Checking for a needed reschedule is a hot path, and KVM sanity checks iter->yielded in several other less-hot paths, i.e. the odds of KVM not flagging that something went sideways are quite low. Furthermore, the odds of KVM not noticing *and* the WARN detecting something worth investigating are even lower. Link: https://lore.kernel.org/r/20241031170633.1502783-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent e287e43 commit 38b0ac4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ static inline bool __must_check tdp_mmu_iter_cond_resched(struct kvm *kvm,
656656
struct tdp_iter *iter,
657657
bool flush, bool shared)
658658
{
659-
WARN_ON_ONCE(iter->yielded);
659+
KVM_MMU_WARN_ON(iter->yielded);
660660

661661
if (!need_resched() && !rwlock_needbreak(&kvm->mmu_lock))
662662
return false;

0 commit comments

Comments
 (0)