diff mbox series

[PULL,20/87] vl: warn for unavailable accelerators, clarify messages

Message ID 1576670573-48048-21-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/87] kvm: Reallocate dirty_bmap when we change a slot | expand

Commit Message

Paolo Bonzini Dec. 18, 2019, 12:01 p.m. UTC
So far, specifying an accelerator that was not compiled in did not result
in an error; fix that.

While at it, clarify the mysterious "Back to TCG" message.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 vl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Laurent Vivier Jan. 16, 2020, 2:50 p.m. UTC | #1
On 18/12/2019 13:01, Paolo Bonzini wrote:
> So far, specifying an accelerator that was not compiled in did not result
> in an error; fix that.
> 
> While at it, clarify the mysterious "Back to TCG" message.

Every time I run a non native VM I have this message:

$ uname -m
x86_64
$ ./ppc64-softmmu/qemu-system-ppc64
qemu-system-ppc64: invalid accelerator kvm
qemu-system-ppc64: falling back to tcg

Is that expected?

At least it's annoying... it was silently falling back to tcg before
that patch.

Should the default be set to tcg to avoid the fallback?

Thanks,
Laurent

> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  vl.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index 0f620be..c350eef 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2723,6 +2723,8 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
>      int ret;
>  
>      if (!ac) {
> +        *p_init_failed = true;
> +        error_report("invalid accelerator %s", acc);
>          return 0;
>      }
>      ret = accel_init_machine(ac, current_machine);
> @@ -2777,6 +2779,9 @@ static void configure_accelerators(const char *progname)
>               */
>              if (accel_find(*tmp)) {
>                  qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true);
> +            } else {
> +                init_failed = true;
> +                error_report("invalid accelerator %s", *tmp);
>              }
>          }
>      } else {
> @@ -2796,7 +2801,7 @@ static void configure_accelerators(const char *progname)
>  
>      if (init_failed) {
>          AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
> -        error_report("Back to %s accelerator", ac->name);
> +        error_report("falling back to %s", ac->name);
>      }
>  
>      if (use_icount && !(tcg_enabled() || qtest_enabled())) {
>
Paolo Bonzini Jan. 16, 2020, 3:10 p.m. UTC | #2
On 16/01/20 15:50, Laurent Vivier wrote:
> Every time I run a non native VM I have this message:
> 
> $ uname -m
> x86_64
> $ ./ppc64-softmmu/qemu-system-ppc64
> qemu-system-ppc64: invalid accelerator kvm
> qemu-system-ppc64: falling back to tcg
> 
> Is that expected?
> 
> At least it's annoying... it was silently falling back to tcg before
> that patch.
> 
> Should the default be set to tcg to avoid the fallback?

Richard has posted a patch to fix it, I expect him to include it in his
pull request.

Paolo
diff mbox series

Patch

diff --git a/vl.c b/vl.c
index 0f620be..c350eef 100644
--- a/vl.c
+++ b/vl.c
@@ -2723,6 +2723,8 @@  static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
     int ret;
 
     if (!ac) {
+        *p_init_failed = true;
+        error_report("invalid accelerator %s", acc);
         return 0;
     }
     ret = accel_init_machine(ac, current_machine);
@@ -2777,6 +2779,9 @@  static void configure_accelerators(const char *progname)
              */
             if (accel_find(*tmp)) {
                 qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true);
+            } else {
+                init_failed = true;
+                error_report("invalid accelerator %s", *tmp);
             }
         }
     } else {
@@ -2796,7 +2801,7 @@  static void configure_accelerators(const char *progname)
 
     if (init_failed) {
         AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
-        error_report("Back to %s accelerator", ac->name);
+        error_report("falling back to %s", ac->name);
     }
 
     if (use_icount && !(tcg_enabled() || qtest_enabled())) {