aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-06-10 11:07:57 -0400
committerAvi Kivity <avi@redhat.com>2012-07-09 07:19:02 -0400
commitbdea48e305389b3c8c0f786a317f9da984c16604 (patch)
tree55f7789969d10b22ba6ea0e4f11f67dc422133e6
parent96051572c819194c37a8367624b285be10297eca (diff)
KVM: VMX: Fix interrupt exit condition during emulation
Checking EFLAGS.IF is incorrect as we might be in interrupt shadow. If that is the case, the main loop will notice that and not inject the interrupt, causing an endless loop. Fix by using vmx_interrupt_allowed() to check if we can inject an interrupt instead. Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/vmx.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index debac4984347..6cdb40457695 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4983,8 +4983,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
4983 intr_window_requested = cpu_exec_ctrl & CPU_BASED_VIRTUAL_INTR_PENDING; 4983 intr_window_requested = cpu_exec_ctrl & CPU_BASED_VIRTUAL_INTR_PENDING;
4984 4984
4985 while (!guest_state_valid(vcpu) && count-- != 0) { 4985 while (!guest_state_valid(vcpu) && count-- != 0) {
4986 if (intr_window_requested 4986 if (intr_window_requested && vmx_interrupt_allowed(vcpu))
4987 && (kvm_get_rflags(&vmx->vcpu) & X86_EFLAGS_IF))
4988 return handle_interrupt_window(&vmx->vcpu); 4987 return handle_interrupt_window(&vmx->vcpu);
4989 4988
4990 err = emulate_instruction(vcpu, 0); 4989 err = emulate_instruction(vcpu, 0);