From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] qemu: Fix inject-nmi Date: Thu, 22 Sep 2011 16:51:59 +0200 Message-ID: <4E7B4B8F.507@siemens.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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Anthony Liguori , "qemu-devel@nongnu.org" , Kenji Kaneshige , KAMEZAWA Hiroyuki , "kvm@vger.kernel.org" To: Lai Jiangshan Return-path: Received: from thoth.sbs.de ([192.35.17.2]:32288 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753216Ab1IVOwV (ORCPT ); Thu, 22 Sep 2011 10:52:21 -0400 In-Reply-To: <4E7B04DC.1030407@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2011-09-22 11:50, Lai Jiangshan wrote: > > From: KAMEZAWA Hiroyuki > Subject: [PATCH] Fix inject-nmi > > Now, inject-nmi sends NMI to all cpus...but this doesn't emulate > pc hardware 'NMI button', which triggers LINT1. > > So, now, LINT1 mask is ignored by inject-nmi and NMIs are sent to > all cpus without checking LINT1 mask. > > Because Linux masks LINT1 of cpus other than 0, this makes trouble. > For example, kdump cannot run sometimes. > --- > hw/apic.c | 7 +++++++ > hw/apic.h | 1 + > monitor.c | 4 ++-- > 3 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/hw/apic.c b/hw/apic.c > index 69d6ac5..020305b 100644 > --- a/hw/apic.c > +++ b/hw/apic.c > @@ -205,6 +205,13 @@ void apic_deliver_pic_intr(DeviceState *d, int level) > } > } > > +void apic_deliver_lint1_intr(DeviceState *d) > +{ > + APICState *s = DO_UPCAST(APICState, busdev.qdev, d); > + > + apic_local_deliver(s, APIC_LVT_LINT1); This will cause a qemu crash when apic_state is NULL (non-SMP 486 systems). Moreover: wrong indention. You know that this won't work for qemu-kvm with in-kernel irqchip? You may want to provide a patch for that tree, emulating the unavailable LINT1 injection via testing the APIC configration and then raising an NMI as before if it is accepted. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6kdQ-0002qr-9Z for qemu-devel@nongnu.org; Thu, 22 Sep 2011 10:52:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6kdO-0006EP-MM for qemu-devel@nongnu.org; Thu, 22 Sep 2011 10:52:20 -0400 Received: from thoth.sbs.de ([192.35.17.2]:24565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6kdO-0006E8-89 for qemu-devel@nongnu.org; Thu, 22 Sep 2011 10:52:18 -0400 Message-ID: <4E7B4B8F.507@siemens.com> Date: Thu, 22 Sep 2011 16:51:59 +0200 From: Jan Kiszka 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> In-Reply-To: <4E7B04DC.1030407@cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu: Fix inject-nmi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lai Jiangshan Cc: "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" , Avi Kivity , Kenji Kaneshige , KAMEZAWA Hiroyuki On 2011-09-22 11:50, Lai Jiangshan wrote: > > From: KAMEZAWA Hiroyuki > Subject: [PATCH] Fix inject-nmi > > Now, inject-nmi sends NMI to all cpus...but this doesn't emulate > pc hardware 'NMI button', which triggers LINT1. > > So, now, LINT1 mask is ignored by inject-nmi and NMIs are sent to > all cpus without checking LINT1 mask. > > Because Linux masks LINT1 of cpus other than 0, this makes trouble. > For example, kdump cannot run sometimes. > --- > hw/apic.c | 7 +++++++ > hw/apic.h | 1 + > monitor.c | 4 ++-- > 3 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/hw/apic.c b/hw/apic.c > index 69d6ac5..020305b 100644 > --- a/hw/apic.c > +++ b/hw/apic.c > @@ -205,6 +205,13 @@ void apic_deliver_pic_intr(DeviceState *d, int level) > } > } > > +void apic_deliver_lint1_intr(DeviceState *d) > +{ > + APICState *s = DO_UPCAST(APICState, busdev.qdev, d); > + > + apic_local_deliver(s, APIC_LVT_LINT1); This will cause a qemu crash when apic_state is NULL (non-SMP 486 systems). Moreover: wrong indention. You know that this won't work for qemu-kvm with in-kernel irqchip? You may want to provide a patch for that tree, emulating the unavailable LINT1 injection via testing the APIC configration and then raising an NMI as before if it is accepted. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux