From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] qemu-kvm: Fix segfault on -no-kvm startup Date: Fri, 25 Sep 2009 21:03:11 +0200 Message-ID: <4ABD13EF.7090403@web.de> References: <4ABCEA5D.4000209@siemens.com> <20090925170548.GA30416@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3E1BB168D374074899A67E48" Cc: Avi Kivity , Marcelo Tosatti , kvm-devel To: Gleb Natapov Return-path: Received: from fmmailgate02.web.de ([217.72.192.227]:47546 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbZIYTDJ (ORCPT ); Fri, 25 Sep 2009 15:03:09 -0400 In-Reply-To: <20090925170548.GA30416@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3E1BB168D374074899A67E48 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gleb Natapov wrote: > On Fri, Sep 25, 2009 at 06:05:49PM +0200, Jan Kiszka wrote: >> The check for in-kernel irqchip must be protected by kvm_enabled, and = we >> have a different wrapper for it. >> > Why not move kvm_enabled() into kvm_irqchip_in_kernel()? It will return= > false if !kvm_enabled(). Yes, possible. But I'm not sure if it's worth to refactor at this level. I think the whole irqchip interface has to go through some broader refactoring when pushing it upstream. The result should either be a specific, in-kernel-irqchip apic device or generic wrapper services that cover all cases, is easily compiled away in the absence of KVM and avoid #ifdefs like below. Jan >=20 >> Signed-off-by: Jan Kiszka >> --- >> >> hw/apic.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/hw/apic.c b/hw/apic.c >> index 3a2e128..01ac174 100644 >> --- a/hw/apic.c >> +++ b/hw/apic.c >> @@ -509,9 +509,10 @@ void apic_init_reset(CPUState *env) >> =20 >> env->halted =3D !(s->apicbase & MSR_IA32_APICBASE_BSP); >> #ifdef KVM_CAP_MP_STATE >> - if (kvm_irqchip_in_kernel(kvm_context)) >> + if (kvm_enabled() && qemu_kvm_irqchip_in_kernel()) { >> env->mp_state >> =3D env->halted ? KVM_MP_STATE_UNINITIALIZED : KVM_MP_STA= TE_RUNNABLE; >> + } >> #endif >> } >> =20 --------------enig3E1BB168D374074899A67E48 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkq9E+8ACgkQitSsb3rl5xR6lQCg10d7KZVGC9+Jp4Ft0xHxvGQz fH0An2kgiBdOVXIiH/VpzhSudowpjWEG =r513 -----END PGP SIGNATURE----- --------------enig3E1BB168D374074899A67E48--