From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] accel: Improve selection of the default accelerator
Date: Fri, 5 Oct 2018 16:30:12 +0200 [thread overview]
Message-ID: <20181005163012.01bb7e73.cohuck@redhat.com> (raw)
In-Reply-To: <1538748792-19444-1-git-send-email-thuth@redhat.com>
On Fri, 5 Oct 2018 16:13:12 +0200
Thomas Huth <thuth@redhat.com> wrote:
> When compiling with "--disable-tcg", we currently still use "tcg"
> as default accelerator. "kvm" should be used in this case instead.
> Also, some downstream distros provide QEMU binaries which have "kvm"
> in their names (e.g. "qemu-kvm" on RHEL or "kvm" on Ubuntu) that use
> KVM by default - and some users might want to do something similar
> with upstream binaries, too. Accomodate them by using "kvm:tcg" as
> default when we detect such a binary name.
Heh, we haven't had that discussion for some time ;)
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> accel/accel.c | 18 +++++++++++++++---
> include/sysemu/accel.h | 2 +-
> vl.c | 2 +-
> 3 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/accel/accel.c b/accel/accel.c
> index 966b2d8..9be195c 100644
> --- a/accel/accel.c
> +++ b/accel/accel.c
> @@ -68,7 +68,7 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)
> return ret;
> }
>
> -void configure_accelerator(MachineState *ms)
> +void configure_accelerator(MachineState *ms, const char *progname)
> {
> const char *accel;
> char **accel_list, **tmp;
> @@ -79,8 +79,20 @@ void configure_accelerator(MachineState *ms)
>
> accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
> if (accel == NULL) {
> - /* Use the default "accelerator", tcg */
> - accel = "tcg";
> + /* Select the default accelerator */
> + int pnlen = strlen(progname);
> + if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
> + /* If the program name ends with "kvm", we prefer KVM */
> + accel = "kvm:tcg";
Ends, or also starts?
(In general, that approach probably makes more sense than the current
default.)
> + } else {
> +#if defined(CONFIG_TCG)
> + accel = "tcg";
> +#elif defined(CONFIG_KVM)
> + accel = "kvm";
> +#else
> +#error "No default accelerator available"
So, we can't configure a qemu with neither tcg nor kvm, but for example
with hax or xen? (Is that possible today?)
> +#endif
> + }
> }
>
> accel_list = g_strsplit(accel, ":", 0);
ISTR that we had a suggestion last time that we should provide
qemu-kvm, qemu-tcg, etc. binaries...
next prev parent reply other threads:[~2018-10-05 14:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-05 14:13 [Qemu-devel] [PATCH] accel: Improve selection of the default accelerator Thomas Huth
2018-10-05 14:22 ` Peter Maydell
2018-10-05 21:12 ` Paolo Bonzini
2018-10-10 8:02 ` Thomas Huth
2018-10-09 9:05 ` Markus Armbruster
2018-10-09 13:14 ` Markus Armbruster
2018-10-09 13:23 ` Thomas Huth
2018-10-09 13:41 ` Daniel P. Berrangé
2018-10-09 13:43 ` Cornelia Huck
2018-10-09 13:58 ` Peter Maydell
2018-10-09 14:23 ` Daniel P. Berrangé
2018-10-09 14:34 ` Peter Maydell
2018-10-09 15:06 ` Cornelia Huck
2018-10-09 15:35 ` Paolo Bonzini
2018-10-05 14:30 ` Cornelia Huck [this message]
2018-10-05 14:40 ` Peter Maydell
2018-10-05 21:13 ` Paolo Bonzini
2018-10-05 14:39 ` Philippe Mathieu-Daudé
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=20181005163012.01bb7e73.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.