Re: [PATCH] nVMX: Fix warning-causing idt-vectoring-info behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/21/2011 01:48 PM, Nadav Har'El wrote:
This patch solves two outstanding nested-VMX issues:

<snip>

Sorry, I missed an important point on the first review.

--- .before/arch/x86/kvm/vmx.c	2011-09-21 13:45:59.000000000 +0300
+++ .after/arch/x86/kvm/vmx.c	2011-09-21 13:45:59.000000000 +0300
@@ -3858,12 +3858,17 @@ static bool nested_exit_on_intr(struct k
  static void enable_irq_window(struct kvm_vcpu *vcpu)
  {
  	u32 cpu_based_vm_exec_control;
-	if (is_guest_mode(vcpu)&&  nested_exit_on_intr(vcpu))
-		/* We can get here when nested_run_pending caused
-		 * vmx_interrupt_allowed() to return false. In this case, do
-		 * nothing - the interrupt will be injected later.
+	if (is_guest_mode(vcpu)&&  nested_exit_on_intr(vcpu)) {
+		/*
+		 * We get here if vmx_interrupt_allowed() returned 0 because
+		 * we must enter L2 now, so we can't inject to L1 now. If we
+		 * just do nothing, L2 will later exit and we can inject the
+		 * IRQ to L1 then. But to make L2 exit more promptly, we send
+		 * a self-IPI, causing L2 to exit right after entry.
  		 */
+		smp_send_reschedule(vcpu->cpu);
  		return;
+	}

->enable_irq_window() is called with interrupts enabled, so the self-IPI will be dispatched immediately and be lost.

The way to handle it is to kvm_make_request(KVM_REQ_IMMEDIATE_EXIT) here, and to add code to vcpu_enter_guest() to sample this into a local variable, and, after disabling interrupts, do the self-IPI.

A unit test would have caught this...

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux