qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] softmmu/vl: Be less verbose about missing KVM when running the qtests
@ 2020-07-10  8:50 Thomas Huth
  2020-07-10 13:23 ` Alexander Bulekov
  2020-07-27 11:27 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2020-07-10  8:50 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini

Some of the qtests use "-accel kvm -accel tcg" to run real guest code.
This causes some error messages when kvm is not available. We do not
really care about these messages since the fallback to tcg is expected
here. So let's silence them to avoid that they spoil the output of
the tests.

Unfortunately, we can not use the qtest_enabled() wrapper in this case,
since the qtest accelerator itself is not initialized. Thus we have to
test for the qtest_chrdev variable instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 softmmu/vl.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 3f58ffd4dc..0066f50fb2 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -164,8 +164,9 @@ bool boot_strict;
 uint8_t *boot_splash_filedata;
 int only_migratable; /* turn it off unless user states otherwise */
 bool wakeup_suspend_enabled;
-
 int icount_align_option;
+static const char *qtest_chrdev;
+static const char *qtest_log;
 
 /* The bytes in qemu_uuid are in the order specified by RFC4122, _not_ in the
  * little-endian "wire format" described in the SMBIOS 2.6 specification.
@@ -2693,10 +2694,15 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
     AccelClass *ac = accel_find(acc);
     AccelState *accel;
     int ret;
+    bool qtest_with_kvm;
+
+    qtest_with_kvm = g_str_equal(acc, "kvm") && qtest_chrdev != NULL;
 
     if (!ac) {
         *p_init_failed = true;
-        error_report("invalid accelerator %s", acc);
+        if (!qtest_with_kvm) {
+            error_report("invalid accelerator %s", acc);
+        }
         return 0;
     }
     accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
@@ -2708,8 +2714,9 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
     ret = accel_init_machine(accel, current_machine);
     if (ret < 0) {
         *p_init_failed = true;
-        error_report("failed to initialize %s: %s",
-                     acc, strerror(-ret));
+        if (!qtest_with_kvm || ret != -ENOENT) {
+            error_report("failed to initialize %s: %s", acc, strerror(-ret));
+        }
         return 0;
     }
 
@@ -2780,7 +2787,7 @@ static void configure_accelerators(const char *progname)
         exit(1);
     }
 
-    if (init_failed) {
+    if (init_failed && !qtest_chrdev) {
         AccelClass *ac = ACCEL_GET_CLASS(current_accel());
         error_report("falling back to %s", ac->name);
     }
@@ -2830,8 +2837,6 @@ void qemu_init(int argc, char **argv, char **envp)
     MachineClass *machine_class;
     const char *cpu_option;
     const char *vga_model = NULL;
-    const char *qtest_chrdev = NULL;
-    const char *qtest_log = NULL;
     const char *incoming = NULL;
     bool userconfig = true;
     bool nographic = false;
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] softmmu/vl: Be less verbose about missing KVM when running the qtests
  2020-07-10  8:50 [PATCH] softmmu/vl: Be less verbose about missing KVM when running the qtests Thomas Huth
@ 2020-07-10 13:23 ` Alexander Bulekov
  2020-07-27 11:27 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Bulekov @ 2020-07-10 13:23 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Paolo Bonzini, qemu-devel

On 200710 1050, Thomas Huth wrote:
> Some of the qtests use "-accel kvm -accel tcg" to run real guest code.
> This causes some error messages when kvm is not available. We do not
> really care about these messages since the fallback to tcg is expected
> here. So let's silence them to avoid that they spoil the output of
> the tests.
> 
> Unfortunately, we can not use the qtest_enabled() wrapper in this case,
> since the qtest accelerator itself is not initialized. Thus we have to
> test for the qtest_chrdev variable instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Alexander Bulekov <alxndr@bu.edu>

> ---
>  softmmu/vl.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 3f58ffd4dc..0066f50fb2 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -164,8 +164,9 @@ bool boot_strict;
>  uint8_t *boot_splash_filedata;
>  int only_migratable; /* turn it off unless user states otherwise */
>  bool wakeup_suspend_enabled;
> -
>  int icount_align_option;
> +static const char *qtest_chrdev;
> +static const char *qtest_log;
>  
>  /* The bytes in qemu_uuid are in the order specified by RFC4122, _not_ in the
>   * little-endian "wire format" described in the SMBIOS 2.6 specification.
> @@ -2693,10 +2694,15 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
>      AccelClass *ac = accel_find(acc);
>      AccelState *accel;
>      int ret;
> +    bool qtest_with_kvm;
> +
> +    qtest_with_kvm = g_str_equal(acc, "kvm") && qtest_chrdev != NULL;
>  
>      if (!ac) {
>          *p_init_failed = true;
> -        error_report("invalid accelerator %s", acc);
> +        if (!qtest_with_kvm) {
> +            error_report("invalid accelerator %s", acc);
> +        }
>          return 0;
>      }
>      accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
> @@ -2708,8 +2714,9 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
>      ret = accel_init_machine(accel, current_machine);
>      if (ret < 0) {
>          *p_init_failed = true;
> -        error_report("failed to initialize %s: %s",
> -                     acc, strerror(-ret));
> +        if (!qtest_with_kvm || ret != -ENOENT) {
> +            error_report("failed to initialize %s: %s", acc, strerror(-ret));
> +        }
>          return 0;
>      }
>  
> @@ -2780,7 +2787,7 @@ static void configure_accelerators(const char *progname)
>          exit(1);
>      }
>  
> -    if (init_failed) {
> +    if (init_failed && !qtest_chrdev) {
>          AccelClass *ac = ACCEL_GET_CLASS(current_accel());
>          error_report("falling back to %s", ac->name);
>      }
> @@ -2830,8 +2837,6 @@ void qemu_init(int argc, char **argv, char **envp)
>      MachineClass *machine_class;
>      const char *cpu_option;
>      const char *vga_model = NULL;
> -    const char *qtest_chrdev = NULL;
> -    const char *qtest_log = NULL;
>      const char *incoming = NULL;
>      bool userconfig = true;
>      bool nographic = false;
> -- 
> 2.18.1
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] softmmu/vl: Be less verbose about missing KVM when running the qtests
  2020-07-10  8:50 [PATCH] softmmu/vl: Be less verbose about missing KVM when running the qtests Thomas Huth
  2020-07-10 13:23 ` Alexander Bulekov
@ 2020-07-27 11:27 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-07-27 11:27 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel

On 10/07/20 10:50, Thomas Huth wrote:
> Some of the qtests use "-accel kvm -accel tcg" to run real guest code.
> This causes some error messages when kvm is not available. We do not
> really care about these messages since the fallback to tcg is expected
> here. So let's silence them to avoid that they spoil the output of
> the tests.
> 
> Unfortunately, we can not use the qtest_enabled() wrapper in this case,
> since the qtest accelerator itself is not initialized. Thus we have to
> test for the qtest_chrdev variable instead.

I wonder if "-accel kvm -accel tcg" should warn at all.  I can
understand warning if we're running some /usr/bin/qemu-kvm binary, but
in this case the user has explicitly asked for a fallback.

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-27 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  8:50 [PATCH] softmmu/vl: Be less verbose about missing KVM when running the qtests Thomas Huth
2020-07-10 13:23 ` Alexander Bulekov
2020-07-27 11:27 ` Paolo Bonzini

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).