Re: [PATCH v2 24/28] KVM: x86/mmu: Allow zap gfn range to operate under the mmu read lock

2021-02-03 Thread Paolo Bonzini
On 03/02/21 19:31, Ben Gardon wrote: On Wed, Feb 3, 2021 at 3:26 AM Paolo Bonzini wrote: On 02/02/21 19:57, Ben Gardon wrote: +#ifdef CONFIG_LOCKDEP + if (shared) + lockdep_assert_held_read(>mmu_lock); + else + lockdep_assert_held_write(>mmu_lock); +#endif /*

Re: [PATCH v2 24/28] KVM: x86/mmu: Allow zap gfn range to operate under the mmu read lock

2021-02-03 Thread Ben Gardon
On Wed, Feb 3, 2021 at 3:26 AM Paolo Bonzini wrote: > > On 02/02/21 19:57, Ben Gardon wrote: > > +#ifdef CONFIG_LOCKDEP > > + if (shared) > > + lockdep_assert_held_read(>mmu_lock); > > + else > > + lockdep_assert_held_write(>mmu_lock); > > +#endif /* CONFIG_LOCKDEP

Re: [PATCH v2 24/28] KVM: x86/mmu: Allow zap gfn range to operate under the mmu read lock

2021-02-03 Thread Paolo Bonzini
On 02/02/21 19:57, Ben Gardon wrote: +#ifdef CONFIG_LOCKDEP + if (shared) + lockdep_assert_held_read(>mmu_lock); + else + lockdep_assert_held_write(>mmu_lock); +#endif /* CONFIG_LOCKDEP */ Also, there's no need for the #ifdef here. Do we want a helper

Re: [PATCH v2 24/28] KVM: x86/mmu: Allow zap gfn range to operate under the mmu read lock

2021-02-03 Thread Paolo Bonzini
On 02/02/21 19:57, Ben Gardon wrote: @@ -5518,13 +5518,17 @@ void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end) } } + kvm_mmu_unlock(kvm); + if (kvm->arch.tdp_mmu_enabled) { Temporary compile error. Paolo

[PATCH v2 24/28] KVM: x86/mmu: Allow zap gfn range to operate under the mmu read lock

2021-02-02 Thread Ben Gardon
To reduce lock contention and interference with page fault handlers, allow the TDP MMU function to zap a GFN range to operate under the MMU read lock. Signed-off-by: Ben Gardon --- arch/x86/kvm/mmu/mmu.c | 13 ++- arch/x86/kvm/mmu/mmu_internal.h | 6 +- arch/x86/kvm/mmu/tdp_mmu.c