KVM: x86: Optimize kvm->lock and SRCU interaction (KVM_X86_SET_MSR_FILTER)
authorMichal Luczaj <mhal@rbox.co>
Sat, 7 Jan 2023 00:12:52 +0000 (01:12 +0100)
committerSean Christopherson <seanjc@google.com>
Fri, 3 Feb 2023 23:30:17 +0000 (15:30 -0800)
commit708f799d22fe6b69d2e6e3e0625c30666d5e798a
treed8c5d7356311c60c71776cd9fac0f42a05a6092c
parent95744a90db18437410aa94620b8a330311bd9cf6
KVM: x86: Optimize kvm->lock and SRCU interaction (KVM_X86_SET_MSR_FILTER)

Reduce time spent holding kvm->lock: unlock mutex before calling
synchronize_srcu().  There is no need to hold kvm->lock until all vCPUs
have been kicked, KVM only needs to guarantee that all vCPUs will switch
to the new filter before exiting to userspace.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Link: https://lore.kernel.org/r/20230107001256.2365304-3-mhal@rbox.co
[sean: expand changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c