From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 10/11] VMX: work around lacking VNMI support Date: Wed, 24 Sep 2008 17:48:37 +0300 Message-ID: <20080924144837.GL3072@minantech.com> References: <48D74CE6.5060008@siemens.com> <200809231742.03316.sheng.yang@intel.com> <20080923094544.GE3072@minantech.com> <200809231750.49882.sheng.yang@intel.com> <48DA3532.9040306@siemens.com> <20080924125057.GF3072@minantech.com> <48DA3908.2000204@siemens.com> <20080924130236.GG3072@minantech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Yang, Sheng" , kvm-devel , Avi Kivity To: Jan Kiszka Return-path: Received: from il.qumranet.com ([212.179.150.194]:24710 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750875AbYIXOsj (ORCPT ); Wed, 24 Sep 2008 10:48:39 -0400 Content-Disposition: inline In-Reply-To: <20080924130236.GG3072@minantech.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Sep 24, 2008 at 04:02:36PM +0300, Gleb Natapov wrote: > On Wed, Sep 24, 2008 at 02:56:40PM +0200, Jan Kiszka wrote: > > > We should do something like this: > > > > > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > > > index 046a91b..860e66d 100644 > > > --- a/arch/x86/kvm/vmx.c > > > +++ b/arch/x86/kvm/vmx.c > > > @@ -2826,10 +2826,20 @@ static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) > > > unsigned long exit_qualification; > > > u16 tss_selector; > > > int reason; > > > + struct vcpu_vmx *vmx = to_vmx(vcpu); > > > > > > exit_qualification = vmcs_readl(EXIT_QUALIFICATION); > > > > > > reason = (u32)exit_qualification >> 30; > > > + > > > + if (reason == TASK_SWITCH_GATE && vmx->vcpu.arch.nmi_injected && > > > + (vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK) && > > > + (vmx->idt_vectoring_info & VECTORING_INFO_TYPE_MASK) == INTR_TYPE_NMI_INTR) { > > > + vcpu->arch.nmi_injected = false; > > > + vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, > > > + GUEST_INTR_STATE_NMI); > > > + printk(KERN_DEBUG"NMI cause task switch. No need to reinject\n"); > > > + } > > > > OK, I just think we are not supposed to set GUEST_INTR_STATE_NMI without > > cpu_has_virtual_nmis(). Otherwise looks reasonable. Have you tested > > this? Does it make your 2003 power-off? > > > It does power-off, but hands during reboot. Looking at it right now. > OK. The hand is a bug in qemu. Apic reset function marks CPU 1 as halted and the CPU is never enters kernel again. -- Gleb.