All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] -accel should list enabled accelerators
@ 2019-05-30 21:57 Wainer dos Santos Moschetta
  2019-05-30 21:57 ` [Qemu-devel] [PATCH 1/1] vl: make -accel help to list enabled accelerators only Wainer dos Santos Moschetta
  0 siblings, 1 reply; 3+ messages in thread
From: Wainer dos Santos Moschetta @ 2019-05-30 21:57 UTC (permalink / raw
  To: qemu-devel; +Cc: pbonzini, philmd, ehabkost, crosa

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1602 bytes --]

On this series I changed the semantics of -accel help so that
it shows only the accelerators enabled in the QEMU target
binary. This behavior is now alike -cpu and -machine helps.

Another reason for this proposal is that I am working on
an improvement of Avocado QEMU framework which should skip
tests tagged with, e.g, "accel:tcg" if tcg is not enabled
in the binary. And it seems the best approach to detect
the presence (or not) of an accelerator is to query QEMU
with -accel help.

Phillipe Mathieu-Daudé proposed a similar fix [1] but it
was never merged. My patch is slightly different but it
implements some decisions that seemed consensus at that time:

1. Do not display qtest. It's an internal only accelerator.
2. It should display those that have support on the target
binary, regardless if they are not present on the host.

Example with this patch on x86_64 host (kvm not installed):
---
$ configure --enable-kvm --enable-xen --target-list="x86_64-softmmu ppc64-softmmu"
$ x86_64-softmmu/qemu-system-x86_64 -accel help
Accelerators supported in QEMU binary:
tcg
xen
kvm
$ ppc64-softmmu/qemu-system-ppc64 -accel help
Accelerators supported in QEMU binary:
tcg
---

Git: https://github.com/wainersm/qemu
Branch: accel_list
Travis: https://travis-ci.org/wainersm/qemu/builds/539366851

[1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg491542.html

Wainer dos Santos Moschetta (1):
  vl: make -accel help to list enabled accelerators only

 vl.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

-- 
2.21.0



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

* [Qemu-devel] [PATCH 1/1] vl: make -accel help to list enabled accelerators only
  2019-05-30 21:57 [Qemu-devel] [PATCH 0/1] -accel should list enabled accelerators Wainer dos Santos Moschetta
@ 2019-05-30 21:57 ` Wainer dos Santos Moschetta
  2019-05-31  9:38   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Wainer dos Santos Moschetta @ 2019-05-30 21:57 UTC (permalink / raw
  To: qemu-devel; +Cc: pbonzini, philmd, ehabkost, crosa

Currently, -accel help shows all possible accelerators regardless
if they are enabled in the binary or not. That is a different
semantic from -cpu and -machine helps, for example. So this change
makes it to list only the accelerators which support is compiled
in the binary target.

Note that it does not check if the accelerator is enabled in the
host, so the help message's header was rewritten to emphasize
that. Also qtest is not displayed given that it is used for
internal testing purpose only.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 vl.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index 2e69c9fef2..e5d40c01f8 100644
--- a/vl.c
+++ b/vl.c
@@ -3575,7 +3575,23 @@ int main(int argc, char **argv, char **envp)
                                                      optarg, true);
                 optarg = qemu_opt_get(accel_opts, "accel");
                 if (!optarg || is_help_option(optarg)) {
-                    printf("Possible accelerators: kvm, xen, hax, tcg\n");
+                    printf("Accelerators supported in QEMU binary:\n");
+                    GSList *el, *accel_list = object_class_get_list(TYPE_ACCEL,
+                                                                    false);
+                    for (el = accel_list; el; el = el->next) {
+                        gchar *typename = g_strdup(object_class_get_name(
+                                                   OBJECT_CLASS(el->data)));
+                        /* omit qtest which is used for tests only */
+                        if (g_strcmp0(typename, ACCEL_CLASS_NAME("qtest")) &&
+                            g_str_has_suffix(typename, ACCEL_CLASS_SUFFIX)) {
+                            gchar **optname = g_strsplit(typename,
+                                                         ACCEL_CLASS_SUFFIX, 0);
+                            printf("%s\n", optname[0]);
+                            g_free(optname);
+                        }
+                        g_free(typename);
+                    }
+                    g_slist_free(accel_list);
                     exit(0);
                 }
                 opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
-- 
2.21.0



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

* Re: [Qemu-devel] [PATCH 1/1] vl: make -accel help to list enabled accelerators only
  2019-05-30 21:57 ` [Qemu-devel] [PATCH 1/1] vl: make -accel help to list enabled accelerators only Wainer dos Santos Moschetta
@ 2019-05-31  9:38   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-05-31  9:38 UTC (permalink / raw
  To: Wainer dos Santos Moschetta, qemu-devel; +Cc: philmd, ehabkost, crosa

On 30/05/19 23:57, Wainer dos Santos Moschetta wrote:
> Currently, -accel help shows all possible accelerators regardless
> if they are enabled in the binary or not. That is a different
> semantic from -cpu and -machine helps, for example. So this change
> makes it to list only the accelerators which support is compiled
> in the binary target.
> 
> Note that it does not check if the accelerator is enabled in the
> host, so the help message's header was rewritten to emphasize
> that. Also qtest is not displayed given that it is used for
> internal testing purpose only.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
>  vl.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index 2e69c9fef2..e5d40c01f8 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3575,7 +3575,23 @@ int main(int argc, char **argv, char **envp)
>                                                       optarg, true);
>                  optarg = qemu_opt_get(accel_opts, "accel");
>                  if (!optarg || is_help_option(optarg)) {
> -                    printf("Possible accelerators: kvm, xen, hax, tcg\n");
> +                    printf("Accelerators supported in QEMU binary:\n");
> +                    GSList *el, *accel_list = object_class_get_list(TYPE_ACCEL,
> +                                                                    false);
> +                    for (el = accel_list; el; el = el->next) {
> +                        gchar *typename = g_strdup(object_class_get_name(
> +                                                   OBJECT_CLASS(el->data)));
> +                        /* omit qtest which is used for tests only */
> +                        if (g_strcmp0(typename, ACCEL_CLASS_NAME("qtest")) &&
> +                            g_str_has_suffix(typename, ACCEL_CLASS_SUFFIX)) {
> +                            gchar **optname = g_strsplit(typename,
> +                                                         ACCEL_CLASS_SUFFIX, 0);
> +                            printf("%s\n", optname[0]);
> +                            g_free(optname);
> +                        }
> +                        g_free(typename);
> +                    }
> +                    g_slist_free(accel_list);
>                      exit(0);
>                  }
>                  opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
> 

Queued, thanks!

Paolo


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

end of thread, other threads:[~2019-05-31  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-30 21:57 [Qemu-devel] [PATCH 0/1] -accel should list enabled accelerators Wainer dos Santos Moschetta
2019-05-30 21:57 ` [Qemu-devel] [PATCH 1/1] vl: make -accel help to list enabled accelerators only Wainer dos Santos Moschetta
2019-05-31  9:38   ` Paolo Bonzini

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.