From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: Qemu: push_nmi should be only used by I386 Arch. Date: Thu, 27 Nov 2008 12:39:41 +0100 Message-ID: <492E86FD.1040903@siemens.com> References: <706158FABBBA044BAD4FE898A02E4BC219BCA9F5@pdsmsx503.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , "kvm@vger.kernel.org" , "kvm-ia64@vger.kernel.org" To: "Zhang, Xiantao" Return-path: Received: from lizzard.sbs.de ([194.138.37.39]:18924 "EHLO lizzard.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752659AbYK0Lke (ORCPT ); Thu, 27 Nov 2008 06:40:34 -0500 In-Reply-To: <706158FABBBA044BAD4FE898A02E4BC219BCA9F5@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Zhang, Xiantao wrote: > From 1b89616f99abc8e0983ef58a1f984f31a52fe828 Mon Sep 17 00:00:00 2001 > From: Xiantao Zhang > Date: Thu, 27 Nov 2008 17:24:51 +0800 > Subject: [PATCH] KVM: Qemu: push_nmi should be only used by I386 Arch. > > Use TARGET_I386 to exclude other archs. > Signed-off-by: Xiantao Zhang > --- > qemu/qemu-kvm.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c > index cf0e85d..b6c8288 100644 > --- a/qemu/qemu-kvm.c > +++ b/qemu/qemu-kvm.c > @@ -154,10 +154,12 @@ static int try_push_interrupts(void *opaque) > return kvm_arch_try_push_interrupts(opaque); > } > > +#ifdef TARGET_I386 > static void push_nmi(void *opaque) > { > kvm_arch_push_nmi(opaque); > } > +#endif > > static void post_kvm_run(void *opaque, void *data) > { > @@ -742,7 +744,9 @@ static struct kvm_callbacks qemu_kvm_ops = { > .shutdown = kvm_shutdown, > .io_window = kvm_io_window, > .try_push_interrupts = try_push_interrupts, > +#ifdef TARGET_I386 > .push_nmi = push_nmi, > +#endif > .post_kvm_run = post_kvm_run, > .pre_kvm_run = pre_kvm_run, > #ifdef TARGET_I386 Well, doesn't push_nmi() from libkvm.c call into this hook unconditionally if KVM_CAP_NMI is set (which is the case for all recent kernel headers)? That should cause SEGVs, so you need to patch kvm_run() as well. Makes me wonder if we shouldn't have better defined KVM_CAP_NMI conditionally, only for arch that actually have NMIs (/wrt KVM: only x86 ATM). But now it's too late... Jan -- Siemens AG, Corporate Technology, CT SE 2 ES-OS Corporate Competence Center Embedded Linux