diff options
author | Haiwei Li <lihaiwei@tencent.com> | 2021-04-21 11:25:13 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-04-26 05:27:18 -0400 |
commit | 10dbdf98acd620f376313b85b587c9b9563fc170 (patch) | |
tree | ea2c20ff6ab5eb809603ee95b210e2973453f1d1 /arch/x86 | |
parent | 469bb32b68d5a414fea293c17b532329c6dc9612 (diff) |
KVM: x86: Take advantage of kvm_arch_dy_has_pending_interrupt()
`kvm_arch_dy_runnable` checks the pending_interrupt as the code in
`kvm_arch_dy_has_pending_interrupt`. So take advantage of it.
Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
Message-Id: <20210421032513.1921-1-lihaiwei.kernel@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/x86.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 016a083aa57f..cf3b67679cf0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11120,28 +11120,25 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu); } -bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) +bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu) { - if (READ_ONCE(vcpu->arch.pv.pv_unhalted)) - return true; - - if (kvm_test_request(KVM_REQ_NMI, vcpu) || - kvm_test_request(KVM_REQ_SMI, vcpu) || - kvm_test_request(KVM_REQ_EVENT, vcpu)) - return true; - if (vcpu->arch.apicv_active && static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu)) return true; return false; } -bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu) +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) { - if (vcpu->arch.apicv_active && static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu)) + if (READ_ONCE(vcpu->arch.pv.pv_unhalted)) return true; - return false; + if (kvm_test_request(KVM_REQ_NMI, vcpu) || + kvm_test_request(KVM_REQ_SMI, vcpu) || + kvm_test_request(KVM_REQ_EVENT, vcpu)) + return true; + + return kvm_arch_dy_has_pending_interrupt(vcpu); } bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) |