From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= 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 17:02:22 +0100 Message-ID: <20150219160221.GB19057@potion.brq.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> 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: Kashyap Chamarthy Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36505 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbbBSQCb (ORCPT ); Thu, 19 Feb 2015 11:02:31 -0500 Content-Disposition: inline In-Reply-To: <20150219150159.GA19057@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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/vmresume = is > not canceled. Otherwise, we would risk to lose injected events or l= eak > them into the wrong queues. Encode this rule via a WARN_ON_ONCE at = the > entry of nested_vmx_vmexit. >=20 > I wonder if we have broken the invariant since 3.9 ... e011c663b9c786d115c0f45e5b0bfae0c39428d4 KVM: nVMX: Check all exceptions for intercept during delivery to L2 All exceptions should be checked for intercept during delivery to L2, but we check only #PF currently. Drop nested_run_pending while we are at it since exception cannot be injected during vmentry anyway. The last sentence is not true. Can you try if the following patch works? (I know little about nested, so it might be introducing another bug.) Thanks. ---8<--- KVM: nVMX: fix L2 to L1 interrupt leak When vmx->nested.nested_run_pending is set, we aren't expected to exit to L1, but nested_vmx_check_exception() could, since e011c663b9c7. Prevent that. =46ixes: 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(+) 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 kvm_= 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; =20 --=20 2.3.0