]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: correct meaningless kvm_apicv_activated() check
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 14 Mar 2020 11:29:23 +0000 (12:29 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 16 Mar 2020 16:58:59 +0000 (17:58 +0100)
commitfbb700baa665c0abd049c78fd85a57f2b6c78313
treef28323015730289c4f9d57a023bd404ab016cf30
parentcfad4e8967cc9871fb5a3df05f6b0130c9585f9d
KVM: X86: correct meaningless kvm_apicv_activated() check

After test_and_set_bit() for kvm->arch.apicv_inhibit_reasons, we will
always get false when calling kvm_apicv_activated() because it's sure
apicv_inhibit_reasons do not equal to 0.

What the code wants to do, is check whether APICv was *already* active
and if so skip the costly request; we can do this using cmpxchg.

Reported-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c