Skip to content

Commit

Permalink
KVM: x86/mmu: Do remote TLB flush before dropping RCU in TDP MMU resched
Browse files Browse the repository at this point in the history
When yielding in the TDP MMU iterator, service any pending TLB flush
before dropping RCU protections in anticipation of using the caller's RCU
"lock" as a proxy for vCPUs in the guest.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220226001546.360188-19-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed Mar 8, 2022
1 parent cf3e264 commit bd29677
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kvm/mmu/tdp_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,11 +716,11 @@ static inline bool __must_check tdp_mmu_iter_cond_resched(struct kvm *kvm,
return false;

if (need_resched() || rwlock_needbreak(&kvm->mmu_lock)) {
rcu_read_unlock();

if (flush)
kvm_flush_remote_tlbs(kvm);

rcu_read_unlock();

if (shared)
cond_resched_rwlock_read(&kvm->mmu_lock);
else
Expand Down

0 comments on commit bd29677

Please sign in to comment.