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

Paolo Bonzini posted 87 patches 5 years, 12 months ago
Maintainers: Richard Henderson <rth@twiddle.net>, Thomas Huth <thuth@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Sergio Lopez <slp@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Gerd Hoffmann <kraxel@redhat.com>, John Snow <jsnow@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Cornelia Huck <cohuck@redhat.com>, Christian Borntraeger <borntraeger@de.ibm.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Helge Deller <deller@gmx.de>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Anthony Perard <anthony.perard@citrix.com>, Halil Pasic <pasic@linux.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Juan Quintela <quintela@redhat.com>, Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, David Gibson <david@gibson.dropbear.id.au>, Paul Durrant <paul@xen.org>, "Cédric Le Goater" <clg@kaod.org>, David Hildenbrand <david@redhat.com>, Claudio Fontana <claudio.fontana@huawei.com>, James Hogan <jhogan@kernel.org>, Ben Warren <ben@skyportsystems.com>, Fam Zheng <fam@euphon.net>, Laurent Vivier <lvivier@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Jason Wang <jasowang@redhat.com>
[PULL 20/87] vl: warn for unavailable accelerators, clarify messages
Posted by Paolo Bonzini 5 years, 12 months ago
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(-)

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())) {
-- 
1.8.3.1



Re: [PULL 20/87] vl: warn for unavailable accelerators, clarify messages
Posted by Laurent Vivier 5 years, 11 months ago
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())) {
> 


Re: [PULL 20/87] vl: warn for unavailable accelerators, clarify messages
Posted by Paolo Bonzini 5 years, 11 months ago
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