aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-06-07 10:08:48 -0400
committerAvi Kivity <avi@redhat.com>2012-07-09 07:19:01 -0400
commitb8405c184b4ef3abcebc5cf2211215944d6e2acc (patch)
tree13c52fe08f9f14e425bd8202a2f2e1d135196731 /arch/x86
parentf0495f9b9992f80f82b14306946444b287193390 (diff)
KVM: VMX: Limit iterations with emulator_invalid_guest_state
Otherwise, if the guest ends up looping, we never exit the srcu critical section, which causes synchronize_srcu() to hang. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 82ab1fb2683e..debac4984347 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4977,11 +4977,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
4977 int ret = 1; 4977 int ret = 1;
4978 u32 cpu_exec_ctrl; 4978 u32 cpu_exec_ctrl;
4979 bool intr_window_requested; 4979 bool intr_window_requested;
4980 unsigned count = 130;
4980 4981
4981 cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 4982 cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
4982 intr_window_requested = cpu_exec_ctrl & CPU_BASED_VIRTUAL_INTR_PENDING; 4983 intr_window_requested = cpu_exec_ctrl & CPU_BASED_VIRTUAL_INTR_PENDING;
4983 4984
4984 while (!guest_state_valid(vcpu)) { 4985 while (!guest_state_valid(vcpu) && count-- != 0) {
4985 if (intr_window_requested 4986 if (intr_window_requested
4986 && (kvm_get_rflags(&vmx->vcpu) & X86_EFLAGS_IF)) 4987 && (kvm_get_rflags(&vmx->vcpu) & X86_EFLAGS_IF))
4987 return handle_interrupt_window(&vmx->vcpu); 4988 return handle_interrupt_window(&vmx->vcpu);