* [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled
@ 2023-01-19 10:05 Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 1/8] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
` (7 more replies)
0 siblings, 8 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Two test were failing on Darwin when testing Fabiano's series
which allows building ARM targets without TCG accelerator:
https://lore.kernel.org/qemu-devel/20230118193518.26433-1-farosas@suse.de/
These patches allow boot-serial / migration tests to run without
TCG / KVM, then HVF.
Pending: How to test for (poisoned) HVF with qtest?
Philippe Mathieu-Daudé (8):
tests/qtest/boot-serial-test: Constify tests[] array
tests/qtest/boot-serial-test: Build command line using GString API
tests/qtest/boot-serial-test: Only use available accelerators
tests/qtest/migration-test: Build command line using GString API
tests/qtest/migration-test: Only use available accelerators
tests/qtest/libqtest: Allow checking for HVF accelerator
tests/qtest/boot-serial-test: Allow running with HVF
tests/qtest/migration-test: Allow running with HVF
tests/qtest/boot-serial-test.c | 42 ++++++++++----
tests/qtest/libqtest.c | 2 +
tests/qtest/migration-test.c | 101 +++++++++++++++++++--------------
3 files changed, 91 insertions(+), 54 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/8] tests/qtest/boot-serial-test: Constify tests[] array
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 2/8] tests/qtest/boot-serial-test: Build command line using GString API Philippe Mathieu-Daudé
` (6 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/boot-serial-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index b216519b62..3aef3a97a9 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -139,7 +139,7 @@ typedef struct testdef {
const uint8_t *bios; /* Set in case we use our own mini bios */
} testdef_t;
-static testdef_t tests[] = {
+static const testdef_t tests[] = {
{ "alpha", "clipper", "", "PCI:" },
{ "avr", "arduino-duemilanove", "", "T", sizeof(bios_avr), NULL, bios_avr },
{ "avr", "arduino-mega-2560-v3", "", "T", sizeof(bios_avr), NULL, bios_avr},
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/8] tests/qtest/boot-serial-test: Build command line using GString API
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 1/8] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 3/8] tests/qtest/boot-serial-test: Only use available accelerators Philippe Mathieu-Daudé
` (5 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/boot-serial-test.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 3aef3a97a9..fccf706f99 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -226,23 +226,25 @@ static void test_machine(const void *data)
const testdef_t *test = data;
g_autofree char *serialtmp = NULL;
g_autofree char *codetmp = NULL;
- const char *codeparam = "";
const uint8_t *code = NULL;
QTestState *qts;
int ser_fd;
+ g_autoptr(GString) cmd = g_string_new("");
ser_fd = g_file_open_tmp("qtest-boot-serial-sXXXXXX", &serialtmp, NULL);
g_assert(ser_fd != -1);
close(ser_fd);
+ g_string_append_printf(cmd, "-M %s ", test->machine);
+ g_string_append(cmd, "-no-shutdown ");
+
if (test->kernel) {
code = test->kernel;
- codeparam = "-kernel";
+ g_string_append(cmd, "-kernel ");
} else if (test->bios) {
code = test->bios;
- codeparam = "-bios";
+ g_string_append(cmd, "-bios ");
}
-
if (code) {
ssize_t wlen;
int code_fd;
@@ -252,17 +254,22 @@ static void test_machine(const void *data)
wlen = write(code_fd, code, test->codesize);
g_assert(wlen == test->codesize);
close(code_fd);
+ g_string_append_printf(cmd, "%s ", codetmp);
}
+ g_string_append_printf(cmd, "-chardev file,id=serial0,path=%s "
+ "-serial chardev:serial0 ", serialtmp);
+
/*
* Make sure that this test uses tcg if available: It is used as a
* fast-enough smoketest for that.
*/
- qts = qtest_initf("%s %s -M %s -no-shutdown "
- "-chardev file,id=serial0,path=%s "
- "-serial chardev:serial0 -accel tcg -accel kvm %s",
- codeparam, code ? codetmp : "", test->machine,
- serialtmp, test->extra);
+ g_string_append(cmd, "-accel tcg ");
+ g_string_append(cmd, "-accel kvm ");
+ g_string_append(cmd, test->extra);
+
+ qts = qtest_init(cmd->str);
+
if (code) {
unlink(codetmp);
}
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/8] tests/qtest/boot-serial-test: Only use available accelerators
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 1/8] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 2/8] tests/qtest/boot-serial-test: Build command line using GString API Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API Philippe Mathieu-Daudé
` (4 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
For example, avoid when TCG is disabled:
$ make check-qtest-aarch64
...
18/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/boot-serial-test
qemu-system-aarch64: -accel tcg: invalid accelerator tcg
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/boot-serial-test.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index fccf706f99..f8d0c684c2 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -17,6 +17,9 @@
#include "libqtest.h"
#include "libqos/libqos-spapr.h"
+static bool has_tcg;
+static bool has_kvm;
+
static const uint8_t bios_avr[] = {
0x88, 0xe0, /* ldi r24, 0x08 */
0x80, 0x93, 0xc1, 0x00, /* sts 0x00C1, r24 ; Enable tx */
@@ -264,8 +267,12 @@ static void test_machine(const void *data)
* Make sure that this test uses tcg if available: It is used as a
* fast-enough smoketest for that.
*/
- g_string_append(cmd, "-accel tcg ");
- g_string_append(cmd, "-accel kvm ");
+ if (has_tcg) {
+ g_string_append(cmd, "-accel tcg ");
+ }
+ if (has_kvm) {
+ g_string_append(cmd, "-accel kvm ");
+ }
g_string_append(cmd, test->extra);
qts = qtest_init(cmd->str);
@@ -292,6 +299,9 @@ int main(int argc, char *argv[])
const char *arch = qtest_get_arch();
int i;
+ has_tcg = qtest_has_accel("tcg");
+ has_kvm = qtest_has_accel("kvm");
+
g_test_init(&argc, &argv, NULL);
for (i = 0; tests[i].arch != NULL; i++) {
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-01-19 10:05 ` [PATCH 3/8] tests/qtest/boot-serial-test: Only use available accelerators Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 10:59 ` Dr. David Alan Gilbert
2023-01-19 10:05 ` [PATCH 5/8] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
` (3 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 85 ++++++++++++++++++------------------
1 file changed, 42 insertions(+), 43 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index dbde726adf..36e6074653 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -582,13 +582,13 @@ typedef struct {
static int test_migrate_start(QTestState **from, QTestState **to,
const char *uri, MigrateStart *args)
{
+ g_autoptr(GString) cmd_common = NULL;
g_autofree gchar *arch_source = NULL;
+ g_autoptr(GString) cmd_source = NULL;
g_autofree gchar *arch_target = NULL;
- g_autofree gchar *cmd_source = NULL;
- g_autofree gchar *cmd_target = NULL;
- const gchar *ignore_stderr;
+ g_autoptr(GString) cmd_target = NULL;
+ const gchar *ignore_stderr = NULL;
g_autofree char *bootpath = NULL;
- g_autofree char *shmem_opts = NULL;
g_autofree char *shmem_path = NULL;
const char *arch = qtest_get_arch();
const char *machine_opts = NULL;
@@ -602,6 +602,12 @@ static int test_migrate_start(QTestState **from, QTestState **to,
}
got_stop = false;
+
+ cmd_common = g_string_new("");
+ g_string_append(cmd_common, "-accel tcg ");
+ g_string_append_printf(cmd_common, "-accel kvm%s ",
+ args->use_dirty_ring ? ",dirty-ring-size=4096" : "");
+
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
/* the assembled x86 boot sector should be exactly one sector large */
@@ -645,65 +651,58 @@ static int test_migrate_start(QTestState **from, QTestState **to,
} else {
g_assert_not_reached();
}
+ if (machine_opts) {
+ g_string_append_printf(cmd_common, " -machine %s ", machine_opts);
+ }
+ g_string_append_printf(cmd_common, "-m %s ", memory_size);
if (!getenv("QTEST_LOG") && args->hide_stderr) {
-#ifndef _WIN32
- ignore_stderr = "2>/dev/null";
-#else
+#ifdef _WIN32
/*
* On Windows the QEMU executable is created via CreateProcess() and
* IO redirection does not work, so don't bother adding IO redirection
* to the command line.
*/
- ignore_stderr = "";
+#else
+ ignore_stderr = "2>/dev/null";
#endif
- } else {
- ignore_stderr = "";
}
if (args->use_shmem) {
shmem_path = g_strdup_printf("/dev/shm/qemu-%d", getpid());
- shmem_opts = g_strdup_printf(
+ g_string_append_printf(cmd_common,
"-object memory-backend-file,id=mem0,size=%s"
",mem-path=%s,share=on -numa node,memdev=mem0",
memory_size, shmem_path);
- } else {
- shmem_path = NULL;
- shmem_opts = g_strdup("");
}
- cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
- "-name source,debug-threads=on "
- "-m %s "
- "-serial file:%s/src_serial "
- "%s %s %s %s",
- args->use_dirty_ring ?
- ",dirty-ring-size=4096" : "",
- machine_opts ? " -machine " : "",
- machine_opts ? machine_opts : "",
- memory_size, tmpfs,
- arch_source, shmem_opts,
- args->opts_source ? args->opts_source : "",
- ignore_stderr);
if (!args->only_target) {
- *from = qtest_init(cmd_source);
+ cmd_source = g_string_new(cmd_common->str);
+ g_string_append(cmd_source, "-name source,debug-threads=on ");
+ g_string_append_printf(cmd_source, "-serial file:%s/src_serial ",
+ tmpfs);
+ g_string_append_printf(cmd_source, "%s ", arch_source);
+ if (args->opts_source) {
+ g_string_append_printf(cmd_source, "%s ", args->opts_source);
+ }
+ if (ignore_stderr) {
+ g_string_append(cmd_source, ignore_stderr);
+ }
+ *from = qtest_init(cmd_source->str);
}
- cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
- "-name target,debug-threads=on "
- "-m %s "
- "-serial file:%s/dest_serial "
- "-incoming %s "
- "%s %s %s %s",
- args->use_dirty_ring ?
- ",dirty-ring-size=4096" : "",
- machine_opts ? " -machine " : "",
- machine_opts ? machine_opts : "",
- memory_size, tmpfs, uri,
- arch_target, shmem_opts,
- args->opts_target ? args->opts_target : "",
- ignore_stderr);
- *to = qtest_init(cmd_target);
+ cmd_target = g_string_new(cmd_common->str);
+ g_string_append(cmd_target, "-name target,debug-threads=on ");
+ g_string_append_printf(cmd_target, "-serial file:%s/dest_serial ", tmpfs);
+ g_string_append_printf(cmd_target, "-incoming %s ", uri);
+ g_string_append_printf(cmd_target, "%s ", arch_target);
+ if (args->opts_target) {
+ g_string_append_printf(cmd_target, "%s ", args->opts_target);
+ }
+ if (ignore_stderr) {
+ g_string_append(cmd_source, ignore_stderr);
+ }
+ *to = qtest_init(cmd_target->str);
/*
* Remove shmem file immediately to avoid memory leak in test failed case.
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 5/8] tests/qtest/migration-test: Only use available accelerators
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-01-19 10:05 ` [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 11:08 ` Dr. David Alan Gilbert
2023-01-19 10:05 ` [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator Philippe Mathieu-Daudé
` (2 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
For example, avoid when TCG is disabled:
$ make check-qtest-aarch64
...
20/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/migration-test
qemu-system-aarch64: -accel tcg: invalid accelerator tcg
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 36e6074653..1e7f1ea162 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -45,6 +45,8 @@
unsigned start_address;
unsigned end_address;
+static bool has_tcg;
+static bool has_kvm;
static bool uffd_feature_thread_id;
/*
@@ -604,9 +606,14 @@ static int test_migrate_start(QTestState **from, QTestState **to,
got_stop = false;
cmd_common = g_string_new("");
- g_string_append(cmd_common, "-accel tcg ");
- g_string_append_printf(cmd_common, "-accel kvm%s ",
- args->use_dirty_ring ? ",dirty-ring-size=4096" : "");
+ if (has_tcg) {
+ g_string_append(cmd_common, "-accel tcg ");
+ }
+ if (has_kvm) {
+ g_string_append_printf(cmd_common, "-accel kvm%s ",
+ args->use_dirty_ring
+ ? ",dirty-ring-size=4096" : "");
+ }
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
@@ -2458,12 +2465,14 @@ static bool kvm_dirty_ring_supported(void)
int main(int argc, char **argv)
{
- const bool has_kvm = qtest_has_accel("kvm");
const bool has_uffd = ufd_version_check();
const char *arch = qtest_get_arch();
g_autoptr(GError) err = NULL;
int ret;
+ has_tcg = qtest_has_accel("tcg");
+ has_kvm = qtest_has_accel("kvm");
+
g_test_init(&argc, &argv, NULL);
/*
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2023-01-19 10:05 ` [PATCH 5/8] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 11:24 ` Thomas Huth
2023-01-19 10:05 ` [PATCH 7/8] tests/qtest/boot-serial-test: Allow running with HVF Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 8/8] tests/qtest/migration-test: " Philippe Mathieu-Daudé
7 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
RFC: CONFIG_HVF is poisoned.
We could pass host config definitions to qtest using:
diff --git a/meson.build b/meson.build
@@ -2547,6 +2547,7 @@ foreach target : target_dirs
accel_kconfig = []
foreach sym: accelerators
+ config_host_data.set(sym + '_QTEST', '')
if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
config_target += { sym: 'y' }
config_all += { sym: 'y' }
Then test for CONFIG_HVF_QTEST ...
---
tests/qtest/libqtest.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 6b2216cb20..31650bdc9f 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -901,6 +901,8 @@ bool qtest_has_accel(const char *accel_name)
}
}
}
+ } else if (g_str_equal(accel_name, "hvf")) {
+ return true; /* XXX CONFIG_HVF is poisoned... */
} else {
/* not implemented */
g_assert_not_reached();
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 7/8] tests/qtest/boot-serial-test: Allow running with HVF
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2023-01-19 10:05 ` [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 8/8] tests/qtest/migration-test: " Philippe Mathieu-Daudé
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/boot-serial-test.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index f8d0c684c2..4a2cbcf8e8 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -19,6 +19,7 @@
static bool has_tcg;
static bool has_kvm;
+static bool has_hvf;
static const uint8_t bios_avr[] = {
0x88, 0xe0, /* ldi r24, 0x08 */
@@ -273,6 +274,9 @@ static void test_machine(const void *data)
if (has_kvm) {
g_string_append(cmd, "-accel kvm ");
}
+ if (has_hvf) {
+ g_string_append(cmd, "-accel hvf ");
+ }
g_string_append(cmd, test->extra);
qts = qtest_init(cmd->str);
@@ -301,6 +305,7 @@ int main(int argc, char *argv[])
has_tcg = qtest_has_accel("tcg");
has_kvm = qtest_has_accel("kvm");
+ has_hvf = qtest_has_accel("hvf");
g_test_init(&argc, &argv, NULL);
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 8/8] tests/qtest/migration-test: Allow running with HVF
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2023-01-19 10:05 ` [PATCH 7/8] tests/qtest/boot-serial-test: Allow running with HVF Philippe Mathieu-Daudé
@ 2023-01-19 10:05 ` Philippe Mathieu-Daudé
2023-01-19 11:13 ` Dr. David Alan Gilbert
7 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, Thomas Huth, qemu-arm,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 1e7f1ea162..7a0fcfb81d 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -47,6 +47,7 @@ unsigned start_address;
unsigned end_address;
static bool has_tcg;
static bool has_kvm;
+static bool has_hvf;
static bool uffd_feature_thread_id;
/*
@@ -614,6 +615,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
args->use_dirty_ring
? ",dirty-ring-size=4096" : "");
}
+ if (has_hvf) {
+ g_string_append(cmd_common, "-accel hvf ");
+ }
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
@@ -2472,6 +2476,7 @@ int main(int argc, char **argv)
has_tcg = qtest_has_accel("tcg");
has_kvm = qtest_has_accel("kvm");
+ has_hvf = qtest_has_accel("hvf");
g_test_init(&argc, &argv, NULL);
--
2.38.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API
2023-01-19 10:05 ` [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API Philippe Mathieu-Daudé
@ 2023-01-19 10:59 ` Dr. David Alan Gilbert
2023-01-19 11:15 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-01-19 10:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Laurent Vivier, Fabiano Rosas,
Juan Quintela, Thomas Huth, qemu-arm
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> tests/qtest/migration-test.c | 85 ++++++++++++++++++------------------
> 1 file changed, 42 insertions(+), 43 deletions(-)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index dbde726adf..36e6074653 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -582,13 +582,13 @@ typedef struct {
> static int test_migrate_start(QTestState **from, QTestState **to,
> const char *uri, MigrateStart *args)
> {
bit of a big change with lots of things moving around, I think it's
mostly OK but...
> + g_autoptr(GString) cmd_common = NULL;
> g_autofree gchar *arch_source = NULL;
> + g_autoptr(GString) cmd_source = NULL;
> g_autofree gchar *arch_target = NULL;
> - g_autofree gchar *cmd_source = NULL;
> - g_autofree gchar *cmd_target = NULL;
> - const gchar *ignore_stderr;
> + g_autoptr(GString) cmd_target = NULL;
> + const gchar *ignore_stderr = NULL;
> g_autofree char *bootpath = NULL;
> - g_autofree char *shmem_opts = NULL;
> g_autofree char *shmem_path = NULL;
> const char *arch = qtest_get_arch();
> const char *machine_opts = NULL;
> @@ -602,6 +602,12 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> }
>
> got_stop = false;
> +
> + cmd_common = g_string_new("");
> + g_string_append(cmd_common, "-accel tcg ");
> + g_string_append_printf(cmd_common, "-accel kvm%s ",
> + args->use_dirty_ring ? ",dirty-ring-size=4096" : "");
> +
Isn't that swapping the order of -accel tcg and -accel kvm ?
In the original it's
g_strdup_printf("-accel kvm%s -accel tcg%s%s "
I think you're ending up with tcg first?
Dave
> bootpath = g_strdup_printf("%s/bootsect", tmpfs);
> if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> /* the assembled x86 boot sector should be exactly one sector large */
> @@ -645,65 +651,58 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> } else {
> g_assert_not_reached();
> }
> + if (machine_opts) {
> + g_string_append_printf(cmd_common, " -machine %s ", machine_opts);
> + }
> + g_string_append_printf(cmd_common, "-m %s ", memory_size);
>
> if (!getenv("QTEST_LOG") && args->hide_stderr) {
> -#ifndef _WIN32
> - ignore_stderr = "2>/dev/null";
> -#else
> +#ifdef _WIN32
> /*
> * On Windows the QEMU executable is created via CreateProcess() and
> * IO redirection does not work, so don't bother adding IO redirection
> * to the command line.
> */
> - ignore_stderr = "";
> +#else
> + ignore_stderr = "2>/dev/null";
> #endif
> - } else {
> - ignore_stderr = "";
> }
>
> if (args->use_shmem) {
> shmem_path = g_strdup_printf("/dev/shm/qemu-%d", getpid());
> - shmem_opts = g_strdup_printf(
> + g_string_append_printf(cmd_common,
> "-object memory-backend-file,id=mem0,size=%s"
> ",mem-path=%s,share=on -numa node,memdev=mem0",
> memory_size, shmem_path);
> - } else {
> - shmem_path = NULL;
> - shmem_opts = g_strdup("");
> }
>
> - cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
> - "-name source,debug-threads=on "
> - "-m %s "
> - "-serial file:%s/src_serial "
> - "%s %s %s %s",
> - args->use_dirty_ring ?
> - ",dirty-ring-size=4096" : "",
> - machine_opts ? " -machine " : "",
> - machine_opts ? machine_opts : "",
> - memory_size, tmpfs,
> - arch_source, shmem_opts,
> - args->opts_source ? args->opts_source : "",
> - ignore_stderr);
> if (!args->only_target) {
> - *from = qtest_init(cmd_source);
> + cmd_source = g_string_new(cmd_common->str);
> + g_string_append(cmd_source, "-name source,debug-threads=on ");
> + g_string_append_printf(cmd_source, "-serial file:%s/src_serial ",
> + tmpfs);
> + g_string_append_printf(cmd_source, "%s ", arch_source);
> + if (args->opts_source) {
> + g_string_append_printf(cmd_source, "%s ", args->opts_source);
> + }
> + if (ignore_stderr) {
> + g_string_append(cmd_source, ignore_stderr);
> + }
> + *from = qtest_init(cmd_source->str);
> }
>
> - cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
> - "-name target,debug-threads=on "
> - "-m %s "
> - "-serial file:%s/dest_serial "
> - "-incoming %s "
> - "%s %s %s %s",
> - args->use_dirty_ring ?
> - ",dirty-ring-size=4096" : "",
> - machine_opts ? " -machine " : "",
> - machine_opts ? machine_opts : "",
> - memory_size, tmpfs, uri,
> - arch_target, shmem_opts,
> - args->opts_target ? args->opts_target : "",
> - ignore_stderr);
> - *to = qtest_init(cmd_target);
> + cmd_target = g_string_new(cmd_common->str);
> + g_string_append(cmd_target, "-name target,debug-threads=on ");
> + g_string_append_printf(cmd_target, "-serial file:%s/dest_serial ", tmpfs);
> + g_string_append_printf(cmd_target, "-incoming %s ", uri);
> + g_string_append_printf(cmd_target, "%s ", arch_target);
> + if (args->opts_target) {
> + g_string_append_printf(cmd_target, "%s ", args->opts_target);
> + }
> + if (ignore_stderr) {
> + g_string_append(cmd_source, ignore_stderr);
> + }
> + *to = qtest_init(cmd_target->str);
>
> /*
> * Remove shmem file immediately to avoid memory leak in test failed case.
> --
> 2.38.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 5/8] tests/qtest/migration-test: Only use available accelerators
2023-01-19 10:05 ` [PATCH 5/8] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
@ 2023-01-19 11:08 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-01-19 11:08 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Laurent Vivier, Fabiano Rosas,
Juan Quintela, Thomas Huth, qemu-arm
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> For example, avoid when TCG is disabled:
>
> $ make check-qtest-aarch64
> ...
> 20/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/migration-test
> qemu-system-aarch64: -accel tcg: invalid accelerator tcg
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
With the ordering proviso of the previous patch,
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> tests/qtest/migration-test.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 36e6074653..1e7f1ea162 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -45,6 +45,8 @@
>
> unsigned start_address;
> unsigned end_address;
> +static bool has_tcg;
> +static bool has_kvm;
> static bool uffd_feature_thread_id;
>
> /*
> @@ -604,9 +606,14 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> got_stop = false;
>
> cmd_common = g_string_new("");
> - g_string_append(cmd_common, "-accel tcg ");
> - g_string_append_printf(cmd_common, "-accel kvm%s ",
> - args->use_dirty_ring ? ",dirty-ring-size=4096" : "");
> + if (has_tcg) {
> + g_string_append(cmd_common, "-accel tcg ");
> + }
> + if (has_kvm) {
> + g_string_append_printf(cmd_common, "-accel kvm%s ",
> + args->use_dirty_ring
> + ? ",dirty-ring-size=4096" : "");
> + }
>
> bootpath = g_strdup_printf("%s/bootsect", tmpfs);
> if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> @@ -2458,12 +2465,14 @@ static bool kvm_dirty_ring_supported(void)
>
> int main(int argc, char **argv)
> {
> - const bool has_kvm = qtest_has_accel("kvm");
> const bool has_uffd = ufd_version_check();
> const char *arch = qtest_get_arch();
> g_autoptr(GError) err = NULL;
> int ret;
>
> + has_tcg = qtest_has_accel("tcg");
> + has_kvm = qtest_has_accel("kvm");
> +
> g_test_init(&argc, &argv, NULL);
>
> /*
> --
> 2.38.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 8/8] tests/qtest/migration-test: Allow running with HVF
2023-01-19 10:05 ` [PATCH 8/8] tests/qtest/migration-test: " Philippe Mathieu-Daudé
@ 2023-01-19 11:13 ` Dr. David Alan Gilbert
2023-01-19 11:31 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-01-19 11:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Laurent Vivier, Fabiano Rosas,
Juan Quintela, Thomas Huth, qemu-arm
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Does it support migration? I don't remember anyone ever mentioning it.
Dave
> ---
> tests/qtest/migration-test.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 1e7f1ea162..7a0fcfb81d 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -47,6 +47,7 @@ unsigned start_address;
> unsigned end_address;
> static bool has_tcg;
> static bool has_kvm;
> +static bool has_hvf;
> static bool uffd_feature_thread_id;
>
> /*
> @@ -614,6 +615,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> args->use_dirty_ring
> ? ",dirty-ring-size=4096" : "");
> }
> + if (has_hvf) {
> + g_string_append(cmd_common, "-accel hvf ");
> + }
>
> bootpath = g_strdup_printf("%s/bootsect", tmpfs);
> if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> @@ -2472,6 +2476,7 @@ int main(int argc, char **argv)
>
> has_tcg = qtest_has_accel("tcg");
> has_kvm = qtest_has_accel("kvm");
> + has_hvf = qtest_has_accel("hvf");
>
> g_test_init(&argc, &argv, NULL);
>
> --
> 2.38.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API
2023-01-19 10:59 ` Dr. David Alan Gilbert
@ 2023-01-19 11:15 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 11:15 UTC (permalink / raw)
To: Dr. David Alan Gilbert
Cc: qemu-devel, Paolo Bonzini, Laurent Vivier, Fabiano Rosas,
Juan Quintela, Thomas Huth, qemu-arm
On 19/1/23 11:59, Dr. David Alan Gilbert wrote:
> * Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> tests/qtest/migration-test.c | 85 ++++++++++++++++++------------------
>> 1 file changed, 42 insertions(+), 43 deletions(-)
>>
>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>> index dbde726adf..36e6074653 100644
>> --- a/tests/qtest/migration-test.c
>> +++ b/tests/qtest/migration-test.c
>> @@ -582,13 +582,13 @@ typedef struct {
>> static int test_migrate_start(QTestState **from, QTestState **to,
>> const char *uri, MigrateStart *args)
>> {
>
> bit of a big change with lots of things moving around, I think it's
> mostly OK but...
I'll see how to split.
>> + g_autoptr(GString) cmd_common = NULL;
>> g_autofree gchar *arch_source = NULL;
>> + g_autoptr(GString) cmd_source = NULL;
>> g_autofree gchar *arch_target = NULL;
>> - g_autofree gchar *cmd_source = NULL;
>> - g_autofree gchar *cmd_target = NULL;
>> - const gchar *ignore_stderr;
>> + g_autoptr(GString) cmd_target = NULL;
>> + const gchar *ignore_stderr = NULL;
>> g_autofree char *bootpath = NULL;
>> - g_autofree char *shmem_opts = NULL;
>> g_autofree char *shmem_path = NULL;
>> const char *arch = qtest_get_arch();
>> const char *machine_opts = NULL;
>> @@ -602,6 +602,12 @@ static int test_migrate_start(QTestState **from, QTestState **to,
>> }
>>
>> got_stop = false;
>> +
>> + cmd_common = g_string_new("");
>> + g_string_append(cmd_common, "-accel tcg ");
>> + g_string_append_printf(cmd_common, "-accel kvm%s ",
>> + args->use_dirty_ring ? ",dirty-ring-size=4096" : "");
>> +
>
> Isn't that swapping the order of -accel tcg and -accel kvm ?
> In the original it's
> g_strdup_printf("-accel kvm%s -accel tcg%s%s "
>
> I think you're ending up with tcg first?
Oops good catch, thanks!
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-19 10:05 ` [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator Philippe Mathieu-Daudé
@ 2023-01-19 11:24 ` Thomas Huth
2023-01-19 11:30 ` Philippe Mathieu-Daudé
2023-01-19 16:21 ` Thomas Huth
0 siblings, 2 replies; 21+ messages in thread
From: Thomas Huth @ 2023-01-19 11:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm
On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> RFC: CONFIG_HVF is poisoned.
>
> We could pass host config definitions to qtest using:
>
> diff --git a/meson.build b/meson.build
> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>
> accel_kconfig = []
> foreach sym: accelerators
> + config_host_data.set(sym + '_QTEST', '')
> if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
> config_target += { sym: 'y' }
> config_all += { sym: 'y' }
>
> Then test for CONFIG_HVF_QTEST ...
I don't think that would really work well. The qtests are build once for all
targets, and HVF is only available in the target that matches the host
architecture. It's poisoned on purpose.
The TCG accelerator is special, since we have it in either none or in all
targets, that's why we can use CONFIG_TCG there.
The kvm part is also rather a hack... we should maybe rather additionally
use the "query-kvm" QAPI command to check whether it is really available...?
To fix this properly for HVF, I think you'd need a way to query the
available accelerators via QMP, too... Hmmm, weren't there some patches for
something like that in the past ... can't remember right now ...
Thomas
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-19 11:24 ` Thomas Huth
@ 2023-01-19 11:30 ` Philippe Mathieu-Daudé
2023-01-19 12:05 ` Thomas Huth
2023-01-19 16:21 ` Thomas Huth
1 sibling, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 11:30 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm
On 19/1/23 12:24, Thomas Huth wrote:
> On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> RFC: CONFIG_HVF is poisoned.
>>
>> We could pass host config definitions to qtest using:
>>
>> diff --git a/meson.build b/meson.build
>> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>>
>> accel_kconfig = []
>> foreach sym: accelerators
>> + config_host_data.set(sym + '_QTEST', '')
>> if sym == 'CONFIG_TCG' or target in
>> accelerator_targets.get(sym, [])
>> config_target += { sym: 'y' }
>> config_all += { sym: 'y' }
>>
>> Then test for CONFIG_HVF_QTEST ...
>
> I don't think that would really work well. The qtests are build once for
> all targets, and HVF is only available in the target that matches the
> host architecture. It's poisoned on purpose.
>
> The TCG accelerator is special, since we have it in either none or in
> all targets, that's why we can use CONFIG_TCG there.
>
> The kvm part is also rather a hack... we should maybe rather
> additionally use the "query-kvm" QAPI command to check whether it is
> really available...?
>
> To fix this properly for HVF, I think you'd need a way to query the
> available accelerators via QMP, too... Hmmm, weren't there some patches
> for something like that in the past ... can't remember right now ...
https://lore.kernel.org/qemu-devel/20210505125806.1263441-3-philmd@redhat.com/
:(
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 8/8] tests/qtest/migration-test: Allow running with HVF
2023-01-19 11:13 ` Dr. David Alan Gilbert
@ 2023-01-19 11:31 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-19 11:31 UTC (permalink / raw)
To: Dr. David Alan Gilbert
Cc: qemu-devel, Paolo Bonzini, Laurent Vivier, Fabiano Rosas,
Juan Quintela, Thomas Huth, qemu-arm
On 19/1/23 12:13, Dr. David Alan Gilbert wrote:
> * Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Does it support migration? I don't remember anyone ever mentioning it.
The test doesn't fail, but I have no idea what that means...
>> ---
>> tests/qtest/migration-test.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>> index 1e7f1ea162..7a0fcfb81d 100644
>> --- a/tests/qtest/migration-test.c
>> +++ b/tests/qtest/migration-test.c
>> @@ -47,6 +47,7 @@ unsigned start_address;
>> unsigned end_address;
>> static bool has_tcg;
>> static bool has_kvm;
>> +static bool has_hvf;
>> static bool uffd_feature_thread_id;
>>
>> /*
>> @@ -614,6 +615,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
>> args->use_dirty_ring
>> ? ",dirty-ring-size=4096" : "");
>> }
>> + if (has_hvf) {
>> + g_string_append(cmd_common, "-accel hvf ");
>> + }
>>
>> bootpath = g_strdup_printf("%s/bootsect", tmpfs);
>> if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
>> @@ -2472,6 +2476,7 @@ int main(int argc, char **argv)
>>
>> has_tcg = qtest_has_accel("tcg");
>> has_kvm = qtest_has_accel("kvm");
>> + has_hvf = qtest_has_accel("hvf");
>>
>> g_test_init(&argc, &argv, NULL);
>>
>> --
>> 2.38.1
>>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-19 11:30 ` Philippe Mathieu-Daudé
@ 2023-01-19 12:05 ` Thomas Huth
2023-01-20 10:26 ` Thomas Huth
0 siblings, 1 reply; 21+ messages in thread
From: Thomas Huth @ 2023-01-19 12:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm, Markus Armbruster,
Igor Mammedov
On 19/01/2023 12.30, Philippe Mathieu-Daudé wrote:
> On 19/1/23 12:24, Thomas Huth wrote:
>> On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>> RFC: CONFIG_HVF is poisoned.
>>>
>>> We could pass host config definitions to qtest using:
>>>
>>> diff --git a/meson.build b/meson.build
>>> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>>>
>>> accel_kconfig = []
>>> foreach sym: accelerators
>>> + config_host_data.set(sym + '_QTEST', '')
>>> if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
>>> config_target += { sym: 'y' }
>>> config_all += { sym: 'y' }
>>>
>>> Then test for CONFIG_HVF_QTEST ...
>>
>> I don't think that would really work well. The qtests are build once for
>> all targets, and HVF is only available in the target that matches the host
>> architecture. It's poisoned on purpose.
>>
>> The TCG accelerator is special, since we have it in either none or in all
>> targets, that's why we can use CONFIG_TCG there.
>>
>> The kvm part is also rather a hack... we should maybe rather additionally
>> use the "query-kvm" QAPI command to check whether it is really available...?
>>
>> To fix this properly for HVF, I think you'd need a way to query the
>> available accelerators via QMP, too... Hmmm, weren't there some patches
>> for something like that in the past ... can't remember right now ...
>
> https://lore.kernel.org/qemu-devel/20210505125806.1263441-3-philmd@redhat.com/
> :(
Ah, right, and we ended up with the competing patch from Igor since we could
not quite settle on the QAPI extensions?
Hmm, what happens if you execute "query-qmp-schema" on a HVF-enabled host
these days? Is there a "hvf"-related entry somewhere in the response?
Thomas
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-19 11:24 ` Thomas Huth
2023-01-19 11:30 ` Philippe Mathieu-Daudé
@ 2023-01-19 16:21 ` Thomas Huth
1 sibling, 0 replies; 21+ messages in thread
From: Thomas Huth @ 2023-01-19 16:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm
On 19/01/2023 12.24, Thomas Huth wrote:
> On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> RFC: CONFIG_HVF is poisoned.
>>
>> We could pass host config definitions to qtest using:
>>
>> diff --git a/meson.build b/meson.build
>> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>>
>> accel_kconfig = []
>> foreach sym: accelerators
>> + config_host_data.set(sym + '_QTEST', '')
>> if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
>> config_target += { sym: 'y' }
>> config_all += { sym: 'y' }
>>
>> Then test for CONFIG_HVF_QTEST ...
>
> I don't think that would really work well. The qtests are build once for all
> targets, and HVF is only available in the target that matches the host
> architecture. It's poisoned on purpose.
>
> The TCG accelerator is special, since we have it in either none or in all
> targets, that's why we can use CONFIG_TCG there.
>
> The kvm part is also rather a hack... we should maybe rather additionally
> use the "query-kvm" QAPI command to check whether it is really available...?
Scratch that ... I forgot that you already have to run with "-accel kvm" to
see whether the accelerator is working with "query-kvm" ... so that would
not work here for probing whether "-accel kvm" should be used or not ;-)
Thomas
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-19 12:05 ` Thomas Huth
@ 2023-01-20 10:26 ` Thomas Huth
2023-01-20 11:18 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 21+ messages in thread
From: Thomas Huth @ 2023-01-20 10:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm, Markus Armbruster,
Igor Mammedov
On 19/01/2023 13.05, Thomas Huth wrote:
> On 19/01/2023 12.30, Philippe Mathieu-Daudé wrote:
>> On 19/1/23 12:24, Thomas Huth wrote:
>>> On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>> ---
>>>> RFC: CONFIG_HVF is poisoned.
>>>>
>>>> We could pass host config definitions to qtest using:
>>>>
>>>> diff --git a/meson.build b/meson.build
>>>> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>>>>
>>>> accel_kconfig = []
>>>> foreach sym: accelerators
>>>> + config_host_data.set(sym + '_QTEST', '')
>>>> if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym,
>>>> [])
>>>> config_target += { sym: 'y' }
>>>> config_all += { sym: 'y' }
>>>>
>>>> Then test for CONFIG_HVF_QTEST ...
>>>
>>> I don't think that would really work well. The qtests are build once for
>>> all targets, and HVF is only available in the target that matches the
>>> host architecture. It's poisoned on purpose.
>>>
>>> The TCG accelerator is special, since we have it in either none or in all
>>> targets, that's why we can use CONFIG_TCG there.
>>>
>>> The kvm part is also rather a hack... we should maybe rather additionally
>>> use the "query-kvm" QAPI command to check whether it is really available...?
>>>
>>> To fix this properly for HVF, I think you'd need a way to query the
>>> available accelerators via QMP, too... Hmmm, weren't there some patches
>>> for something like that in the past ... can't remember right now ...
>>
>> https://lore.kernel.org/qemu-devel/20210505125806.1263441-3-philmd@redhat.com/
>> :(
>
> Ah, right, and we ended up with the competing patch from Igor since we could
> not quite settle on the QAPI extensions?
>
> Hmm, what happens if you execute "query-qmp-schema" on a HVF-enabled host
> these days? Is there a "hvf"-related entry somewhere in the response?
Alternative idea: execute QEMU once with "-accel help" via
g_spawn_command_line_sync() or g_spawn_sync() once and look for the
accelerator in the standard output.
Thomas
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-20 10:26 ` Thomas Huth
@ 2023-01-20 11:18 ` Philippe Mathieu-Daudé
2023-01-20 11:39 ` Thomas Huth
0 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 11:18 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm, Markus Armbruster,
Igor Mammedov
On 20/1/23 11:26, Thomas Huth wrote:
> On 19/01/2023 13.05, Thomas Huth wrote:
>> On 19/01/2023 12.30, Philippe Mathieu-Daudé wrote:
>>> On 19/1/23 12:24, Thomas Huth wrote:
>>>> On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
>>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>>> ---
>>>>> RFC: CONFIG_HVF is poisoned.
>>>>>
>>>>> We could pass host config definitions to qtest using:
>>>>>
>>>>> diff --git a/meson.build b/meson.build
>>>>> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>>>>>
>>>>> accel_kconfig = []
>>>>> foreach sym: accelerators
>>>>> + config_host_data.set(sym + '_QTEST', '')
>>>>> if sym == 'CONFIG_TCG' or target in
>>>>> accelerator_targets.get(sym, [])
>>>>> config_target += { sym: 'y' }
>>>>> config_all += { sym: 'y' }
>>>>>
>>>>> Then test for CONFIG_HVF_QTEST ...
>>>>
>>>> I don't think that would really work well. The qtests are build once
>>>> for all targets, and HVF is only available in the target that
>>>> matches the host architecture. It's poisoned on purpose.
>>>>
>>>> The TCG accelerator is special, since we have it in either none or
>>>> in all targets, that's why we can use CONFIG_TCG there.
>>>>
>>>> The kvm part is also rather a hack... we should maybe rather
>>>> additionally use the "query-kvm" QAPI command to check whether it is
>>>> really available...?
>>>>
>>>> To fix this properly for HVF, I think you'd need a way to query the
>>>> available accelerators via QMP, too... Hmmm, weren't there some
>>>> patches for something like that in the past ... can't remember right
>>>> now ...
>>>
>>> https://lore.kernel.org/qemu-devel/20210505125806.1263441-3-philmd@redhat.com/ :(
>>
>> Ah, right, and we ended up with the competing patch from Igor since we
>> could not quite settle on the QAPI extensions?
>>
>> Hmm, what happens if you execute "query-qmp-schema" on a HVF-enabled
>> host these days? Is there a "hvf"-related entry somewhere in the
>> response?
>
> Alternative idea: execute QEMU once with "-accel help" via
> g_spawn_command_line_sync() or g_spawn_sync() once and look for the
> accelerator in the standard output.
There is no stability guaranty with the help output.
QMP is a stable API, we should really rely on it here IMO.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator
2023-01-20 11:18 ` Philippe Mathieu-Daudé
@ 2023-01-20 11:39 ` Thomas Huth
0 siblings, 0 replies; 21+ messages in thread
From: Thomas Huth @ 2023-01-20 11:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Fabiano Rosas, Juan Quintela,
Dr. David Alan Gilbert, qemu-arm, Markus Armbruster,
Igor Mammedov
On 20/01/2023 12.18, Philippe Mathieu-Daudé wrote:
> On 20/1/23 11:26, Thomas Huth wrote:
>> On 19/01/2023 13.05, Thomas Huth wrote:
>>> On 19/01/2023 12.30, Philippe Mathieu-Daudé wrote:
>>>> On 19/1/23 12:24, Thomas Huth wrote:
>>>>> On 19/01/2023 11.05, Philippe Mathieu-Daudé wrote:
>>>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>>>> ---
>>>>>> RFC: CONFIG_HVF is poisoned.
>>>>>>
>>>>>> We could pass host config definitions to qtest using:
>>>>>>
>>>>>> diff --git a/meson.build b/meson.build
>>>>>> @@ -2547,6 +2547,7 @@ foreach target : target_dirs
>>>>>>
>>>>>> accel_kconfig = []
>>>>>> foreach sym: accelerators
>>>>>> + config_host_data.set(sym + '_QTEST', '')
>>>>>> if sym == 'CONFIG_TCG' or target in
>>>>>> accelerator_targets.get(sym, [])
>>>>>> config_target += { sym: 'y' }
>>>>>> config_all += { sym: 'y' }
>>>>>>
>>>>>> Then test for CONFIG_HVF_QTEST ...
>>>>>
>>>>> I don't think that would really work well. The qtests are build once
>>>>> for all targets, and HVF is only available in the target that matches
>>>>> the host architecture. It's poisoned on purpose.
>>>>>
>>>>> The TCG accelerator is special, since we have it in either none or in
>>>>> all targets, that's why we can use CONFIG_TCG there.
>>>>>
>>>>> The kvm part is also rather a hack... we should maybe rather
>>>>> additionally use the "query-kvm" QAPI command to check whether it is
>>>>> really available...?
>>>>>
>>>>> To fix this properly for HVF, I think you'd need a way to query the
>>>>> available accelerators via QMP, too... Hmmm, weren't there some patches
>>>>> for something like that in the past ... can't remember right now ...
>>>>
>>>> https://lore.kernel.org/qemu-devel/20210505125806.1263441-3-philmd@redhat.com/
>>>> :(
>>>
>>> Ah, right, and we ended up with the competing patch from Igor since we
>>> could not quite settle on the QAPI extensions?
>>>
>>> Hmm, what happens if you execute "query-qmp-schema" on a HVF-enabled host
>>> these days? Is there a "hvf"-related entry somewhere in the response?
>>
>> Alternative idea: execute QEMU once with "-accel help" via
>> g_spawn_command_line_sync() or g_spawn_sync() once and look for the
>> accelerator in the standard output.
>
> There is no stability guaranty with the help output.
Sure, it's rather meant as a temporary solution until a proper QMP method is
in place. We also have the advantage here that it is internal to the QEMU
repository only - it's not like libvirt or some other upper layers are
trying to parse the output here.
> QMP is a stable API, we should really rely on it here IMO.
I agree, QMP should certainly be the final goal.
Thomas
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2023-01-20 11:40 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19 10:05 [PATCH 0/8] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 1/8] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 2/8] tests/qtest/boot-serial-test: Build command line using GString API Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 3/8] tests/qtest/boot-serial-test: Only use available accelerators Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 4/8] tests/qtest/migration-test: Build command line using GString API Philippe Mathieu-Daudé
2023-01-19 10:59 ` Dr. David Alan Gilbert
2023-01-19 11:15 ` Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 5/8] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
2023-01-19 11:08 ` Dr. David Alan Gilbert
2023-01-19 10:05 ` [RFC PATCH 6/8] tests/qtest/libqtest: Allow checking for HVF accelerator Philippe Mathieu-Daudé
2023-01-19 11:24 ` Thomas Huth
2023-01-19 11:30 ` Philippe Mathieu-Daudé
2023-01-19 12:05 ` Thomas Huth
2023-01-20 10:26 ` Thomas Huth
2023-01-20 11:18 ` Philippe Mathieu-Daudé
2023-01-20 11:39 ` Thomas Huth
2023-01-19 16:21 ` Thomas Huth
2023-01-19 10:05 ` [PATCH 7/8] tests/qtest/boot-serial-test: Allow running with HVF Philippe Mathieu-Daudé
2023-01-19 10:05 ` [PATCH 8/8] tests/qtest/migration-test: " Philippe Mathieu-Daudé
2023-01-19 11:13 ` Dr. David Alan Gilbert
2023-01-19 11:31 ` Philippe Mathieu-Daudé
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).