KVM: nVMX: Make event request on VMXOFF iff INIT/SIPI is pending
authorSean Christopherson <seanjc@google.com>
Wed, 21 Sep 2022 00:31:57 +0000 (00:31 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Sep 2022 16:37:20 +0000 (12:37 -0400)
Explicitly check for a pending INIT/SIPI event when emulating VMXOFF
instead of blindly making an event request.  There's obviously no need
to evaluate events if none are pending.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220921003201.1441511-9-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c

index 5922531..8f67a9c 100644 (file)
@@ -5193,8 +5193,8 @@ static int handle_vmxoff(struct kvm_vcpu *vcpu)
 
        free_nested(vcpu);
 
-       /* Process a latched INIT during time CPU was in VMX operation */
-       kvm_make_request(KVM_REQ_EVENT, vcpu);
+       if (kvm_apic_has_pending_init_or_sipi(vcpu))
+               kvm_make_request(KVM_REQ_EVENT, vcpu);
 
        return nested_vmx_succeed(vcpu);
 }