From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kashyap Chamarthy Subject: Re: [nVMX] With 3.20.0-0.rc0.git5.1 on L0, booting L2 guest results in L1 *rebooting* Date: Thu, 19 Feb 2015 22:10:11 +0100 Message-ID: <20150219211011.GE28728@tesla.redhat.com> References: <20150216204013.GI21838@tesla.redhat.com> <54E2D966.9070706@siemens.com> <20150217112426.GL21838@tesla.redhat.com> <54E4C0FD.4090906@redhat.com> <20150219120719.GJ11686@tesla.redhat.com> <20150219150159.GA19057@potion.brq.redhat.com> <20150219160221.GB19057@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Paolo Bonzini , Jan Kiszka , kvm@vger.kernel.org, dgilbert@redhat.com To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52860 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbbBSVK0 (ORCPT ); Thu, 19 Feb 2015 16:10:26 -0500 Content-Disposition: inline In-Reply-To: <20150219160221.GB19057@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Feb 19, 2015 at 05:02:22PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: > 2015-02-19 16:01+0100, Radim Kr=C4=8Dm=C3=A1=C5=99: > > 2015-02-19 13:07+0100, Kashyap Chamarthy: > > 5f3d5799974b8 KVM: nVMX: Rework event injection and recovery: > > This concept is based on the rule that a pending vmlaunch/vmresum= e is > > not canceled. Otherwise, we would risk to lose injected events or= leak > > them into the wrong queues. Encode this rule via a WARN_ON_ONCE a= t the > > entry of nested_vmx_vmexit. > >=20 > > I wonder if we have broken the invariant since 3.9 ... >=20 > e011c663b9c786d115c0f45e5b0bfae0c39428d4 > KVM: nVMX: Check all exceptions for intercept during delivery to L2 >=20 > All exceptions should be checked for intercept during delivery to L= 2, > but we check only #PF currently. Drop nested_run_pending while we a= re > at it since exception cannot be injected during vmentry anyway. >=20 > The last sentence is not true. >=20 > Can you try if the following patch works? Sure, will test a Kernel built with the below patch and report back. Thanks for taking a look. -- /kashyap > (I know little about nested, so it might be introducing another bug.) >=20 > Thanks. >=20 > ---8<--- > KVM: nVMX: fix L2 to L1 interrupt leak >=20 > When vmx->nested.nested_run_pending is set, we aren't expected to exi= t > to L1, but nested_vmx_check_exception() could, since e011c663b9c7. > Prevent that. >=20 > Fixes: e011c663b9c7 ("Check all exceptions for intercept during deliv= ery to L2") > Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > --- > arch/x86/kvm/vmx.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 3f73bfad0349..389166a1b79a 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -2098,6 +2098,9 @@ static int nested_vmx_check_exception(struct kv= m_vcpu *vcpu, unsigned nr) > { > struct vmcs12 *vmcs12 =3D get_vmcs12(vcpu); > =20 > + if (to_vmx(vcpu)->nested.nested_run_pending) > + return 0; > + > if (!(vmcs12->exception_bitmap & (1u << nr))) > return 0;