From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] kvm: Set default accelerator to "kvm" if the host supports it Date: Mon, 01 Oct 2012 11:20:41 -0500 Message-ID: <87wqza2mg6.fsf@codemonkey.ws> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , Marcelo Tosatti , kvm , qemu-devel , Cole Robinson , Scott Moser , Andreas =?utf-8?Q?F=C3=A4rber?= , Michael Tokarev , qemu-devel , Avi Kivity , Blue Swirl , Aurelien Jarno To: Jan Kiszka Return-path: Received: from mail-oa0-f46.google.com ([209.85.219.46]:48400 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753121Ab2JAQUp (ORCPT ); Mon, 1 Oct 2012 12:20:45 -0400 Received: by oagh16 with SMTP id h16so5224430oag.19 for ; Mon, 01 Oct 2012 09:20:45 -0700 (PDT) In-Reply-To: <5069A9DF.4040606@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: Jan Kiszka writes: > If we built a target for a host that supports KVM in principle, set the > 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 > }; > > +bool kvm_configured = 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" > > +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 > > +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) > } > > if (p == NULL) { > - /* Use the default "accelerator", tcg */ > - p = "tcg"; > + /* The default accelerator depends on the availability of KVM. */ > + p = kvm_configured ? "kvm" : "tcg"; > } How about making this an arch_init() function call and then using a #if defined(KVM_CONFIG) in arch_init.c? I hate to introduce another global variable if we can avoid it... Otherwise: Acked-by: Anthony Liguori Blue/Aurelien, any objections? Regards, Anthony Liguori > > while (!accel_initialised && *p != '\0') { > -- > 1.7.3.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIiji-00038S-7H for qemu-devel@nongnu.org; Mon, 01 Oct 2012 12:20:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIijd-0005lp-Tr for qemu-devel@nongnu.org; Mon, 01 Oct 2012 12:20:50 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:55891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIijd-0005lj-OO for qemu-devel@nongnu.org; Mon, 01 Oct 2012 12:20:45 -0400 Received: by obbwc18 with SMTP id wc18so2934032obb.4 for ; Mon, 01 Oct 2012 09:20:45 -0700 (PDT) From: Anthony Liguori In-Reply-To: <5069A9DF.4040606@siemens.com> 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> Date: Mon, 01 Oct 2012 11:20:41 -0500 Message-ID: <87wqza2mg6.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Jan Kiszka Cc: kvm , Scott Moser , Marcelo Tosatti , Michael Tokarev , qemu-devel , Blue Swirl , Avi Kivity , Cole Robinson , Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= , Aurelien Jarno Jan Kiszka writes: > If we built a target for a host that supports KVM in principle, set the > 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 > }; > > +bool kvm_configured = 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" > > +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 > > +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) > } > > if (p == NULL) { > - /* Use the default "accelerator", tcg */ > - p = "tcg"; > + /* The default accelerator depends on the availability of KVM. */ > + p = kvm_configured ? "kvm" : "tcg"; > } How about making this an arch_init() function call and then using a #if defined(KVM_CONFIG) in arch_init.c? I hate to introduce another global variable if we can avoid it... Otherwise: Acked-by: Anthony Liguori Blue/Aurelien, any objections? Regards, Anthony Liguori > > while (!accel_initialised && *p != '\0') { > -- > 1.7.3.4