qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: kvm <kvm@vger.kernel.org>, "Scott Moser" <smoser@ubuntu.com>,
	"Jan Kiszka" <jan.kiszka@siemens.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Blue Swirl" <blauwirbel@gmail.com>,
	"Avi Kivity" <avi@redhat.com>,
	"Cole Robinson" <crobinso@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH] kvm: Set default accelerator to "kvm" if the host supports it
Date: Mon, 1 Oct 2012 18:56:16 +0200	[thread overview]
Message-ID: <20121001165616.GA4055@ohm.aurel32.net> (raw)
In-Reply-To: <87wqza2mg6.fsf@codemonkey.ws>

On Mon, Oct 01, 2012 at 11:20:41AM -0500, Anthony Liguori wrote:
> Jan Kiszka <jan.kiszka@siemens.com> 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 <jan.kiszka@siemens.com>
> > ---
> >  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 <linux/kvm.h>
> >  #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 <aliguori@us.ibm.com>
> 
> Blue/Aurelien, any objections?
> 

I am not sure this way of doing is really distribution friendly, where
the QEMU package is built for a large variety of hosts, some of them
maybe without KVM support.

I am all for enabling KVM by default, but I think it should fall back to
TCG if it is not enabled (probably with a warning so that the user is
aware of that). On the other hand, if the user explicitly enables KVM
support with -enable-kvm or with accel=kvm, it should fail to start. In 
other words, a bit like the configure script options, by default we 
use auto-detection, but if an option is explicitly enabled, it fails if
it can't be enabled.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2012-10-01 16:56 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120930191146.GA20012@amt.cnet>
     [not found] ` <50694EC1.8060006@siemens.com>
     [not found]   ` <20121001093102.GA14797@amt.cnet>
     [not found]     ` <50696E9E.7030302@siemens.com>
2012-10-01 13:19       ` [Qemu-devel] qemu-kvm: remove "boot=on|off" drive parameter compatibility Anthony Liguori
2012-10-01 13:26         ` Jan Kiszka
2012-10-03  9:55           ` Gleb Natapov
2012-10-03 10:06             ` Jan Kiszka
2012-10-03 10:11               ` Gleb Natapov
2012-10-03 10:57             ` Lucas Meneghel Rodrigues
2012-10-03 13:19               ` Paolo Bonzini
2012-10-03 13:27                 ` Gleb Natapov
2012-10-04 10:48                 ` Jan Kiszka
2012-10-04 12:10                   ` Lucas Meneghel Rodrigues
2012-10-04 12:27                     ` Jan Kiszka
2012-10-04 17:21                       ` Lucas Meneghel Rodrigues
2012-10-04 17:24                         ` Jan Kiszka
2012-10-01 13:31         ` Marcelo Tosatti
2012-10-01 13:36           ` Jan Kiszka
2012-10-01 13:44             ` Michael Tokarev
2012-10-01 13:48               ` Jan Kiszka
2012-10-01 13:38         ` Paolo Bonzini
2012-10-01 13:46           ` Jan Kiszka
2012-10-01 14:04           ` Anthony Liguori
2012-10-01 14:34             ` [Qemu-devel] [PATCH] kvm: Set default accelerator to "kvm" if the host supports it Jan Kiszka
2012-10-01 16:20               ` Anthony Liguori
2012-10-01 16:56                 ` Aurelien Jarno [this message]
2012-10-03  9:02                 ` Jan Kiszka
2012-10-03 20:01                 ` Blue Swirl
2012-10-03 20:26                   ` Peter Maydell
2012-10-05  1:15                     ` Alexander Graf
2012-10-05  2:17                       ` Anthony Liguori
2012-10-05  2:24                         ` Alexander Graf
2012-10-05  8:15                           ` Peter Maydell
2012-10-08 14:03                           ` Andreas Färber
2012-10-08 14:08                             ` Alexander Graf
2012-10-01 16:43               ` Andreas Färber
2012-10-01 16:47                 ` Daniel P. Berrange
2012-10-01 19:03                   ` Anthony Liguori
2012-10-01 19:25                     ` Paolo Bonzini
2012-10-01 20:07                       ` Anthony Liguori
2012-10-02  7:46                   ` Markus Armbruster
2012-10-02  8:15                     ` Aurelien Jarno
2012-10-03  6:58                     ` Michael Tokarev
2012-10-03  9:05                       ` Jan Kiszka
2012-10-01 14:07         ` [Qemu-devel] qemu-kvm: remove "boot=on|off" drive parameter compatibility Alexander Graf
2012-10-01 14:20           ` Paolo Bonzini
2012-10-01 15:39         ` Bruce Rogers
2012-10-02  8:14         ` Daniel P. Berrange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121001165616.GA4055@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=crobinso@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=smoser@ubuntu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).