All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Hyman Huang" <yong.huang@smartx.com>,
	"Phil Dennis-Jordan" <phil@philjordan.eu>,
	"Peter Xu" <peterx@redhat.com>,
	"Akihiko Odaki" <akihiko.odaki@daynix.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH 4/7] tests/qtest/migration: Pass accelerator arguments as machine option
Date: Tue, 28 Jan 2025 11:59:57 -0300	[thread overview]
Message-ID: <87o6zrt24y.fsf@suse.de> (raw)
In-Reply-To: <20250128135429.8500-5-philmd@linaro.org>

Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> The '-accel' CLI option is handler as sugar property as
> '-machine,accel='. Replace the migration tests command
> line, only using the best accelerator available (first
> hardware, then software).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  tests/qtest/migration/framework.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
> index 38a0a1a5264..e567296b014 100644
> --- a/tests/qtest/migration/framework.c
> +++ b/tests/qtest/migration/framework.c
> @@ -214,8 +214,9 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
>      const gchar *ignore_stderr;
>      g_autofree char *shmem_opts = NULL;
>      g_autofree char *shmem_path = NULL;
> -    const char *kvm_opts = NULL;
> -    const char *arch = qtest_get_arch();
> +    const char *accel_args = NULL;
> +    const MigrationTestEnv *env = migration_get_env();
> +    const char *arch = env->arch;
>      const char *memory_size;
>      const char *machine_alias, *machine_opts = "";
>      g_autofree char *machine = NULL;
> @@ -296,8 +297,15 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
>              memory_size, shmem_path);
>      }
>  
> -    if (args->use_dirty_ring) {
> -        kvm_opts = ",dirty-ring-size=4096";
> +    if (env->has_kvm) {
> +        if (args->use_dirty_ring) {
> +            accel_args = "kvm,dirty-ring-size=4096";
> +        } else {
> +            accel_args = "kvm";
> +        }
> +    } else {
> +        assert(env->has_tcg);
> +        accel_args = "tcg";
>      }

I don't think this approach works when testing across
architectures. IIUC has_kvm will be true whenever the *test* can access
/dev/kvm. Which means if we run on a x86 while testing
qemu-system-s390x, then has_kvm==true but we actually need to use TCG,
so the fallback in the QEMU binary (-accel kvm -accel tcg) will be
automatically used.

>  
>      if (!qtest_has_machine(machine_alias)) {
> @@ -311,14 +319,12 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
>  
>      g_test_message("Using machine type: %s", machine);
>  
> -    cmd_source = g_strdup_printf("-accel kvm%s -accel tcg "
> -                                 "-machine %s,%s "
> +    cmd_source = g_strdup_printf("-machine %s,%s,accel=%s "
>                                   "-name source,debug-threads=on "
>                                   "-m %s "
>                                   "-serial file:%s/src_serial "
>                                   "%s %s %s %s",
> -                                 kvm_opts ? kvm_opts : "",
> -                                 machine, machine_opts,
> +                                 machine, machine_opts, accel_args,
>                                   memory_size, tmpfs,
>                                   arch_opts ? arch_opts : "",
>                                   shmem_opts ? shmem_opts : "",
> @@ -332,15 +338,13 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
>                                       &src_state);
>      }
>  
> -    cmd_target = g_strdup_printf("-accel kvm%s -accel tcg "
> -                                 "-machine %s,%s "
> +    cmd_target = g_strdup_printf("-machine %s,%s,accel=%s "
>                                   "-name target,debug-threads=on "
>                                   "-m %s "
>                                   "-serial file:%s/dest_serial "
>                                   "-incoming %s "
>                                   "%s %s %s %s",
> -                                 kvm_opts ? kvm_opts : "",
> -                                 machine, machine_opts,
> +                                 machine, machine_opts, accel_args,
>                                   memory_size, tmpfs, uri,
>                                   arch_opts ? arch_opts : "",
>                                   shmem_opts ? shmem_opts : "",


  reply	other threads:[~2025-01-28 15:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 13:54 [PATCH 0/7] tests/qtest/migration: Update framework to allow using HVF accelerator Philippe Mathieu-Daudé
2025-01-28 13:54 ` [PATCH 1/7] migration/dirtyrate: Do not unlock cpu_list lock twice Philippe Mathieu-Daudé
2025-01-28 14:27   ` Fabiano Rosas
2025-01-28 19:16   ` Richard Henderson
2025-01-28 13:54 ` [PATCH 2/7] tests/qtest/migration: Make 'has_dirty_ring' generic Philippe Mathieu-Daudé
2025-01-28 14:29   ` Fabiano Rosas
2025-01-28 13:54 ` [PATCH 3/7] tests/qtest/migration: Initialize MigrationTestEnv::arch early Philippe Mathieu-Daudé
2025-01-28 14:43   ` Fabiano Rosas
2025-01-28 19:20   ` Richard Henderson
2025-01-28 13:54 ` [PATCH 4/7] tests/qtest/migration: Pass accelerator arguments as machine option Philippe Mathieu-Daudé
2025-01-28 14:59   ` Fabiano Rosas [this message]
2025-01-28 19:24   ` Richard Henderson
2025-01-28 13:54 ` [PATCH 5/7] tests/qtest/migration: Add MigrationTestEnv::has_hvf field Philippe Mathieu-Daudé
2025-01-28 15:00   ` Fabiano Rosas
2025-01-28 19:25   ` Richard Henderson
2025-01-28 13:54 ` [RFC PATCH 6/7] tests/qtest/migration: Run aarch64/HVF tests using GICv2 Philippe Mathieu-Daudé
2025-01-29  5:39   ` Akihiko Odaki
2025-02-09 19:02   ` Phil Dennis-Jordan
2025-01-28 13:54 ` [PATCH 7/7] tests/qtest/migration: Allow using accelerators different of TCG / KVM Philippe Mathieu-Daudé
2025-01-28 15:04   ` Fabiano Rosas
2025-01-28 19:29     ` Richard Henderson
2025-01-28 19:50       ` Fabiano Rosas
2025-01-28 21:08         ` Richard Henderson
2025-01-28 19:26   ` Richard Henderson
2025-01-28 13:55 ` [PATCH 0/7] tests/qtest/migration: Update framework to allow using HVF accelerator Philippe Mathieu-Daudé
2026-01-14 16:21 ` Philippe Mathieu-Daudé

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=87o6zrt24y.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=akihiko.odaki@daynix.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=phil@philjordan.eu \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=yong.huang@smartx.com \
    /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.