From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lai Jiangshan Subject: Re: [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation Date: Mon, 17 Oct 2011 17:17:20 +0800 Message-ID: <4E9BF2A0.40306@cn.fujitsu.com> References: <20110913093835.GB4265@localhost.localdomain> <20110914093441.e2bb305c.kamezawa.hiroyu@jp.fujitsu.com> <4E705BC3.5000508@cn.fujitsu.com> <20110915164704.9cacd407.kamezawa.hiroyu@jp.fujitsu.com> <4E71B28F.7030201@cn.fujitsu.com> <4E72F3BA.2000603@jp.fujitsu.com> <4E73200A.7040908@jp.fujitsu.com> <4E76C6AA.9080403@cn.fujitsu.com> <4E7B04DC.1030407@cn.fujitsu.com> <4E7B4B8F.507@siemens.com> <4E7C51E4.2000503@cn.fujitsu.com> <4E7F3585.40108@redhat.com> <4E7F635E.6080009@web.de> <4E8035F9.9080908@redhat.com> <4E928B54.1070707@cn.fujitsu.com> <4E92958E.9000509@web.de> <4E9476E2.1070804@cn.fujitsu.com> <4E948842.4030406@web.de> <4E978827.6070008@cn.fujitsu.com> <4E97CE42.9020102@web.de> <4E97D85C.7070107@cn.fujitsu.com> <4E97DB62.9020605@web.de> <4E97FAC7.6080007@cn.fujitsu.com> <4E9A A657.1050503@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Jan Kiszka , Kenji Kaneshige , KAMEZAWA Hiroyuki , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" To: Avi Kivity Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:59791 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751470Ab1JQJP5 (ORCPT ); Mon, 17 Oct 2011 05:15:57 -0400 In-Reply-To: <4E9AA657.1050503@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/16/2011 05:39 PM, Avi Kivity wrote: > On 10/14/2011 11:03 AM, Lai Jiangshan wrote: >> Currently, NMI interrupt is blindly sent to all the vCPUs when NMI >> button event happens. This doesn't properly emulate real hardware on >> which NMI button event triggers LINT1. Because of this, NMI is sent to >> the processor even when LINT1 is masked in LVT. For example, this >> causes the problem that kdump initiated by NMI sometimes doesn't work >> on KVM, because kdump assumes NMI is masked on CPUs other than CPU0. >> >> With this patch, we introduce introduce KVM_SET_LINT1, >> and we can use KVM_SET_LINT1 to correctly emulate NMI button >> without change the old KVM_NMI behavior. >> >> @@ -759,6 +762,8 @@ struct kvm_clock_data { >> #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) >> /* Available with KVM_CAP_RMA */ >> #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) >> +/* Available with KVM_CAP_SET_LINT1 for x86 */ >> +#define KVM_SET_LINT1 _IO(KVMIO, 0xaa) >> >> > > LINT1 may have been programmed as a level -triggered interrupt instead > of edge triggered (NMI or interrupt). We can use the ioctl argument for > the level (and pressing the NMI button needs to pulse the level to 1 and > back to 0). > Hi, Avi, How to handle level=0 in the kernel? Or just ignore it? Thanks, Lai From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjIi-0000Xo-3K for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:16:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFjIg-0001hn-LF for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:16:04 -0400 Received: from [222.73.24.84] (port=58640 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjIe-0001gg-1G for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:16:02 -0400 Message-ID: <4E9BF2A0.40306@cn.fujitsu.com> Date: Mon, 17 Oct 2011 17:17:20 +0800 From: Lai Jiangshan MIME-Version: 1.0 References: <20110913093835.GB4265@localhost.localdomain> <20110914093441.e2bb305c.kamezawa.hiroyu@jp.fujitsu.com> <4E705BC3.5000508@cn.fujitsu.com> <20110915164704.9cacd407.kamezawa.hiroyu@jp.fujitsu.com> <4E71B28F.7030201@cn.fujitsu.com> <4E72F3BA.2000603@jp.fujitsu.com> <4E73200A.7040908@jp.fujitsu.com> <4E76C6AA.9080403@cn.fujitsu.com> <4E7B04DC.1030407@cn.fujitsu.com> <4E7B4B8F.507@siemens.com> <4E7C51E4.2000503@cn.fujitsu.com> <4E7F3585.40108@redhat.com> <4E7F635E.6080009@web.de> <4E8035F9.9080908@redhat.com> <4E928B54.1070707@cn.fujitsu.com> <4E92958E.9000509@web.de> <4E9476E2.1070804@cn.fujitsu.com> <4E948842.4030406@web.de> <4E978827.6070008@cn.fujitsu.com> <4E97CE42.9020102@web.de> <4E97D85C.7070107@cn.fujitsu.com> <4E97DB62.9020605@web.de> <4E97FAC7.6080007@cn.fujitsu.com> <4E9AA657.1050503@redhat.com> In-Reply-To: <4E9AA657.1050503@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: "kvm@vger.kernel.org" , Jan Kiszka , "qemu-devel@nongnu.org" , KAMEZAWA Hiroyuki , Kenji Kaneshige On 10/16/2011 05:39 PM, Avi Kivity wrote: > On 10/14/2011 11:03 AM, Lai Jiangshan wrote: >> Currently, NMI interrupt is blindly sent to all the vCPUs when NMI >> button event happens. This doesn't properly emulate real hardware on >> which NMI button event triggers LINT1. Because of this, NMI is sent to >> the processor even when LINT1 is masked in LVT. For example, this >> causes the problem that kdump initiated by NMI sometimes doesn't work >> on KVM, because kdump assumes NMI is masked on CPUs other than CPU0. >> >> With this patch, we introduce introduce KVM_SET_LINT1, >> and we can use KVM_SET_LINT1 to correctly emulate NMI button >> without change the old KVM_NMI behavior. >> >> @@ -759,6 +762,8 @@ struct kvm_clock_data { >> #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) >> /* Available with KVM_CAP_RMA */ >> #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) >> +/* Available with KVM_CAP_SET_LINT1 for x86 */ >> +#define KVM_SET_LINT1 _IO(KVMIO, 0xaa) >> >> > > LINT1 may have been programmed as a level -triggered interrupt instead > of edge triggered (NMI or interrupt). We can use the ioctl argument for > the level (and pressing the NMI button needs to pulse the level to 1 and > back to 0). > Hi, Avi, How to handle level=0 in the kernel? Or just ignore it? Thanks, Lai