Skip to contentSkip to conversation

qtests: Check accelerator available at runtime via QMP 'query-accels'

PATCH Superseded Philippe Mathieu-Daudé 9 participants 49 messages Apr 15, 2021 – May 1, 2021 Arm/Amlogic Meson SoC support

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover qtests: Check accelerator available at runtime via QMP 'query-accels'

Hi,

This series aims at having accelerator-independent qtests by querying a QEMU instance at runtime to check the list of built-in accelerators.

First we add the 'query-accels' QMP command, then we add the qtest_has_accel() method to libqtest, finally we use this new method to allow running bios-tables-test on KVM-only builds.

As a bonus we remove CONFIG_TCG in config_host, to avoid building unnecessary objects depending on TCG.

Since v3:
- Addressed Markus & Drew review comments
- Added qtest/migration-test patch

Since v2:
- Addressed Eric & Paolo review comments

Since v1:
- kept over-engineered union (I don't how to do simple enum)
- dropped arm-cpu-features patches for now
- fixed typos (Eric)
- rename qtest_has_accel (Thomas)
- probe accel with machine none previous qtest (Paolo)
- iterate over QAPI enum (Markus)

Eric's suggestion of conditional QAPI didn't worked out, as accelerator definitions are poisoned.

Please review,

Phil.

Philippe Mathieu-Daudé (12):
MAINTAINERS: Add qtest/arm-cpu-features.c to ARM TCG CPUs section
accel: Introduce 'query-accels' QMP command
tests/qtest: Add qtest_has_accel() method qtest/arm-cpu-features: Use generic qtest_has_accel() to check for KVM qtest/arm-cpu-features: Restrict sve_tests_sve_off_kvm test to KVM qtest/arm-cpu-features: Remove TCG fallback to KVM specific tests qtest/arm-cpu-features: Use generic qtest_has_accel() to check for TCG qtest/bios-tables-test: Make test build-independent from accelerator qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64 qtest/qmp-cmd-test: Make test build-independent from accelerator tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore tests/meson: Only build softfloat objects if TCG is selected

 meson.build                    |  1 -
 qapi/machine.json              | 47 ++++++++++++++++
 tests/qtest/libqos/libqtest.h  |  8 +++
 accel/accel-qmp.c              | 49 +++++++++++++++++
 tests/qtest/arm-cpu-features.c | 55 ++++++-------------
 tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
 tests/qtest/libqtest.c         | 29 ++++++++++
 tests/qtest/migration-test.c   |  4 +-
 tests/qtest/qmp-cmd-test.c     | 18 +++++--
 MAINTAINERS                    |  1 +
 accel/meson.build              |  2 +-
 tests/qtest/meson.build        |  3 +-
 12 files changed, 221 insertions(+), 95 deletions(-)
 create mode 100644 accel/accel-qmp.c
Signature · 1 line
2.26.3
#1 lore raw

PATCH v4 1/12 MAINTAINERS: Add qtest/arm-cpu-features.c to ARM TCG CPUs section

We want the ARM maintainers and the qemu-arm@ list to be notified when this file is modified. Add an entry to the 'ARM TCG CPUs' section in the MAINTAINERS file.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 36055f14c59..d5df4ba7891 100644
@@ -156,6 +156,7 @@ S: Maintained
 F: target/arm/
 F: tests/tcg/arm/
 F: tests/tcg/aarch64/
+F: tests/qtest/arm-cpu-features.c
 F: hw/arm/
 F: hw/cpu/a*mpcore.c
 F: include/hw/cpu/a*mpcore.h
Signature · 1 line
2.26.3
Reviewed-by on v4 1/12
#2 lore raw

Re: [PATCH v4 01/12] MAINTAINERS: Add qtest/arm-cpu-features.c to ARM TCG CPUs section

Quoted 15 lines · Philippe Mathieu-Daudé

We want the ARM maintainers and the qemu-arm@ list to be notified when this file is modified. Add an entry to the 'ARM TCG CPUs' section in the MAINTAINERS file.

---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 36055f14c59..d5df4ba7891 100644

MAINTAINERS S: Maintained · line 162

Quoted 7 lines
MAINTAINERS +1 -0
@@ -156,6 +156,7 @@ S: Maintained
  F: target/arm/
  F: tests/tcg/arm/
  F: tests/tcg/aarch64/
+F: tests/qtest/arm-cpu-features.c
  F: hw/arm/
  F: hw/cpu/a*mpcore.c
  F: include/hw/cpu/a*mpcore.h
author Acked-by Andrew Jones on v4 1/12
#3 lore raw

Re: [PATCH v4 01/12] MAINTAINERS: Add qtest/arm-cpu-features.c to ARM TCG CPUs section

In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

We want the ARM maintainers and the qemu-arm@ list to be notified when this file is modified. Add an entry to the 'ARM TCG CPUs' section in the MAINTAINERS file.

Forgot to include:

Quoted 18 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 36055f14c59..d5df4ba7891 100644
@@ -156,6 +156,7 @@ S: Maintained
 F: target/arm/
 F: tests/tcg/arm/
 F: tests/tcg/aarch64/
+F: tests/qtest/arm-cpu-features.c
 F: hw/arm/
 F: hw/cpu/a*mpcore.c
 F: include/hw/cpu/a*mpcore.h
Reviewed-by on v4 1/12
#4 lore raw

Re: [PATCH v4 01/12] MAINTAINERS: Add qtest/arm-cpu-features.c to ARM TCG CPUs section

In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

We want the ARM maintainers and the qemu-arm@ list to be notified when this file is modified. Add an entry to the 'ARM TCG CPUs' section in the MAINTAINERS file.

Quoted 16 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 36055f14c59..d5df4ba7891 100644
@@ -156,6 +156,7 @@ S: Maintained
 F: target/arm/
 F: tests/tcg/arm/
 F: tests/tcg/aarch64/
+F: tests/qtest/arm-cpu-features.c
 F: hw/arm/
 F: hw/cpu/a*mpcore.c
 F: include/hw/cpu/a*mpcore.h
Signature · 1 line
Alex Bennée
#5 lore raw

PATCH v4 2/12 accel: Introduce 'query-accels' QMP command

In reply to Philippe Mathieu-Daudé

Introduce the 'query-accels' QMP command which returns a list of built-in accelerator names.

- Accelerator is a QAPI enum of all existing accelerators,

- AcceleratorInfo is a QAPI structure providing accelerator specific information. Currently the common structure base provides the name of the accelerator, while the specific part is empty, but each accelerator can expand it.

- 'query-accels' QMP command returns a list of @AcceleratorInfo

For example on a KVM-only build we get:

    { "execute": "query-accels" }
    {
        "return": [
            {
                "name": "qtest"
            },
            {
                "name": "kvm"
            }
        ]
    }

Note that we can't make the enum values or union branches conditional because of target-specific poisoning of accelerator definitions.

---
Since v3: Simplify over-engineered AcceleratorInfo (Markus, kept Eric R-b) Since v2: @since 6.0 -> 6.1, added note (Eric)
Since v1: 'type' -> 'name' in comments

---
 qapi/machine.json | 47 +++++++++++++++++++++++++++++++++++++++++++++
 accel/accel-qmp.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++
 accel/meson.build |  2 +-
 3 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 accel/accel-qmp.c
qapi/machine.json +47 -0
index 6e90d463fc9..1ef729f6f84 100644
@@ -1274,3 +1274,50 @@
 ##
 { 'event': 'MEM_UNPLUG_ERROR',
   'data': { 'device': 'str', 'msg': 'str' } }
+
+##
+# @Accelerator:
+#
+# An enumeration of accelerator names.
+#
+# Since: 6.1
+##
+{ 'enum': 'Accelerator',
+  'data': [ 'qtest', 'tcg', 'kvm', 'hax', 'hvf', 'whpx', 'xen' ] }
+
+##
+# @AcceleratorInfo:
+#
+# Accelerator information.
+#
+# @name: The accelerator name.
+#
+# Since: 6.1
+##
+{ 'struct': 'AcceleratorInfo',
+  'data': { 'name': 'Accelerator' } }
+
+##
+# @query-accels:
+#
+# Get a list of AcceleratorInfo for all built-in accelerators.
+#
+# Returns: a list of @AcceleratorInfo describing each accelerator.
+#
+# Since: 6.1
+#
+# Example:
+#
+# -> { "execute": "query-accels" }
+# <- { "return": [
+#        {
+#            "name": "qtest"
+#        },
+#        {
+#            "name": "kvm"
+#        }
+#    ] }
+#
+##
+{ 'command': 'query-accels',
+  'returns': ['AcceleratorInfo'] }
accel/accel-qmp.c new file +49 -0

49 lines not on this page · raw message

accel/meson.build +1 -1
index b44ba30c864..7a48f6d568d 100644
@@ -1,4 +1,4 @@
-specific_ss.add(files('accel-common.c'))
+specific_ss.add(files('accel-common.c', 'accel-qmp.c'))
 softmmu_ss.add(files('accel-softmmu.c'))
 user_ss.add(files('accel-user.c'))
 
Signature · 1 line
2.26.3
Reviewed-by Tested-by on v4 2/12
#6 lore raw

Re: [PATCH v4 02/12] accel: Introduce 'query-accels' QMP command

Quoted 26 lines · Philippe Mathieu-Daudé

Introduce the 'query-accels' QMP command which returns a list of built-in accelerator names.

- Accelerator is a QAPI enum of all existing accelerators,

- AcceleratorInfo is a QAPI structure providing accelerator specific information. Currently the common structure base provides the name of the accelerator, while the specific part is empty, but each accelerator can expand it.

- 'query-accels' QMP command returns a list of @AcceleratorInfo

For example on a KVM-only build we get:

    { "execute": "query-accels" }
    {
        "return": [
            {
                "name": "qtest"
            },
            {
                "name": "kvm"
            }
        ]
    }
Quoted 5 lines

Note that we can't make the enum values or union branches conditional because of target-specific poisoning of accelerator definitions.

Signature · 1 line
Alex Bennée
#7 lore raw

Re: [PATCH v4 02/12] accel: Introduce 'query-accels' QMP command

In reply to Philippe Mathieu-Daudé
Quoted 41 lines · Philippe Mathieu-Daudé

Introduce the 'query-accels' QMP command which returns a list of built-in accelerator names.

- Accelerator is a QAPI enum of all existing accelerators,

- AcceleratorInfo is a QAPI structure providing accelerator specific information. Currently the common structure base provides the name of the accelerator, while the specific part is empty, but each accelerator can expand it.

- 'query-accels' QMP command returns a list of @AcceleratorInfo

For example on a KVM-only build we get:

    { "execute": "query-accels" }
    {
        "return": [
            {
                "name": "qtest"
            },
            {
                "name": "kvm"
            }
        ]
    }

Note that we can't make the enum values or union branches conditional because of target-specific poisoning of accelerator definitions.

---
Since v3: Simplify over-engineered AcceleratorInfo (Markus, kept Eric R-b) Since v2: @since 6.0 -> 6.1, added note (Eric)
Since v1: 'type' -> 'name' in comments

+++ b/qapi/machine.json

qapi/machine.json +0 -0
@@ -1274,3 +1274,50 @@
 ##
 { 'event': 'MEM_UNPLUG_ERROR',
   'data': { 'device': 'str', 'msg': 'str' } }

qapi/machine.json line 1286

Quoted 10 lines
qapi/machine.json +10 -0
+
+##
+# @Accelerator:
+#
+# An enumeration of accelerator names.
+#
+# Since: 6.1
+##
+{ 'enum': 'Accelerator',
+  'data': [ 'qtest', 'tcg', 'kvm', 'hax', 'hvf', 'whpx', 'xen' ] }

There's no requirement for enums to be in any order, although if the list is likely to get larger over time, lexicographic order makes it easier to know where to insert new entries. Up to you whether it is worth sorting, and your decision does not invalidate my R-b.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#8 lore raw

Re: [PATCH v4 02/12] accel: Introduce 'query-accels' QMP command

Quoted 49 lines · Eric Blake
Quoted 48 lines · Philippe Mathieu-Daudé

Introduce the 'query-accels' QMP command which returns a list of built-in accelerator names.

- Accelerator is a QAPI enum of all existing accelerators,

- AcceleratorInfo is a QAPI structure providing accelerator specific information. Currently the common structure base provides the name of the accelerator, while the specific part is empty, but each accelerator can expand it.

- 'query-accels' QMP command returns a list of @AcceleratorInfo

For example on a KVM-only build we get:

    { "execute": "query-accels" }
    {
        "return": [
            {
                "name": "qtest"
            },
            {
                "name": "kvm"
            }
        ]
    }

Note that we can't make the enum values or union branches conditional because of target-specific poisoning of accelerator definitions.

---
Since v3: Simplify over-engineered AcceleratorInfo (Markus, kept Eric R-b) Since v2: @since 6.0 -> 6.1, added note (Eric)
Since v1: 'type' -> 'name' in comments

+++ b/qapi/machine.json

qapi/machine.json +7 -0
@@ -1274,3 +1274,50 @@
 ##
 { 'event': 'MEM_UNPLUG_ERROR',
   'data': { 'device': 'str', 'msg': 'str' } }
+
+##
+# @Accelerator:
+#
+# An enumeration of accelerator names.
+#
+# Since: 6.1
Quoted 8 lines

qapi/machine.json line 1286

Quoted 3 lines
qapi/machine.json +3 -0
+##
+{ 'enum': 'Accelerator',
+  'data': [ 'qtest', 'tcg', 'kvm', 'hax', 'hvf', 'whpx', 'xen' ] }

There's no requirement for enums to be in any order, although if the list is likely to get larger over time, lexicographic order makes it easier to know where to insert new entries. Up to you whether it is worth sorting, and your decision does not invalidate my R-b.

OK will do, thanks!

#9 lore raw

PATCH v4 3/12 tests/qtest: Add qtest_has_accel() method

In reply to Philippe Mathieu-Daudé

Introduce the qtest_has_accel() method which allows a runtime query on whether a QEMU instance has an accelerator built-in.

---
Since v2:
- reworded (Eric)
Since v1:
- rename qtest_probe_accel() -> qtest_has_accel()
- run with -machine none before creating QTestState

---
 tests/qtest/libqos/libqtest.h |  8 ++++++++
 tests/qtest/libqtest.c        | 29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
tests/qtest/libqos/libqtest.h +8 -0
index a68dcd79d44..d80c618c18d 100644
@@ -763,6 +763,14 @@ void qmp_expect_error_and_unref(QDict *rsp, const char *class);
  */
 bool qtest_probe_child(QTestState *s);
 
+/**
+ * qtest_has_accel:
+ * @accel_name: Accelerator name to check for.
+ *
+ * Returns: true if the accelerator is built in.
+ */
+bool qtest_has_accel(const char *accel_name);
+
 /**
  * qtest_set_expected_status:
  * @s: QTestState instance to operate on.
tests/qtest/libqtest.c +29 -0
index 71e359efcd3..2156b7e3972 100644
@@ -393,6 +393,35 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
     return qts;
 }
 
+bool qtest_has_accel(const char *accel_name)
+{
+    bool has_accel = false;
+    QDict *response;
+    QList *accels;
+    QListEntry *accel;
+    QTestState *qts;
+
+    qts = qtest_initf("-accel qtest -machine none");
+    response = qtest_qmp(qts, "{'execute': 'query-accels'}");
+    accels = qdict_get_qlist(response, "return");
+
+    QLIST_FOREACH_ENTRY(accels, accel) {
+        QDict *accel_dict = qobject_to(QDict, qlist_entry_obj(accel));
+        const char *name = qdict_get_str(accel_dict, "name");
+
+        if (g_str_equal(name, accel_name)) {
+            has_accel = true;
+            break;
+        }
+    }
+    qobject_unref(response);
+
+    qtest_quit(qts);
+
+    return has_accel;
+}
+
+
 void qtest_quit(QTestState *s)
 {
     qtest_remove_abrt_handler(s);
Signature · 1 line
2.26.3
#11 lore raw

PATCH v4 4/12 qtest/arm-cpu-features: Use generic qtest_has_accel() to check for KVM

In reply to Philippe Mathieu-Daudé

Use the recently added generic qtest_has_accel() method to check if KVM is available.

---
 tests/qtest/arm-cpu-features.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)
tests/qtest/arm-cpu-features.c +1 -24
index 8252b85bb85..7f4b2521277 100644
@@ -26,21 +26,6 @@
                     "  'arguments': { 'type': 'full', "
 #define QUERY_TAIL  "}}"
 
-static bool kvm_enabled(QTestState *qts)
-{
-    QDict *resp, *qdict;
-    bool enabled;
-
-    resp = qtest_qmp(qts, "{ 'execute': 'query-kvm' }");
-    g_assert(qdict_haskey(resp, "return"));
-    qdict = qdict_get_qdict(resp, "return");
-    g_assert(qdict_haskey(qdict, "enabled"));
-    enabled = qdict_get_bool(qdict, "enabled");
-    qobject_unref(resp);
-
-    return enabled;
-}
-
 static QDict *do_query_no_props(QTestState *qts, const char *cpu_type)
 {
     return qtest_qmp(qts, QUERY_HEAD "'model': { 'name': %s }"
@@ -493,14 +478,6 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
 
     qts = qtest_init(MACHINE_KVM "-cpu max");
 
-    /*
-     * These tests target the 'host' CPU type, so KVM must be enabled.
-     */
-    if (!kvm_enabled(qts)) {
-        qtest_quit(qts);
-        return;
-    }
-
     /* Enabling and disabling kvm-no-adjvtime should always work. */
     assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime");
     assert_set_feature(qts, "host", "kvm-no-adjvtime", true);
@@ -624,7 +601,7 @@ int main(int argc, char **argv)
      * order avoid attempting to run an AArch32 QEMU with KVM on
      * AArch64 hosts. That won't work and isn't easy to detect.
      */
-    if (g_str_equal(qtest_get_arch(), "aarch64")) {
+    if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
         qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
                             NULL, test_query_cpu_model_expansion_kvm);
     }
Signature · 1 line
2.26.3
Reviewed-by on v4 4/12
#12 lore raw

Re: [PATCH v4 04/12] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for KVM

Quoted 9 lines · Philippe Mathieu-Daudé

Use the recently added generic qtest_has_accel() method to check if KVM is available.

---
 tests/qtest/arm-cpu-features.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)
Reviewed-by on v4 4/12
#13 lore raw

Re: [PATCH v4 04/12] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for KVM

In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Use the recently added generic qtest_has_accel() method to check if KVM is available.

Signature · 1 line
Alex Bennée
#14 lore raw

PATCH v4 5/12 qtest/arm-cpu-features: Restrict sve_tests_sve_off_kvm test to KVM

In reply to Philippe Mathieu-Daudé

The sve_tests_sve_off_kvm() test is KVM specific.
Only run it if KVM is available.

---
 tests/qtest/arm-cpu-features.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/arm-cpu-features.c +2 -2
index 7f4b2521277..66300c3bc20 100644
@@ -604,6 +604,8 @@ int main(int argc, char **argv)
     if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
         qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
                             NULL, test_query_cpu_model_expansion_kvm);
+        qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
+                            NULL, sve_tests_sve_off_kvm);
     }
 
     if (g_str_equal(qtest_get_arch(), "aarch64")) {
@@ -611,8 +613,6 @@ int main(int argc, char **argv)
                             NULL, sve_tests_sve_max_vq_8);
         qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
                             NULL, sve_tests_sve_off);
-        qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
-                            NULL, sve_tests_sve_off_kvm);
     }
 
     return g_test_run();
Signature · 1 line
2.26.3
Reviewed-by on v4 5/12
#15 lore raw

Re: [PATCH v4 05/12] qtest/arm-cpu-features: Restrict sve_tests_sve_off_kvm test to KVM

Quoted 34 lines · Philippe Mathieu-Daudé

The sve_tests_sve_off_kvm() test is KVM specific.
Only run it if KVM is available.

---
 tests/qtest/arm-cpu-features.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/arm-cpu-features.c +2 -2
index 7f4b2521277..66300c3bc20 100644
@@ -604,6 +604,8 @@ int main(int argc, char **argv)
     if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
         qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
                             NULL, test_query_cpu_model_expansion_kvm);
+        qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
+                            NULL, sve_tests_sve_off_kvm);
     }
 
     if (g_str_equal(qtest_get_arch(), "aarch64")) {
@@ -611,8 +613,6 @@ int main(int argc, char **argv)
                             NULL, sve_tests_sve_max_vq_8);
         qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
                             NULL, sve_tests_sve_off);
-        qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
-                            NULL, sve_tests_sve_off_kvm);
     }
 
     return g_test_run();
Signature · 1 line
2.26.3
Reviewed-by on v4 5/12
#16 lore raw

Re: [PATCH v4 05/12] qtest/arm-cpu-features: Restrict sve_tests_sve_off_kvm test to KVM

In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

The sve_tests_sve_off_kvm() test is KVM specific.
Only run it if KVM is available.

Quoted 26 lines
---
 tests/qtest/arm-cpu-features.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/arm-cpu-features.c +2 -2
index 7f4b2521277..66300c3bc20 100644
@@ -604,6 +604,8 @@ int main(int argc, char **argv)
     if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
         qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
                             NULL, test_query_cpu_model_expansion_kvm);
+        qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
+                            NULL, sve_tests_sve_off_kvm);
     }
 
     if (g_str_equal(qtest_get_arch(), "aarch64")) {
@@ -611,8 +613,6 @@ int main(int argc, char **argv)
                             NULL, sve_tests_sve_max_vq_8);
         qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
                             NULL, sve_tests_sve_off);
-        qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
-                            NULL, sve_tests_sve_off_kvm);
     }
 
     return g_test_run();
Signature · 1 line
Alex Bennée
#17 lore raw

PATCH v4 6/12 qtest/arm-cpu-features: Remove TCG fallback to KVM specific tests

In reply to Philippe Mathieu-Daudé

sve_tests_sve_off_kvm() and test_query_cpu_model_expansion_kvm() tests are now only being run if KVM is available. Drop the TCG fallback.

---
 tests/qtest/arm-cpu-features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/arm-cpu-features.c +1 -1
index 66300c3bc20..b1d406542f7 100644
@@ -21,7 +21,7 @@
 #define SVE_MAX_VQ 16
 
 #define MACHINE     "-machine virt,gic-version=max -accel tcg "
-#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
+#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
 #define QUERY_HEAD  "{ 'execute': 'query-cpu-model-expansion', " \
                     "  'arguments': { 'type': 'full', "
 #define QUERY_TAIL  "}}"
Signature · 1 line
2.26.3
Reviewed-by on v4 6/12
#18 lore raw

Re: [PATCH v4 06/12] qtest/arm-cpu-features: Remove TCG fallback to KVM specific tests

Quoted 26 lines · Philippe Mathieu-Daudé

sve_tests_sve_off_kvm() and test_query_cpu_model_expansion_kvm() tests are now only being run if KVM is available. Drop the TCG fallback.

---
 tests/qtest/arm-cpu-features.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/arm-cpu-features.c +1 -1
index 66300c3bc20..b1d406542f7 100644
@@ -21,7 +21,7 @@
 #define SVE_MAX_VQ 16
 
 #define MACHINE     "-machine virt,gic-version=max -accel tcg "
-#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
+#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
 #define QUERY_HEAD  "{ 'execute': 'query-cpu-model-expansion', " \
                     "  'arguments': { 'type': 'full', "
 #define QUERY_TAIL  "}}"
Signature · 1 line
2.26.3
Reviewed-by on v4 6/12
#19 lore raw

Re: [PATCH v4 06/12] qtest/arm-cpu-features: Remove TCG fallback to KVM specific tests

In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

sve_tests_sve_off_kvm() and test_query_cpu_model_expansion_kvm() tests are now only being run if KVM is available. Drop the TCG fallback.

Signature · 1 line
Alex Bennée
#20 lore raw

PATCH v4 7/12 qtest/arm-cpu-features: Use generic qtest_has_accel() to check for TCG

In reply to Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, only run these tests if TCG is built into the QEMU binary.

---
 tests/qtest/arm-cpu-features.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
tests/qtest/arm-cpu-features.c +9 -7
index b1d406542f7..0d9145dd168 100644
@@ -20,7 +20,7 @@
  */
 #define SVE_MAX_VQ 16
 
-#define MACHINE     "-machine virt,gic-version=max -accel tcg "
+#define MACHINE_TCG "-machine virt,gic-version=max -accel tcg "
 #define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
 #define QUERY_HEAD  "{ 'execute': 'query-cpu-model-expansion', " \
                     "  'arguments': { 'type': 'full', "
@@ -337,7 +337,7 @@ static void sve_tests_sve_max_vq_8(const void *data)
 {
     QTestState *qts;
 
-    qts = qtest_init(MACHINE "-cpu max,sve-max-vq=8");
+    qts = qtest_init(MACHINE_TCG "-cpu max,sve-max-vq=8");
 
     assert_sve_vls(qts, "max", BIT_ULL(8) - 1, NULL);
 
@@ -372,7 +372,7 @@ static void sve_tests_sve_off(const void *data)
 {
     QTestState *qts;
 
-    qts = qtest_init(MACHINE "-cpu max,sve=off");
+    qts = qtest_init(MACHINE_TCG "-cpu max,sve=off");
 
     /* SVE is off, so the map should be empty. */
     assert_sve_vls(qts, "max", 0, NULL);
@@ -428,7 +428,7 @@ static void test_query_cpu_model_expansion(const void *data)
 {
     QTestState *qts;
 
-    qts = qtest_init(MACHINE "-cpu max");
+    qts = qtest_init(MACHINE_TCG "-cpu max");
 
     /* Test common query-cpu-model-expansion input validation */
     assert_type_full(qts);
@@ -593,8 +593,10 @@ int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
 
-    qtest_add_data_func("/arm/query-cpu-model-expansion",
-                        NULL, test_query_cpu_model_expansion);
+    if (qtest_has_accel("tcg")) {
+        qtest_add_data_func("/arm/query-cpu-model-expansion",
+                            NULL, test_query_cpu_model_expansion);
+    }
 
     /*
      * For now we only run KVM specific tests with AArch64 QEMU in
@@ -608,7 +610,7 @@ int main(int argc, char **argv)
                             NULL, sve_tests_sve_off_kvm);
     }
 
-    if (g_str_equal(qtest_get_arch(), "aarch64")) {
+    if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("tcg")) {
         qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
                             NULL, sve_tests_sve_max_vq_8);
         qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
Signature · 1 line
2.26.3
Reviewed-by on v4 7/12
#21 lore raw

Re: [PATCH v4 07/12] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for TCG

Quoted 10 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, only run these tests if TCG is built into the QEMU binary.

---
 tests/qtest/arm-cpu-features.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
Reviewed-by on v4 7/12
#22 lore raw

Re: [PATCH v4 07/12] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for TCG

In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, only run these tests if TCG is built into the QEMU binary.

Signature · 1 line
Alex Bennée
#23 lore raw

PATCH v4 8/12 qtest/bios-tables-test: Make test build-independent from accelerator

In reply to Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by an assertion.

---
Since v1: use global tcg_accel_available, call qtest_has_accel() once

---
 tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 47 deletions(-)
tests/qtest/bios-tables-test.c +52 -47
index 156d4174aa3..a4c7bddf6f3 100644
@@ -97,6 +97,7 @@ typedef struct {
     QTestState *qts;
 } test_data;
 
+static bool tcg_accel_available;
 static char disk[] = "tests/acpi-test-disk-XXXXXX";
 static const char *data_dir = "tests/data/acpi";
 #ifdef CONFIG_IASL
@@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
     char *args;
     bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
 
-#ifndef CONFIG_TCG
-    if (data->tcg_only) {
-        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
-        return;
-    }
-#endif /* CONFIG_TCG */
+    assert(!data->tcg_only || tcg_accel_available);
 
     args = test_acpi_create_args(data, params, use_uefi);
     data->qts = qtest_init(args);
+
     test_acpi_load_tables(data, use_uefi);
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
@@ -1504,6 +1501,8 @@ int main(int argc, char *argv[])
     const char *arch = qtest_get_arch();
     int ret;
 
+    tcg_accel_available = qtest_has_accel("tcg");
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
@@ -1512,56 +1511,62 @@ int main(int argc, char *argv[])
             return ret;
         }
         qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
-        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
-        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
         qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
-        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
+        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
         qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
                        test_acpi_piix4_no_root_hotplug);
         qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
                        test_acpi_piix4_no_bridge_hotplug);
         qtest_add_func("acpi/piix4/pci-hotplug/off",
                        test_acpi_piix4_no_acpi_pci_hotplug);
-        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
-        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
-        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
-        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
-        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
-        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
-        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
-        qtest_add_func("acpi/piix4/smm-compat",
-                       test_acpi_piix4_tcg_smm_compat);
-        qtest_add_func("acpi/piix4/smm-compat-nosmm",
-                       test_acpi_piix4_tcg_smm_compat_nosmm);
-        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
-        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
-        qtest_add_func("acpi/q35/smm-compat",
-                       test_acpi_q35_tcg_smm_compat);
-        qtest_add_func("acpi/q35/smm-compat-nosmm",
-                       test_acpi_q35_tcg_smm_compat_nosmm);
-        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
-        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
-        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
-        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
-        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
-        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
-        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
-        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
-        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
-        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
-        if (strcmp(arch, "x86_64") == 0) {
-            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+        if (tcg_accel_available) {
+            qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
+            qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
+            qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
+            qtest_add_func("acpi/q35", test_acpi_q35_tcg);
+            qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+            qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
+            qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
+            qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
+            qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
+            qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
+            qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
+            qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
+            qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
+            qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
+            qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
+            qtest_add_func("acpi/piix4/smm-compat",
+                           test_acpi_piix4_tcg_smm_compat);
+            qtest_add_func("acpi/piix4/smm-compat-nosmm",
+                           test_acpi_piix4_tcg_smm_compat_nosmm);
+            qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
+            qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
+            qtest_add_func("acpi/q35/smm-compat",
+                           test_acpi_q35_tcg_smm_compat);
+            qtest_add_func("acpi/q35/smm-compat-nosmm",
+                           test_acpi_q35_tcg_smm_compat_nosmm);
+            qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
+            qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
+            qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
+            qtest_add_func("acpi/piix4/acpihmat",
+                           test_acpi_piix4_tcg_acpi_hmat);
+            qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
+            qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
+            qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
+            qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
+            qtest_add_func("acpi/microvm/ioapic2",
+                           test_acpi_microvm_ioapic2_tcg);
+            if (strcmp(arch, "x86_64") == 0) {
+                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+            }
         }
     } else if (strcmp(arch, "aarch64") == 0) {
-        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
-        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
-        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
-        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
+        if (tcg_accel_available) {
+            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
+            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
+            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
+        }
         qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
     }
     ret = g_test_run();
Signature · 1 line
2.26.3
Reviewed-by on v4 8/12
#24 lore raw

Re: [PATCH v4 08/12] qtest/bios-tables-test: Make test build-independent from accelerator

Quoted 26 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by an assertion.

---
Since v1: use global tcg_accel_available, call qtest_has_accel() once

---
 tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 47 deletions(-)
tests/qtest/bios-tables-test.c +1 -0
index 156d4174aa3..a4c7bddf6f3 100644
@@ -97,6 +97,7 @@ typedef struct {
     QTestState *qts;
 } test_data;
 
+static bool tcg_accel_available;
 static char disk[] = "tests/acpi-test-disk-XXXXXX";
 static const char *data_dir = "tests/data/acpi";
 #ifdef CONFIG_IASL

tests/qtest/bios-tables-test.c static void test_acpi_one(const char *params, test_data *data) · line 722

Quoted 10 lines
tests/qtest/bios-tables-test.c +1 -6
@@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
     char *args;
     bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
 
-#ifndef CONFIG_TCG
-    if (data->tcg_only) {
-        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
-        return;
-    }
-#endif /* CONFIG_TCG */
+    assert(!data->tcg_only || tcg_accel_available);

I find it odd that we need TCG here (especially on an x86 system) to test what are essentially device models we use in KVM. On the other hand it maintains the current effect with less ifdef hacks so:

Signature · 1 line
Alex Bennée
#25 lore raw

PATCH v4 9/12 qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64

In reply to Philippe Mathieu-Daudé

We might have a s390x/ppc64 QEMU binary built without the KVM accelerator (configured with --disable-kvm).
Checking for /dev/kvm accessibility isn't enough, also check for the accelerator in the binary.

---
Cc: David Gibson <[email protected]>
Cc: Greg Kurz <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 tests/qtest/migration-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +2 -2
index 3a711bb4929..c32a2aa30a2 100644
@@ -1408,7 +1408,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
         (access("/sys/module/kvm_hv", F_OK) ||
-         access("/dev/kvm", R_OK | W_OK))) {
+         access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm"))) {
         g_test_message("Skipping test: kvm_hv not available");
         return g_test_run();
     }
@@ -1419,7 +1419,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "s390x")) {
 #if defined(HOST_S390X)
-        if (access("/dev/kvm", R_OK | W_OK)) {
+        if (access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm")) {
             g_test_message("Skipping test: kvm not available");
             return g_test_run();
         }
Signature · 1 line
2.26.3
Reviewed-by on v4 9/12
#26 lore raw

Re: [PATCH v4 09/12] qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64

Quoted 6 lines · Philippe Mathieu-Daudé

We might have a s390x/ppc64 QEMU binary built without the KVM accelerator (configured with --disable-kvm).
Checking for /dev/kvm accessibility isn't enough, also check for the accelerator in the binary.

Quoted 34 lines

---
Cc: David Gibson <[email protected]>
Cc: Greg Kurz <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 tests/qtest/migration-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +2 -2
index 3a711bb4929..c32a2aa30a2 100644
@@ -1408,7 +1408,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
         (access("/sys/module/kvm_hv", F_OK) ||
-         access("/dev/kvm", R_OK | W_OK))) {
+         access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm"))) {
         g_test_message("Skipping test: kvm_hv not available");
         return g_test_run();
     }
@@ -1419,7 +1419,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "s390x")) {
 #if defined(HOST_S390X)
-        if (access("/dev/kvm", R_OK | W_OK)) {
+        if (access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm")) {
             g_test_message("Skipping test: kvm not available");
             return g_test_run();
         }
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by on v4 9/12
#27 lore raw

Re: [PATCH v4 09/12] qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · On Thu, 15 Apr 2021 18:33:01 +0200 Philippe Mathieu-Daudé <[email protected]>…

We might have a s390x/ppc64 QEMU binary built without the KVM accelerator (configured with --disable-kvm).
Checking for /dev/kvm accessibility isn't enough, also check for the accelerator in the binary.

---

LGTM

Quoted 33 lines
Cc David Gibson <[email protected]>
Cc Greg Kurz <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc Christian Borntraeger <[email protected]>
---
 tests/qtest/migration-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +2 -2
index 3a711bb4929..c32a2aa30a2 100644
@@ -1408,7 +1408,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
         (access("/sys/module/kvm_hv", F_OK) ||
-         access("/dev/kvm", R_OK | W_OK))) {
+         access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm"))) {
         g_test_message("Skipping test: kvm_hv not available");
         return g_test_run();
     }
@@ -1419,7 +1419,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "s390x")) {
 #if defined(HOST_S390X)
-        if (access("/dev/kvm", R_OK | W_OK)) {
+        if (access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm")) {
             g_test_message("Skipping test: kvm not available");
             return g_test_run();
         }
Reviewed-by on v4 9/12
#28 lore raw

Re: [PATCH v4 09/12] qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64

In reply to Philippe Mathieu-Daudé
Quoted 14 lines · On Thu, 15 Apr 2021 18:33:01 +0200 Philippe Mathieu-Daudé <[email protected]>…

We might have a s390x/ppc64 QEMU binary built without the KVM accelerator (configured with --disable-kvm).
Checking for /dev/kvm accessibility isn't enough, also check for the accelerator in the binary.

---
Cc: David Gibson <[email protected]>
Cc: Greg Kurz <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines
---
 tests/qtest/migration-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by on v4 9/12
#29 lore raw

Re: [PATCH v4 09/12] qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64

In reply to Philippe Mathieu-Daudé
Quoted 32 lines · Philippe Mathieu-Daudé

We might have a s390x/ppc64 QEMU binary built without the KVM accelerator (configured with --disable-kvm).
Checking for /dev/kvm accessibility isn't enough, also check for the accelerator in the binary.

---
Cc: David Gibson <[email protected]>
Cc: Greg Kurz <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 tests/qtest/migration-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +1 -1
index 3a711bb4929..c32a2aa30a2 100644
@@ -1408,7 +1408,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
         (access("/sys/module/kvm_hv", F_OK) ||
-         access("/dev/kvm", R_OK | W_OK))) {
+         access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm"))) {
         g_test_message("Skipping test: kvm_hv not available");
         return g_test_run();
     }

tests/qtest/migration-test.c int main(int argc, char **argv) · line 1425

Quoted 8 lines
tests/qtest/migration-test.c +1 -1
@@ -1419,7 +1419,7 @@ int main(int argc, char **argv)
      */
     if (g_str_equal(qtest_get_arch(), "s390x")) {
 #if defined(HOST_S390X)
-        if (access("/dev/kvm", R_OK | W_OK)) {
+        if (access("/dev/kvm", R_OK | W_OK) || !qtest_has_accel("kvm")) {
             g_test_message("Skipping test: kvm not available");
             return g_test_run();
         }
Signature · 1 line
Alex Bennée
#30 lore raw

PATCH v4 10/12 qtest/qmp-cmd-test: Make test build-independent from accelerator

In reply to Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +14 -4
index c98b78d0339..8902d2f169f 100644
@@ -21,19 +21,24 @@ const char common_args[] = "-nodefaults -machine none";
 
 /* Query smoke tests */
 
+static bool tcg_accel_available;
+
 static int query_error_class(const char *cmd)
 {
-    static struct {
+    static const struct {
         const char *cmd;
         int err_class;
+        /*
+         * Pointer to boolean.
+         * If non-NULL and value is %true, the error class is skipped.
+         */
+        bool *skip_err_class;
     } fails[] = {
         /* Success depends on build configuration: */
 #ifndef CONFIG_SPICE
         { "query-spice", ERROR_CLASS_COMMAND_NOT_FOUND },
 #endif
-#ifndef CONFIG_TCG
-        { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND },
-#endif
+        { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND, &tcg_accel_available },
 #ifndef CONFIG_VNC
         { "query-vnc", ERROR_CLASS_GENERIC_ERROR },
         { "query-vnc-servers", ERROR_CLASS_GENERIC_ERROR },
@@ -51,6 +56,9 @@ static int query_error_class(const char *cmd)
     int i;
 
     for (i = 0; fails[i].cmd; i++) {
+        if (fails[i].skip_err_class && *fails[i].skip_err_class) {
+            continue;
+        }
         if (!strcmp(cmd, fails[i].cmd)) {
             return fails[i].err_class;
         }
@@ -334,6 +342,8 @@ int main(int argc, char *argv[])
     QmpSchema schema;
     int ret;
 
+    tcg_accel_available = qtest_has_accel("tcg");
+
     g_test_init(&argc, &argv, NULL);
 
     qmp_schema_init(&schema);
Signature · 1 line
2.26.3
#31 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Hi Thomas, Markus, do you mind reviewing this one please?

Quoted 64 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +14 -4
index c98b78d0339..8902d2f169f 100644
@@ -21,19 +21,24 @@ const char common_args[] = "-nodefaults -machine none";
 
 /* Query smoke tests */
 
+static bool tcg_accel_available;
+
 static int query_error_class(const char *cmd)
 {
-    static struct {
+    static const struct {
         const char *cmd;
         int err_class;
+        /*
+         * Pointer to boolean.
+         * If non-NULL and value is %true, the error class is skipped.
+         */
+        bool *skip_err_class;
     } fails[] = {
         /* Success depends on build configuration: */
 #ifndef CONFIG_SPICE
         { "query-spice", ERROR_CLASS_COMMAND_NOT_FOUND },
 #endif
-#ifndef CONFIG_TCG
-        { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND },
-#endif
+        { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND, &tcg_accel_available },
 #ifndef CONFIG_VNC
         { "query-vnc", ERROR_CLASS_GENERIC_ERROR },
         { "query-vnc-servers", ERROR_CLASS_GENERIC_ERROR },
@@ -51,6 +56,9 @@ static int query_error_class(const char *cmd)
     int i;
 
     for (i = 0; fails[i].cmd; i++) {
+        if (fails[i].skip_err_class && *fails[i].skip_err_class) {
+            continue;
+        }
         if (!strcmp(cmd, fails[i].cmd)) {
             return fails[i].err_class;
         }
@@ -334,6 +342,8 @@ int main(int argc, char *argv[])
     QmpSchema schema;
     int ret;
 
+    tcg_accel_available = qtest_has_accel("tcg");
+
     g_test_init(&argc, &argv, NULL);
 
     qmp_schema_init(&schema);
#32 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 12 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +0 -0
index c98b78d0339..8902d2f169f 100644
@@ -21,19 +21,24 @@ const char common_args[] = "-nodefaults -machine none";
 
 /* Query smoke tests */
 

tests/qtest/qmp-cmd-test.c const char common_args[] = "-nodefaults -machine none"; · line 32

Quoted 10 lines
tests/qtest/qmp-cmd-test.c +5 -1
+static bool tcg_accel_available;
+
 static int query_error_class(const char *cmd)
 {
-    static struct {
+    static const struct {
         const char *cmd;
         int err_class;
+        /*
+         * Pointer to boolean.

Let's not paraphrase code in comments.

tests/qtest/qmp-cmd-test.c const char common_args[] = "-nodefaults -machine none"; · line 33

Quoted 1 line
tests/qtest/qmp-cmd-test.c +1 -0
+         * If non-NULL and value is %true, the error class is skipped.

Suggest "When it points to true, the test case is skipped", and ...

tests/qtest/qmp-cmd-test.c const char common_args[] = "-nodefaults -machine none"; · line 35

Quoted 2 lines
tests/qtest/qmp-cmd-test.c +2 -0
+         */
+        bool *skip_err_class;

... name this just @skip. Or maybe @skip_ptr, because fails[i].skip reads as if the test case was to be skipped.

tests/qtest/qmp-cmd-test.c const char common_args[] = "-nodefaults -machine none"; · line 37

Quoted 2 lines
tests/qtest/qmp-cmd-test.c +0 -0
     } fails[] = {
         /* Success depends on build configuration: */

Note the headline ^^^

tests/qtest/qmp-cmd-test.c const char common_args[] = "-nodefaults -machine none"; · line 41

Quoted 7 lines
tests/qtest/qmp-cmd-test.c +1 -3
 #ifndef CONFIG_SPICE
         { "query-spice", ERROR_CLASS_COMMAND_NOT_FOUND },
 #endif
-#ifndef CONFIG_TCG
-        { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND },
-#endif
+        { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND, &tcg_accel_available },

No longer fits under the headline. Move it under its own headline, perhaps

           /* Success depends on dynamic state as reported by other queries */
Quoted 14 lines
tests/qtest/qmp-cmd-test.c +3 -0
 #ifndef CONFIG_VNC
         { "query-vnc", ERROR_CLASS_GENERIC_ERROR },
         { "query-vnc-servers", ERROR_CLASS_GENERIC_ERROR },
@@ -51,6 +56,9 @@ static int query_error_class(const char *cmd)
     int i;
 
     for (i = 0; fails[i].cmd; i++) {
+        if (fails[i].skip_err_class && *fails[i].skip_err_class) {
+            continue;
+        }
         if (!strcmp(cmd, fails[i].cmd)) {
             return fails[i].err_class;
         }

tests/qtest/qmp-cmd-test.c int main(int argc, char *argv[]) · line 346

Quoted 5 lines
tests/qtest/qmp-cmd-test.c +2 -0
@@ -334,6 +342,8 @@ int main(int argc, char *argv[])
     QmpSchema schema;
     int ret;
 
+    tcg_accel_available = qtest_has_accel("tcg");
+

When does tcg_accel_available differ from defined(CONFIG_TCG)?

Quoted 3 lines
tests/qtest/qmp-cmd-test.c +0 -0
     g_test_init(&argc, &argv, NULL);
 
     qmp_schema_init(&schema);
#33 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Quoted 13 lines · Markus Armbruster
Quoted 7 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 8 lines

tests/qtest/qmp-cmd-test.c int main(int argc, char *argv[]) · line 346

Quoted 6 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +2 -0
+    tcg_accel_available = qtest_has_accel("tcg");
+

When does tcg_accel_available differ from defined(CONFIG_TCG)?

qtest_has_accel("tcg") is a runtime check, while defined(CONFIG_TCG) is build-time.

Having tests doing runtime checking allow to:

- have easier reviews, having less #ifdef'ry
- build them once for all targets
- build them once for all ./configure options
(thinking about CI, the a single job could build the tests, then we run them using the QEMU binaries from other jobs)
- use the same binaries to test the built binary and the distribution installed one
- remove the dependencies between tests and binaries

Quoted 5 lines
Quoted 4 lines
     g_test_init(&argc, &argv, NULL);
 
     qmp_schema_init(&schema);
#34 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Markus Armbruster
Quoted 7 lines · Philippe Mathieu-Daudé

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 3 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 4 lines

tests/qtest/qmp-cmd-test.c int main(int argc, char *argv[]) · line 346

Quoted 2 lines
tests/qtest/qmp-cmd-test.c +2 -0
+    tcg_accel_available = qtest_has_accel("tcg");
+

When does tcg_accel_available differ from defined(CONFIG_TCG)?

qtest_has_accel("tcg") is a runtime check, while defined(CONFIG_TCG) is build-time.

Let me rephrase my question: under what conditions can the values of qtest_has_accel("tcg") and defined(CONFIG_TCG) differ?

Quoted 16 lines

Having tests doing runtime checking allow to:

- have easier reviews, having less #ifdef'ry
- build them once for all targets
- build them once for all ./configure options
(thinking about CI, the a single job could build the tests, then we run them using the QEMU binaries from other jobs)
- use the same binaries to test the built binary and the distribution installed one
- remove the dependencies between tests and binaries

Quoted 5 lines
Quoted 4 lines
     g_test_init(&argc, &argv, NULL);
 
     qmp_schema_init(&schema);
#35 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Quoted 19 lines · Markus Armbruster
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 18 lines
Quoted 7 lines

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 6 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +2 -0
+    tcg_accel_available = qtest_has_accel("tcg");
+
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

When does tcg_accel_available differ from defined(CONFIG_TCG)?

qtest_has_accel("tcg") is a runtime check, while defined(CONFIG_TCG) is build-time.

Let me rephrase my question: under what conditions can the values of qtest_has_accel("tcg") and defined(CONFIG_TCG) differ?

They are currently the same, so this patch is a no-op. *But* it allows us to remove the global dependence on CONFIG_TCG in the Meson machinery (see the last commit in this series).

Is that missing part of the commit description?

"This will allow us to remove the global CONFIG_TCG dependency in our Meson machinery in a pair of commits."?

Quoted 17 lines
Quoted 16 lines

Having tests doing runtime checking allow to:

- have easier reviews, having less #ifdef'ry
- build them once for all targets
- build them once for all ./configure options
(thinking about CI, the a single job could build the tests, then we run them using the QEMU binaries from other jobs)
- use the same binaries to test the built binary and the distribution installed one
- remove the dependencies between tests and binaries

Quoted 5 lines
Quoted 4 lines
     g_test_init(&argc, &argv, NULL);
 
     qmp_schema_init(&schema);
#36 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 19 lines · Markus Armbruster
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 18 lines
Quoted 7 lines

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 6 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +2 -0
+    tcg_accel_available = qtest_has_accel("tcg");
+
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

When does tcg_accel_available differ from defined(CONFIG_TCG)?

qtest_has_accel("tcg") is a runtime check, while defined(CONFIG_TCG) is build-time.

Let me rephrase my question: under what conditions can the values of qtest_has_accel("tcg") and defined(CONFIG_TCG) differ?

Quoted 8 lines

They are currently the same, so this patch is a no-op. *But* it allows us to remove the global dependence on CONFIG_TCG in the Meson machinery (see the last commit in this series).

Is that missing part of the commit description?

"This will allow us to remove the global CONFIG_TCG dependency in our Meson machinery in a pair of commits."?

Do you mean "in the next two commits"?

Please also note that the probing at run-time always gives the same result as the compile-time check it replaces.

I don't understand what exactly the conversion to probing enables and how, but I believe I don't have to.

[...]

#37 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Quoted 33 lines · Markus Armbruster
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 19 lines · Markus Armbruster
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 18 lines
Quoted 7 lines

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 6 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
tests/qtest/qmp-cmd-test.c +2 -0
+    tcg_accel_available = qtest_has_accel("tcg");
+
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

When does tcg_accel_available differ from defined(CONFIG_TCG)?

qtest_has_accel("tcg") is a runtime check, while defined(CONFIG_TCG) is build-time.

Let me rephrase my question: under what conditions can the values of qtest_has_accel("tcg") and defined(CONFIG_TCG) differ?

They are currently the same, so this patch is a no-op. *But* it allows us to remove the global dependence on CONFIG_TCG in the Meson machinery (see the last commit in this series).

Quoted 6 lines
Quoted 4 lines

Is that missing part of the commit description?

"This will allow us to remove the global CONFIG_TCG dependency in our Meson machinery in a pair of commits."?

Do you mean "in the next two commits"?

Yes.

Quoted 5 lines

Please also note that the probing at run-time always gives the same result as the compile-time check it replaces.

I don't understand what exactly the conversion to probing enables and how, but I believe I don't have to.

This series is removing some limitations in qtests to help Claudio work:

x86: https://www.mail-archive.com/[email protected]/msg793885.html
arm: https://www.mail-archive.com/[email protected]/msg799328.html
s390x: https://www.mail-archive.com/[email protected]/msg800254.html

which allow building with different sets of accelerators (and more).

Claudio/Paolo could better explain :)

What I like from feature tested at runtime is we can run qtests using older binaries, binaries built with different configure flags, or the binaries installed by the distribution.

Thanks,

Phil.

#38 lore raw

Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator

Quoted 51 lines · Philippe Mathieu-Daudé
Quoted 33 lines · Markus Armbruster
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 19 lines · Markus Armbruster
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 18 lines
Quoted 7 lines

Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run.
We can then replace the #ifdef'ry by a runtime check.

Please read the last remark first. The other ones are detail; feel free to skip them until we're done with the last one.

Quoted 6 lines
---
 tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
(quoted diff) +2 -0
+    tcg_accel_available = qtest_has_accel("tcg");
+
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

When does tcg_accel_available differ from defined(CONFIG_TCG)?

qtest_has_accel("tcg") is a runtime check, while defined(CONFIG_TCG) is build-time.

Let me rephrase my question: under what conditions can the values of qtest_has_accel("tcg") and defined(CONFIG_TCG) differ?

They are currently the same, so this patch is a no-op. *But* it allows us to remove the global dependence on CONFIG_TCG in the Meson machinery (see the last commit in this series).

Quoted 6 lines
Quoted 4 lines

Is that missing part of the commit description?

"This will allow us to remove the global CONFIG_TCG dependency in our Meson machinery in a pair of commits."?

Do you mean "in the next two commits"?

Yes.

Quoted 5 lines

Please also note that the probing at run-time always gives the same result as the compile-time check it replaces.

I don't understand what exactly the conversion to probing enables and how, but I believe I don't have to.

This series is removing some limitations in qtests to help Claudio work:

Quoted 7 lines

x86: https://www.mail-archive.com/[email protected]/msg793885.html
arm: https://www.mail-archive.com/[email protected]/msg799328.html
s390x: https://www.mail-archive.com/[email protected]/msg800254.html

which allow building with different sets of accelerators (and more).

Claudio/Paolo could better explain :)

Will this lead to different values of qtest_has_accel("tcg") and defined(CONFIG_TCG) within a single build tree?

Quoted 3 lines

What I like from feature tested at runtime is we can run qtests using older binaries, binaries built with different configure flags, or the binaries installed by the distribution.

Running with binaries build from a different HEAD seems unlikely to be useful. Any failures are just as likely to be caused bu the version mismatch as by actual bugs. Binaries for the same HEAD built for another configuration can be made to work (this patch doesn't yet suffice), but why should I care?

What I don't like is yet another moving part.

I'm not sure this is a good trade. Quite possibly because I still don't fully understand what we're trying to accomplish here :)

#39 lore raw

PATCH v4 11/12 tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore

In reply to Philippe Mathieu-Daudé

Since commit 82bf7ae84ce ("target/arm: Remove KVM support for 32-bit Arm hosts") we can remove the comment / check added in commit ab6b6a77774 and directly run the bios-tables-test.

---
 tests/qtest/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/qtest/meson.build +1 -2
index 0c767389217..46de073d155 100644
@@ -175,14 +175,13 @@
    'boot-serial-test',
    'hexloader-test']
 
-# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
 qtests_aarch64 = \
-  (cpu != 'arm' ? ['bios-tables-test'] : []) +                                                  \
   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
   ['arm-cpu-features',
    'numa-test',
    'boot-serial-test',
+   'bios-tables-test',
    'xlnx-can-test',
    'migration-test']
 
Signature · 1 line
2.26.3
Reviewed-by Tested-by on v4 11/12
#40 lore raw

Re: [PATCH v4 11/12] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore

Quoted 19 lines · Philippe Mathieu-Daudé

Since commit 82bf7ae84ce ("target/arm: Remove KVM support for 32-bit Arm hosts") we can remove the comment / check added in commit ab6b6a77774 and directly run the bios-tables-test.

---
 tests/qtest/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/qtest/meson.build +0 -1
index 0c767389217..46de073d155 100644
@@ -175,14 +175,13 @@
    'boot-serial-test',
    'hexloader-test']
 
-# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make
Quoted 1 line

bios-tables-test unconditional

Yeah this one has been fixed for some time I reckon. Once I fixed my cross compile detection scripts I was able to run them all with 32 bit ARM binaries.

Quoted 10 lines

qtests_aarch64 = \

tests/qtest/meson.build +1 -1
-  (cpu != 'arm' ? ['bios-tables-test'] : []) +                                                  \
   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
   ['arm-cpu-features',
    'numa-test',
    'boot-serial-test',
+   'bios-tables-test',
    'xlnx-can-test',
    'migration-test']
Signature · 1 line
Alex Bennée
#41 lore raw

PATCH v4 12/12 tests/meson: Only build softfloat objects if TCG is selected

In reply to Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as expected, as we still have CONFIG_TCG=1 when using:

  configure --disable-system --disable-user

Now than we have removed the use of CONFIG_TCG from target-dependent files in tests/qtest/, we can remove the unconditional definition of CONFIG_TCG in config_host.

This avoid to build a bunch of unrequired objects when building with --disable-tcg (in particular the softfloat tests):

Before:

  $ make
  [1/812] Generating trace-qom.h with a custom command
  ...

After:

  $ make
  [1/349] Generating trace-qom.h with a custom command
  ...

A difference of 463 objects...

---
v3: Include Paolo's feedback:
https://www.mail-archive.com/[email protected]/msg793872.html
therefore o not include Alex's R-b tag.

Cc Richard Henderson <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Emilio G. Cota <[email protected]>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)
meson.build +0 -1
index c6f4b0cf5e8..623cbe50685 100644
@@ -262,7 +262,6 @@
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
-  config_host += { 'CONFIG_TCG': 'y' }
 endif
 
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
Signature · 1 line
2.26.3
#42 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

Alex, Richard, do you mind reviewing this one please?

Quoted 56 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as expected, as we still have CONFIG_TCG=1 when using:

  configure --disable-system --disable-user

Now than we have removed the use of CONFIG_TCG from target-dependent files in tests/qtest/, we can remove the unconditional definition of CONFIG_TCG in config_host.

This avoid to build a bunch of unrequired objects when building with --disable-tcg (in particular the softfloat tests):

Before:

  $ make
  [1/812] Generating trace-qom.h with a custom command
  ...

After:

  $ make
  [1/349] Generating trace-qom.h with a custom command
  ...

A difference of 463 objects...

---
v3: Include Paolo's feedback:
https://www.mail-archive.com/[email protected]/msg793872.html
therefore o not include Alex's R-b tag.

Cc Richard Henderson <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Emilio G. Cota <[email protected]>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)
meson.build +0 -1
index c6f4b0cf5e8..623cbe50685 100644
@@ -262,7 +262,6 @@
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
-  config_host += { 'CONFIG_TCG': 'y' }
 endif
 
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
#43 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

Quoted 1 line · Philippe Mathieu-Daudé

Alex, Richard, do you mind reviewing this one please?

Isn't it already merged (with my r-b tag no less ;-)

f77147cd4de8c726f89b2702f7a9d0c9711d8875
Author: Philippe Mathieu-Daudé <[email protected]>
AuthorDate: Fri Jan 22 21:44:31 2021 +0100
Commit: Paolo Bonzini <[email protected]>
CommitDate: Mon Feb 8 14:43:55 2021 +0100

Quoted 58 lines · Philippe Mathieu-Daudé
Quoted 56 lines

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as expected, as we still have CONFIG_TCG=1 when using:

  configure --disable-system --disable-user

Now than we have removed the use of CONFIG_TCG from target-dependent files in tests/qtest/, we can remove the unconditional definition of CONFIG_TCG in config_host.

This avoid to build a bunch of unrequired objects when building with --disable-tcg (in particular the softfloat tests):

Before:

  $ make
  [1/812] Generating trace-qom.h with a custom command
  ...

After:

  $ make
  [1/349] Generating trace-qom.h with a custom command
  ...

A difference of 463 objects...

---
v3: Include Paolo's feedback:
https://www.mail-archive.com/[email protected]/msg793872.html
therefore o not include Alex's R-b tag.

Cc Richard Henderson <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Emilio G. Cota <[email protected]>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)
meson.build +0 -1
index c6f4b0cf5e8..623cbe50685 100644
@@ -262,7 +262,6 @@
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
-  config_host += { 'CONFIG_TCG': 'y' }
 endif
 
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
Signature · 1 line
Alex Bennée
#44 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

Quoted 7 lines · Alex Bennée
Quoted 1 line · Philippe Mathieu-Daudé

Alex, Richard, do you mind reviewing this one please?

Isn't it already merged (with my r-b tag no less ;-)

f77147cd4de8c726f89b2702f7a9d0c9711d8875

See ...

Quoted 10 lines

Author: Philippe Mathieu-Daudé <[email protected]>
AuthorDate: Fri Jan 22 21:44:31 2021 +0100
Commit: Paolo Bonzini <[email protected]>
CommitDate: Mon Feb 8 14:43:55 2021 +0100

Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 3 lines

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as

... ^ this comment :(

Quoted 55 lines
Quoted 53 lines
Quoted 53 lines

expected, as we still have CONFIG_TCG=1 when using:

  configure --disable-system --disable-user

Now than we have removed the use of CONFIG_TCG from target-dependent files in tests/qtest/, we can remove the unconditional definition of CONFIG_TCG in config_host.

This avoid to build a bunch of unrequired objects when building with --disable-tcg (in particular the softfloat tests):

Before:

  $ make
  [1/812] Generating trace-qom.h with a custom command
  ...

After:

  $ make
  [1/349] Generating trace-qom.h with a custom command
  ...

A difference of 463 objects...

---
v3: Include Paolo's feedback:
https://www.mail-archive.com/[email protected]/msg793872.html
therefore o not include Alex's R-b tag.

Cc Richard Henderson <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Emilio G. Cota <[email protected]>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)
meson.build +0 -1
index c6f4b0cf5e8..623cbe50685 100644
@@ -262,7 +262,6 @@
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
-  config_host += { 'CONFIG_TCG': 'y' }
 endif
 
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
#45 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
Quoted 1 line · Philippe Mathieu-Daudé

Alex, Richard, do you mind reviewing this one please?

Isn't it already merged (with my r-b tag no less ;-)

f77147cd4de8c726f89b2702f7a9d0c9711d8875

See ...

Quoted 6 lines

Author: Philippe Mathieu-Daudé <[email protected]>
AuthorDate: Fri Jan 22 21:44:31 2021 +0100
Commit: Paolo Bonzini <[email protected]>
CommitDate: Mon Feb 8 14:43:55 2021 +0100

Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 3 lines

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as

... ^ this comment :(

Ahh - my tooling was confused having searched by the subject title ;-)

Quoted 56 lines
Quoted 56 lines
Quoted 54 lines
Quoted 54 lines

expected, as we still have CONFIG_TCG=1 when using:

  configure --disable-system --disable-user

Now than we have removed the use of CONFIG_TCG from target-dependent files in tests/qtest/, we can remove the unconditional definition of CONFIG_TCG in config_host.

This avoid to build a bunch of unrequired objects when building with --disable-tcg (in particular the softfloat tests):

Before:

  $ make
  [1/812] Generating trace-qom.h with a custom command
  ...

After:

  $ make
  [1/349] Generating trace-qom.h with a custom command
  ...

A difference of 463 objects...

---
v3: Include Paolo's feedback:
https://www.mail-archive.com/[email protected]/msg793872.html
therefore o not include Alex's R-b tag.

Cc Richard Henderson <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Emilio G. Cota <[email protected]>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)
meson.build +0 -1
index c6f4b0cf5e8..623cbe50685 100644
@@ -262,7 +262,6 @@
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
-  config_host += { 'CONFIG_TCG': 'y' }
 endif
 
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
Signature · 1 line
Alex Bennée
#46 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

Quoted 20 lines · Alex Bennée
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
Quoted 1 line · Philippe Mathieu-Daudé

Alex, Richard, do you mind reviewing this one please?

Isn't it already merged (with my r-b tag no less ;-)

f77147cd4de8c726f89b2702f7a9d0c9711d8875

See ...

Quoted 6 lines

Author: Philippe Mathieu-Daudé <[email protected]>
AuthorDate: Fri Jan 22 21:44:31 2021 +0100
Commit: Paolo Bonzini <[email protected]>
CommitDate: Mon Feb 8 14:43:55 2021 +0100

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 3 lines

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as

... ^ this comment :(

Ahh - my tooling was confused having searched by the subject title ;-)

Oh I see, I'll rename as:
"tests/meson: Only build softfloat objects if TCG is selected (again)".

#47 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Alex Bennée
Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Alex Bennée
Quoted 1 line · Philippe Mathieu-Daudé

Alex, Richard, do you mind reviewing this one please?

Isn't it already merged (with my r-b tag no less ;-)

f77147cd4de8c726f89b2702f7a9d0c9711d8875

See ...

Quoted 9 lines

Author: Philippe Mathieu-Daudé <[email protected]>
AuthorDate: Fri Jan 22 21:44:31 2021 +0100
Commit: Paolo Bonzini <[email protected]>
CommitDate: Mon Feb 8 14:43:55 2021 +0100

Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 2 lines

From: Philippe Mathieu-Daudé <[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

The previous attempt (commit f77147cd4de) doesn't work as

... ^ this comment :(

Ahh - my tooling was confused having searched by the subject title ;-)

Oh I see, I'll rename as:
"tests/meson: Only build softfloat objects if TCG is selected (again)".

BTW you indeed reviewed/tested v1 of this patch:
https://www.mail-archive.com/[email protected]/msg793900.html
but after addressing Paolo's comments I preferred to remove your tags.

#48 lore raw

Re: [PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected

In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

The previous attempt (commit f77147cd4de) doesn't work as expected, as we still have CONFIG_TCG=1 when using:

Quoted 8 lines
  configure --disable-system --disable-user

Now than we have removed the use of CONFIG_TCG from target-dependent files in tests/qtest/, we can remove the unconditional definition of CONFIG_TCG in config_host.

This avoid to build a bunch of unrequired objects when building with --disable-tcg (in particular the softfloat tests):

Hmm something else gets broken because I bisected a check-tcg failure to this commit:

timeout --foreground 15 /home/alex.bennee/lsrc/qemu.git/builds/bisect/qemu-system-aarch64 -monitor none -display none -chardev file,path=memory-record.out,id=output -icount shift=5,rr=record,rrfile=record.bin -M virt -cpu max -display none -semihosting-config enable=on,target=native,chardev=output -kernel memory
qemu-system-aarch64: Please enable icount to use record/replay
/home/alex.bennee/lsrc/qemu.git/tests/tcg/aarch64/Makefile.softmmu-target:49: recipe for target 'run-memory-record' failed
make[2]: *** [run-memory-record] Error 1
make[2]: Leaving directory '/home/alex.bennee/lsrc/qemu.git/builds/bisect/tests/tcg/aarch64-softmmu'
/home/alex.bennee/lsrc/qemu.git/tests/tcg/Makefile.qemu:102: recipe for target 'run-guest-tests' failed
make[1]: *** [run-guest-tests] Error 2
make[1]: Leaving directory '/home/alex.bennee/lsrc/qemu.git/builds/bisect'
/home/alex.bennee/lsrc/qemu.git/tests/Makefile.include:63: recipe for target 'run-tcg-tests-aarch64-softmmu' failed
make: *** [run-tcg-tests-aarch64-softmmu] Error 2

So it looks like it breaks icount somehow.

Quoted 42 lines

Before:

  $ make
  [1/812] Generating trace-qom.h with a custom command
  ...

After:

  $ make
  [1/349] Generating trace-qom.h with a custom command
  ...

A difference of 463 objects...

---
v3: Include Paolo's feedback:
https://www.mail-archive.com/[email protected]/msg793872.html
therefore o not include Alex's R-b tag.

Cc Richard Henderson <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Emilio G. Cota <[email protected]>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)
meson.build +0 -1
index c6f4b0cf5e8..623cbe50685 100644
@@ -262,7 +262,6 @@
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
-  config_host += { 'CONFIG_TCG': 'y' }
 endif
 
 if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled()
Signature · 1 line
Alex Bennée