From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] nVMX: Fix warning-causing idt-vectoring-info behavior Date: Wed, 21 Sep 2011 14:45:47 +0300 Message-ID: <4E79CE6B.4070305@redhat.com> References: <201109211048.p8LAmDG5016952@rice.haifa.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Dave Allan , Federico Simoncelli , Abel Gordon To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32270 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752794Ab1IULpw (ORCPT ); Wed, 21 Sep 2011 07:45:52 -0400 In-Reply-To: <201109211048.p8LAmDG5016952@rice.haifa.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/21/2011 01:48 PM, Nadav Har'El wrote: > This patch solves two outstanding nested-VMX issues: 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