From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/1] Disable GUEST_INTR_STATE_STI flag before injecting NMI to guest on VMX Date: Fri, 27 Aug 2010 12:21:10 +0300 Message-ID: <4C778386.8090902@redhat.com> References: <1282853162-16925-1-git-send-email-Jes.Sorensen@redhat.com> <1282853162-16925-2-git-send-email-Jes.Sorensen@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, gleb@redhat.com To: Jes.Sorensen@redhat.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:20225 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532Ab0H0JVO (ORCPT ); Fri, 27 Aug 2010 05:21:14 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7R9LEcR006492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 27 Aug 2010 05:21:14 -0400 In-Reply-To: <1282853162-16925-2-git-send-email-Jes.Sorensen@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/26/2010 11:06 PM, Jes.Sorensen@redhat.com wrote: > From: Jes Sorensen > > Injecting an NMI while GUEST_INTR_STATE_STI is set may fail, > which can cause an EXIT with invalid state, resulting in the > guest dieing. > > Credit to Gleb for figuring out why it was failing and how to > fix it. > > Signed-off-by: Jes Sorensen > Signed-off-by: Gleb Natapov > --- > arch/x86/kvm/vmx.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index cf56462..8e95371 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -2888,6 +2888,8 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu) > kvm_rip_write(vcpu, vmx->rmode.irq.rip - 1); > return; > } > + vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, > + vmcs_read32(GUEST_INTERRUPTIBILITY_INFO)& ~GUEST_INTR_STATE_STI); vmcs_clear_bits() is a nicer way of doing this. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.