From: Cornelia Huck <cohuck@redhat.com>
To: qemu-devel@nongnu.org
Cc: lvivier@redhat.com, pbonzini@redhat.com, thuth@redhat.com,
mreitz@redhat.com, kwolf@redhat.com
Subject: Re: [Qemu-devel] [PATCH RFC] accel: default to an actually available accelerator
Date: Wed, 6 Sep 2017 13:29:36 +0200 [thread overview]
Message-ID: <20170906132936.7cf49b24.cohuck@redhat.com> (raw)
In-Reply-To: <20170906094927.22376-1-cohuck@redhat.com>
On Wed, 6 Sep 2017 11:49:27 +0200
Cornelia Huck <cohuck@redhat.com> wrote:
> configure_accelerator() falls back to tcg if no accelerator has
> been specified. Formerly, we could be sure that tcg is always
> available; however, with --disable-tcg, this is not longer true,
> and you are not able to start qemu without explicitly specifying
> another accelerator on those builds.
>
> Instead, choose an accelerator in the order tcg->kvm->xen->hax.
>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
>
> RFC mainly because this breaks iotest 186 in a different way on a
> tcg-less x86_64 build: Before, it fails with "-machine accel=tcg: No
> accelerator found"; afterwards, there seems to be a difference in
> output due to different autogenerated devices. Not sure how to handle
> that.
>
> cc:ing some hopefully interested folks (-ENOMAINTAINER again).
>
> ---
> accel/accel.c | 22 ++++++++++++++++++++--
> arch_init.c | 17 +++++++++++++++++
> include/sysemu/arch_init.h | 2 ++
> qemu-options.hx | 6 ++++--
> 4 files changed, 43 insertions(+), 4 deletions(-)
>
> diff --git a/accel/accel.c b/accel/accel.c
> index 8ae40e1e13..26a3f32627 100644
> --- a/accel/accel.c
> +++ b/accel/accel.c
> @@ -68,6 +68,25 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)
> return ret;
> }
>
> +static const char *default_accelerator(void)
> +{
> + if (tcg_available()) {
> + return "tcg";
> + }
> + if (kvm_available()) {
> + return "kvm";
> + }
> + if (xen_available()) {
> + return "xen";
> + }
> + if (hax_available()) {
> + return "hax";
> + }
> + /* configure makes sure we have at least one accelerator */
> + g_assert(false);
> + return "";
> +}
> +
> void configure_accelerator(MachineState *ms)
> {
> const char *accel, *p;
> @@ -79,8 +98,7 @@ void configure_accelerator(MachineState *ms)
>
> accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
> if (accel == NULL) {
> - /* Use the default "accelerator", tcg */
> - accel = "tcg";
> + accel = default_accelerator();
It actually may be easier to just switch the default to
"tcg:kvm:xen:hax". Haven't tested that, though.
> }
>
> p = accel;
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 9f6e2adfff..386e6e945d 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -66,7 +66,8 @@ Supported machine properties are:
> @table @option
> @item accel=@var{accels1}[:@var{accels2}[:...]]
> This is used to enable an accelerator. Depending on the target architecture,
> -kvm, xen, hax or tcg can be available. By default, tcg is used. If there is
> +kvm, xen, hax or tcg can be available. By default, the first one available
> +out of tcg, kvm, xen, hax (in that order) is used. If there is
> more than one accelerator specified, the next one is used if the previous one
> fails to initialize.
> @item kernel_irqchip=on|off
> @@ -126,7 +127,8 @@ STEXI
> @item -accel @var{name}[,prop=@var{value}[,...]]
> @findex -accel
> This is used to enable an accelerator. Depending on the target architecture,
> -kvm, xen, hax or tcg can be available. By default, tcg is used. If there is
> +kvm, xen, hax or tcg can be available. By default, the first one available
> +out of tcg, kvm, xen, hax (in that order) is used. If there is
> more than one accelerator specified, the next one is used if the previous one
> fails to initialize.
> @table @option
These changes would still apply, as would the question about what to do
with the iotest.
next prev parent reply other threads:[~2017-09-06 11:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 9:49 [Qemu-devel] [PATCH RFC] accel: default to an actually available accelerator Cornelia Huck
2017-09-06 11:29 ` Cornelia Huck [this message]
2017-09-06 14:35 ` Peter Maydell
2017-09-06 15:54 ` Cornelia Huck
2017-09-11 11:48 ` Paolo Bonzini
2017-09-11 11:51 ` Cornelia Huck
2017-09-11 11:53 ` Paolo Bonzini
2017-09-07 8:11 ` Kevin Wolf
2017-09-07 8:14 ` Thomas Huth
2017-09-07 8:25 ` Cornelia Huck
2017-09-07 8:45 ` Kevin Wolf
2017-09-11 11:51 ` Paolo Bonzini
2017-09-22 18:15 ` Eduardo Habkost
2017-09-06 14:04 ` Richard Henderson
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=20170906132936.7cf49b24.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@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 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).