From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] kvm: Set default accelerator to "kvm" if the host supports it Date: Wed, 03 Oct 2012 11:02:05 +0200 Message-ID: <506BFF0D.6080803@web.de> References: <20120930191146.GA20012@amt.cnet> <50694EC1.8060006@siemens.com> <20121001093102.GA14797@amt.cnet> <50696E9E.7030302@siemens.com> <87zk468h3y.fsf@codemonkey.ws> <50699CDC.1010604@redhat.com> <87wqzap9ui.fsf@codemonkey.ws> <5069A9DF.4040606@siemens.com> <87wqza2mg6.fsf@codemonkey.ws> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig17662E811A11E3803673425A" Cc: kvm , Scott Moser , Marcelo Tosatti , Michael Tokarev , qemu-devel , Blue Swirl , Avi Kivity , Cole Robinson , Paolo Bonzini , =?ISO-8859-1?Q?Andreas_F=E4rber?= , Aurelien Jarno To: Anthony Liguori Return-path: In-Reply-To: <87wqza2mg6.fsf@codemonkey.ws> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig17662E811A11E3803673425A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2012-10-01 18:20, Anthony Liguori wrote: > Jan Kiszka writes: >=20 >> If we built a target for a host that supports KVM in principle, set th= e >> default accelerator to KVM as well. This also means the start of QEMU >> will fail to start if KVM support turns out to be unavailable at >> runtime. >> >> Signed-off-by: Jan Kiszka >> --- >> kvm-all.c | 1 + >> kvm-stub.c | 1 + >> kvm.h | 1 + >> vl.c | 4 ++-- >> 4 files changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/kvm-all.c b/kvm-all.c >> index 92a7137..4d5f86c 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -103,6 +103,7 @@ struct KVMState >> #endif >> }; >> =20 >> +bool kvm_configured =3D true; >> KVMState *kvm_state; >> bool kvm_kernel_irqchip; >> bool kvm_async_interrupts_allowed; >> diff --git a/kvm-stub.c b/kvm-stub.c >> index 3c52eb5..86a6451 100644 >> --- a/kvm-stub.c >> +++ b/kvm-stub.c >> @@ -17,6 +17,7 @@ >> #include "gdbstub.h" >> #include "kvm.h" >> =20 >> +bool kvm_configured; >> KVMState *kvm_state; >> bool kvm_kernel_irqchip; >> bool kvm_async_interrupts_allowed; >> diff --git a/kvm.h b/kvm.h >> index dea2998..9936e5f 100644 >> --- a/kvm.h >> +++ b/kvm.h >> @@ -22,6 +22,7 @@ >> #include >> #endif >> =20 >> +extern bool kvm_configured; >> extern int kvm_allowed; >> extern bool kvm_kernel_irqchip; >> extern bool kvm_async_interrupts_allowed; >> diff --git a/vl.c b/vl.c >> index 8d305ca..f557bd1 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -2215,8 +2215,8 @@ static int configure_accelerator(void) >> } >> =20 >> if (p =3D=3D NULL) { >> - /* Use the default "accelerator", tcg */ >> - p =3D "tcg"; >> + /* The default accelerator depends on the availability of KVM= =2E */ >> + p =3D kvm_configured ? "kvm" : "tcg"; >> } >=20 > How about making this an arch_init() function call and then using a #if= > defined(KVM_CONFIG) in arch_init.c? >=20 > I hate to introduce another global variable if we can avoid it... Hacked too quickly. In fact, kvm_configured is simply kvm_available(). However, resistance appear to be too high here. Jan >=20 > Otherwise: >=20 > Acked-by: Anthony Liguori >=20 > Blue/Aurelien, any objections? >=20 > Regards, >=20 > Anthony Liguori >=20 >> =20 >> while (!accel_initialised && *p !=3D '\0') { >> --=20 >> 1.7.3.4 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >=20 --------------enig17662E811A11E3803673425A 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.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBr/w0ACgkQitSsb3rl5xSQwwCfbYatcepWBdiKyc7bBVigobY4 FKkAoKvwDJyREYaTUYyQ6NTpaJUytPBQ =UDQt -----END PGP SIGNATURE----- --------------enig17662E811A11E3803673425A-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJKqV-0008J5-UV for qemu-devel@nongnu.org; Wed, 03 Oct 2012 05:02:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJKqP-0005ih-Ra for qemu-devel@nongnu.org; Wed, 03 Oct 2012 05:02:23 -0400 Received: from mout.web.de ([212.227.17.12]:57631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJKqP-0005ic-Hi for qemu-devel@nongnu.org; Wed, 03 Oct 2012 05:02:17 -0400 Message-ID: <506BFF0D.6080803@web.de> Date: Wed, 03 Oct 2012 11:02:05 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20120930191146.GA20012@amt.cnet> <50694EC1.8060006@siemens.com> <20121001093102.GA14797@amt.cnet> <50696E9E.7030302@siemens.com> <87zk468h3y.fsf@codemonkey.ws> <50699CDC.1010604@redhat.com> <87wqzap9ui.fsf@codemonkey.ws> <5069A9DF.4040606@siemens.com> <87wqza2mg6.fsf@codemonkey.ws> In-Reply-To: <87wqza2mg6.fsf@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig17662E811A11E3803673425A" Subject: Re: [Qemu-devel] [PATCH] kvm: Set default accelerator to "kvm" if the host supports it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: kvm , Scott Moser , Marcelo Tosatti , Michael Tokarev , qemu-devel , Blue Swirl , Avi Kivity , Cole Robinson , Paolo Bonzini , =?ISO-8859-1?Q?Andreas_F=E4rber?= , Aurelien Jarno This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig17662E811A11E3803673425A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2012-10-01 18:20, Anthony Liguori wrote: > Jan Kiszka writes: >=20 >> If we built a target for a host that supports KVM in principle, set th= e >> default accelerator to KVM as well. This also means the start of QEMU >> will fail to start if KVM support turns out to be unavailable at >> runtime. >> >> Signed-off-by: Jan Kiszka >> --- >> kvm-all.c | 1 + >> kvm-stub.c | 1 + >> kvm.h | 1 + >> vl.c | 4 ++-- >> 4 files changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/kvm-all.c b/kvm-all.c >> index 92a7137..4d5f86c 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -103,6 +103,7 @@ struct KVMState >> #endif >> }; >> =20 >> +bool kvm_configured =3D true; >> KVMState *kvm_state; >> bool kvm_kernel_irqchip; >> bool kvm_async_interrupts_allowed; >> diff --git a/kvm-stub.c b/kvm-stub.c >> index 3c52eb5..86a6451 100644 >> --- a/kvm-stub.c >> +++ b/kvm-stub.c >> @@ -17,6 +17,7 @@ >> #include "gdbstub.h" >> #include "kvm.h" >> =20 >> +bool kvm_configured; >> KVMState *kvm_state; >> bool kvm_kernel_irqchip; >> bool kvm_async_interrupts_allowed; >> diff --git a/kvm.h b/kvm.h >> index dea2998..9936e5f 100644 >> --- a/kvm.h >> +++ b/kvm.h >> @@ -22,6 +22,7 @@ >> #include >> #endif >> =20 >> +extern bool kvm_configured; >> extern int kvm_allowed; >> extern bool kvm_kernel_irqchip; >> extern bool kvm_async_interrupts_allowed; >> diff --git a/vl.c b/vl.c >> index 8d305ca..f557bd1 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -2215,8 +2215,8 @@ static int configure_accelerator(void) >> } >> =20 >> if (p =3D=3D NULL) { >> - /* Use the default "accelerator", tcg */ >> - p =3D "tcg"; >> + /* The default accelerator depends on the availability of KVM= =2E */ >> + p =3D kvm_configured ? "kvm" : "tcg"; >> } >=20 > How about making this an arch_init() function call and then using a #if= > defined(KVM_CONFIG) in arch_init.c? >=20 > I hate to introduce another global variable if we can avoid it... Hacked too quickly. In fact, kvm_configured is simply kvm_available(). However, resistance appear to be too high here. Jan >=20 > Otherwise: >=20 > Acked-by: Anthony Liguori >=20 > Blue/Aurelien, any objections? >=20 > Regards, >=20 > Anthony Liguori >=20 >> =20 >> while (!accel_initialised && *p !=3D '\0') { >> --=20 >> 1.7.3.4 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >=20 --------------enig17662E811A11E3803673425A 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.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBr/w0ACgkQitSsb3rl5xSQwwCfbYatcepWBdiKyc7bBVigobY4 FKkAoKvwDJyREYaTUYyQ6NTpaJUytPBQ =UDQt -----END PGP SIGNATURE----- --------------enig17662E811A11E3803673425A--