[PATCH] KVM: X86: avoid meaningless kvm_apicv_activated() check

From: linmiaohe
Date: Mon Feb 24 2020 - 21:20:08 EST


From: Miaohe Lin <linmiaohe@xxxxxxxxxx>

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.

Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
---
arch/x86/kvm/x86.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ddcc51b89e2c..fa62dcb0ed0c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -8018,8 +8018,7 @@ void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit)
!kvm_apicv_activated(kvm))
return;
} else {
- if (test_and_set_bit(bit, &kvm->arch.apicv_inhibit_reasons) ||
- kvm_apicv_activated(kvm))
+ if (test_and_set_bit(bit, &kvm->arch.apicv_inhibit_reasons))
return;
}

--
2.19.1