]> asedeno.scripts.mit.edu Git - linux.git/commit
KVM: VMX: Read cached VM-Exit reason to detect external interrupt
authorSean Christopherson <sean.j.christopherson@intel.com>
Sat, 20 Apr 2019 05:50:56 +0000 (22:50 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 18 Jun 2019 09:46:02 +0000 (11:46 +0200)
commit49def500e5eca40c73da9bad9799e9fab885996f
tree793fd7308857eae63a200dabd89029ec1b036c2f
parent2ea72039808d50c909c2eb00eaebfaaaa743927a
KVM: VMX: Read cached VM-Exit reason to detect external interrupt

Generic x86 code invokes the kvm_x86_ops external interrupt handler on
all VM-Exits regardless of the actual exit type.  Use the already-cached
EXIT_REASON to determine if the VM-Exit was due to an interrupt, thus
avoiding an extra VMREAD (to query VM_EXIT_INTR_INFO) for all other
types of VM-Exit.

In addition to avoiding the extra VMREAD, checking the EXIT_REASON
instead of VM_EXIT_INTR_INFO makes it more obvious that
vmx_handle_external_intr() is called for all VM-Exits, e.g. someone
unfamiliar with the flow might wonder under what condition(s)
VM_EXIT_INTR_INFO does not contain a valid interrupt, which is
simply not possible since KVM always runs with "ack interrupt on exit".

WARN once if VM_EXIT_INTR_INFO doesn't contain a valid interrupt on
an EXTERNAL_INTERRUPT VM-Exit, as such a condition would indicate a
hardware bug.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmcs.h
arch/x86/kvm/vmx/vmx.c