All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com
Subject: Re: [PATCH 4/4] vl: Only choose enabled accelerators in configure_accelerators
Date: Thu, 09 Jan 2020 11:35:35 +0000	[thread overview]
Message-ID: <87r208j20o.fsf@linaro.org> (raw)
In-Reply-To: <20200109021710.1219-5-richard.henderson@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> By choosing "tcg:kvm" when kvm is not enabled, we generate
> an incorrect warning: "invalid accelerator kvm".
>
> Presumably the inverse is also true with --disable-tcg.
>
> Fixes: 28a0961757fc
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  vl.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 887dbfbb5d..9b7651c80d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2759,11 +2759,10 @@ static void configure_accelerators(const char *progname)
>  
>          if (accel == NULL) {
>              /* Select the default accelerator */
> -            if (!accel_find("tcg") && !accel_find("kvm")) {
> -                error_report("No accelerator selected and"
> -                             " no default accelerator available");
> -                exit(1);
> -            } else {
> +            bool have_tcg = accel_find("tcg");
> +            bool have_kvm = accel_find("kvm");
> +
> +            if (have_tcg && have_kvm) {
>                  int pnlen = strlen(progname);
>                  if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3],
>          "kvm")) {

I know you're not touching this bit but:

modified   vl.c
@@ -2763,8 +2763,7 @@ static void configure_accelerators(const char *progname)
             bool have_kvm = accel_find("kvm");
 
             if (have_tcg && have_kvm) {
-                int pnlen = strlen(progname);
-                if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
+                if (g_str_has_suffix(progname, "kvm")) {
                     /* If the program name ends with "kvm", we prefer KVM */
                     accel = "kvm:tcg";
                 } else {


>                      /* If the program name ends with "kvm", we prefer KVM */
> @@ -2771,9 +2770,16 @@ static void configure_accelerators(const char *progname)
>                  } else {
>                      accel = "tcg:kvm";
>                  }
> +            } else if (have_kvm) {
> +                accel = "kvm";
> +            } else if (have_tcg) {
> +                accel = "tcg";
> +            } else {
> +                error_report("No accelerator selected and"
> +                             " no default accelerator available");
> +                exit(1);
>              }
>          }
> -
>          accel_list = g_strsplit(accel, ":", 0);
>  
>          for (tmp = accel_list; *tmp; tmp++) {

Anyway:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


  reply	other threads:[~2020-01-09 11:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09  2:17 [PATCH 0/4] vl: Fixes for cleanups to -accel Richard Henderson
2020-01-09  2:17 ` [PATCH 1/4] vl: Remove unused variable in configure_accelerators Richard Henderson
2020-01-09 11:01   ` Alex Bennée
2020-01-09 12:06   ` Aleksandar Markovic
2020-01-09 12:23   ` Philippe Mathieu-Daudé
2020-01-09  2:17 ` [PATCH 2/4] vl: Free accel_list " Richard Henderson
2020-01-09  8:18   ` Thomas Huth
2020-01-09  8:24     ` Laurent Vivier
2020-01-09 11:59       ` Aleksandar Markovic
2020-01-09 11:04   ` Alex Bennée
2020-01-09  2:17 ` [PATCH 3/4] vl: Remove useless test " Richard Henderson
2020-01-09 11:05   ` Alex Bennée
2020-01-09 12:07   ` Aleksandar Markovic
2020-01-09 12:24   ` Philippe Mathieu-Daudé
2020-01-09  2:17 ` [PATCH 4/4] vl: Only choose enabled accelerators " Richard Henderson
2020-01-09 11:35   ` Alex Bennée [this message]
2020-01-09 12:10     ` Aleksandar Markovic
2020-01-09  9:00 ` [PATCH 0/4] vl: Fixes for cleanups to -accel Paolo Bonzini

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=87r208j20o.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.