KVM: x86: Skip APICv update if APICv is disable at the module level
Bail from the APICv update paths _before_ taking apicv_update_lock if APICv is disabled at the module level. kvm_request_apicv_update() in particular is invoked from multiple paths that can be reached without APICv being enabled, e.g. svm_enable_irq_window(), and taking the rw_sem for write when APICv is disabled may introduce unnecessary contention and stalls. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20211208015236.1616697-25-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7446cfebe8
commit
f15756428d
|
@ -112,6 +112,9 @@ static void synic_update_vector(struct kvm_vcpu_hv_synic *synic,
|
|||
if (!!auto_eoi_old == !!auto_eoi_new)
|
||||
return;
|
||||
|
||||
if (!enable_apicv)
|
||||
return;
|
||||
|
||||
down_write(&vcpu->kvm->arch.apicv_update_lock);
|
||||
|
||||
if (auto_eoi_new)
|
||||
|
|
|
@ -9715,6 +9715,9 @@ void __kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit)
|
|||
|
||||
void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit)
|
||||
{
|
||||
if (!enable_apicv)
|
||||
return;
|
||||
|
||||
down_write(&kvm->arch.apicv_update_lock);
|
||||
__kvm_request_apicv_update(kvm, activate, bit);
|
||||
up_write(&kvm->arch.apicv_update_lock);
|
||||
|
|
Loading…
Reference in New Issue