Re: [PATCH v2 23/28] KVM: x86/mmu: Allow parallel page faults for the TDP MMU

2021-02-05 Thread Sean Christopherson
On Wed, Feb 03, 2021, Paolo Bonzini wrote: > On 03/02/21 18:46, Ben Gardon wrote: > > enum kvm_mmu_lock_mode lock_mode = > > get_mmu_lock_mode_for_root(vcpu->kvm, vcpu->arch.mmu->root_hpa); > > > > kvm_mmu_lock_for_mode(lock_mode); > > > > Not sure if either of those are actually clearer, but

Re: [PATCH v2 23/28] KVM: x86/mmu: Allow parallel page faults for the TDP MMU

2021-02-03 Thread Paolo Bonzini
On 03/02/21 18:46, Ben Gardon wrote: enum kvm_mmu_lock_mode lock_mode = get_mmu_lock_mode_for_root(vcpu->kvm, vcpu->arch.mmu->root_hpa); kvm_mmu_lock_for_mode(lock_mode); Not sure if either of those are actually clearer, but the latter trends in the direction the RCF took, having an enum to

Re: [PATCH v2 23/28] KVM: x86/mmu: Allow parallel page faults for the TDP MMU

2021-02-03 Thread Ben Gardon
On Wed, Feb 3, 2021 at 4:40 AM Paolo Bonzini wrote: > > On 02/02/21 19:57, Ben Gardon wrote: > > > > - write_lock(&vcpu->kvm->mmu_lock); > > + > > + if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) > > + read_lock(&vcpu->kvm->mmu_lock); > > + else > > +

Re: [PATCH v2 23/28] KVM: x86/mmu: Allow parallel page faults for the TDP MMU

2021-02-03 Thread Paolo Bonzini
On 02/02/21 19:57, Ben Gardon wrote: - write_lock(&vcpu->kvm->mmu_lock); + + if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) + read_lock(&vcpu->kvm->mmu_lock); + else + write_lock(&vcpu->kvm->mmu_lock); + I'd like to make this into two he

[PATCH v2 23/28] KVM: x86/mmu: Allow parallel page faults for the TDP MMU

2021-02-02 Thread Ben Gardon
Make the last few changes necessary to enable the TDP MMU to handle page faults in parallel while holding the mmu_lock in read mode. Reviewed-by: Peter Feiner Signed-off-by: Ben Gardon --- arch/x86/kvm/mmu/mmu.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/a