Skip to content

Commit 0ad3bed

Browse files
committed
kvm: nVMX: move nested events check to kvm_vcpu_running
vcpu_run calls kvm_vcpu_running, not kvm_arch_vcpu_runnable, and the former does not call check_nested_events. Once KVM_REQ_EVENT is removed from the APICv interrupt injection path, however, this would leave no place to trigger a vmexit from L2 to L1, causing a missed interrupt delivery while in guest mode. This is caught by the "ack interrupt on exit" test in vmx.flat. [This does not change the calls to check_nested_events in inject_pending_event. That is material for a separate cleanup.] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 967235d commit 0ad3bed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kvm/x86.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7023,6 +7023,9 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu)
70237023

70247024
static inline bool kvm_vcpu_running(struct kvm_vcpu *vcpu)
70257025
{
7026+
if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events)
7027+
kvm_x86_ops->check_nested_events(vcpu, false);
7028+
70267029
return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE &&
70277030
!vcpu->arch.apf.halted);
70287031
}
@@ -8389,9 +8392,6 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu)
83898392

83908393
int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
83918394
{
8392-
if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events)
8393-
kvm_x86_ops->check_nested_events(vcpu, false);
8394-
83958395
return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu);
83968396
}
83978397

0 commit comments

Comments
 (0)