Skip to contentSkip to conversation

Only generate cluster node in PPTT when specified

PATCH Superseded Yicong Yang via 2 participants 14 messages Oct 31, 2022

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Only generate cluster node in PPTT when specified

From: Yicong Yang <[email protected]>

This series mainly change the policy for building a cluster topology node in PPTT. Previously we'll always build a cluster node in PPTT without asking the user, after this set the cluster node will be built only the the user specify through "-smp clusters=X".

One problem is related to this but not fully caused by this, see the discussion in [*]. When booting the VM with -smp 8 and 4 numa nodes, the linux scheduling domains in the VM misses the NUMA domains. It's because the MC level span extends to Cluster level (which is generated by the Qemu by default) that spans all the cpus in the system, then the scheduling domain building stops at MC level since it already includes all the cpus.

Considering cluster is an optional level and most platforms don't have it, they may even don't realize this is built and a always build policy cannot emulate the topology on these platforms. So in this series improve the policy to only generate cluster when the user explicitly want.

Update the tests and test tables accordingly.

[*] https://lore.kernel.org/lkml/[email protected]/

Change since v2:
- Add tag from Micheal, thanks
- Handle the tests changes with bios-tables-test-allowed-diff.h, Per Micheal
- Address the comments per Yanan

Change since v1:
- Only includes the test tables which is really needed
- Enrich the commit

Yicong Yang (5):
hw/acpi/aml-build: Only generate cluster node in PPTT when specified
tests: virt: update expected ACPI tables for virt test
tests: acpi: add and whitelist *.topology blobs
tests: acpi: aarch64: add topology test for aarch64
tests: acpi: aarch64: add *.topology tables

 hw/acpi/aml-build.c                |   2 +-
 hw/core/machine-smp.c              |   3 +++
 include/hw/boards.h                |   3 +++
 qemu-options.hx                    |   3 +++
 tests/data/acpi/virt/APIC.topology | Bin 0 -> 700 bytes
 tests/data/acpi/virt/DSDT.topology | Bin 0 -> 5398 bytes
 tests/data/acpi/virt/PPTT          | Bin 96 -> 76 bytes
 tests/data/acpi/virt/PPTT.topology | Bin 0 -> 336 bytes
 tests/qtest/bios-tables-test.c     |  22 ++++++++++++++++++++++
 9 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 tests/data/acpi/virt/APIC.topology
 create mode 100644 tests/data/acpi/virt/DSDT.topology
 create mode 100644 tests/data/acpi/virt/PPTT.topology
Signature · 1 line
2.24.0
#1 lore raw

PATCH v3 1/5 hw/acpi/aml-build: Only generate cluster node in PPTT when specified

From: Yicong Yang <[email protected]>

Currently we'll always generate a cluster node no matter user has specified '-smp clusters=X' or not. Cluster is an optional level and will participant the building of Linux scheduling domains and only appears on a few platforms. It's unncessary to always build it which cannot reflect the real topology on platforms have no cluster and to avoid affecting the linux scheduling domains in the VM. So only generate it when user specified explicitly.

Tested qemu-system-aarch64 with -smp 8 and linux 6.1-rc1, without this patch:

estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff	# cluster_cpus
0-7	# cluster_cpus_list
56	# cluster_id

with this patch:

estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff	# cluster_cpus
0-7	# cluster_cpus_list
36	# cluster_id, with no cluster node kernel will make it to
	  physical package id
---
 hw/acpi/aml-build.c                         | 2 +-
 hw/core/machine-smp.c                       | 3 +++
 include/hw/boards.h                         | 3 +++
 qemu-options.hx                             | 3 +++
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +1 -1
index e6bfac95c7..60c1acf3da 100644
@@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
                 0, socket_id, NULL, 0);
         }
 
-        if (mc->smp_props.clusters_supported) {
+        if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
             if (cpus->cpus[n].props.cluster_id != cluster_id) {
                 assert(cpus->cpus[n].props.cluster_id > cluster_id);
                 cluster_id = cpus->cpus[n].props.cluster_id;
hw/core/machine-smp.c +3 -0
index b39ed21e65..9c8950b2b0 100644
@@ -158,6 +158,9 @@ void machine_parse_smp_config(MachineState *ms,
     ms->smp.threads = threads;
     ms->smp.max_cpus = maxcpus;
 
+    if (config->has_clusters)
+        mc->smp_props.has_clusters = true;
+
     /* sanity-check of the computed topology */
     if (sockets * dies * clusters * cores * threads != maxcpus) {
         g_autofree char *topo_msg = cpu_hierarchy_to_string(ms);
include/hw/boards.h +3 -0
index 311ed17e18..06ed66453f 100644
@@ -130,11 +130,14 @@ typedef struct {
  * @prefer_sockets - whether sockets are preferred over cores in smp parsing
  * @dies_supported - whether dies are supported by the machine
  * @clusters_supported - whether clusters are supported by the machine
+ * @has_clusters - whether clusters are explicitly specified in the user
+ *                 provided SMP configuration
  */
 typedef struct {
     bool prefer_sockets;
     bool dies_supported;
     bool clusters_supported;
+    bool has_clusters;
 } SMPCompatProps;
 
 /**
qemu-options.hx +3 -0
index eb38e5dc40..bbdbdef0af 100644
@@ -349,6 +349,9 @@ SRST
     ::
 
         -smp 2
+
+    Note: The cluster topology will only be generated in ACPI and exposed
+    to guest if it's explicitly specified in -smp.
 ERST
 
 DEF("numa", HAS_ARG, QEMU_OPTION_numa,
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
index dfb8523c8b..cb143a55a6 100644
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/PPTT",
Signature · 1 line
2.24.0
#2 lore raw

Re: [PATCH v3 1/5] hw/acpi/aml-build: Only generate cluster node in PPTT when specified

Quoted 10 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Currently we'll always generate a cluster node no matter user has specified '-smp clusters=X' or not. Cluster is an optional level and will participant the building of Linux scheduling domains and only appears on a few platforms.
It's unncessary to always build
it which cannot reflect the real topology on platforms have no cluster and to avoid affecting the linux scheduling domains in the VM.

This sentence is a bit confusing, better to re-organize it.

Quoted 1 line

So only generate it when user specified explicitly.

"So only generate the cluster topology in ACPI PPTT when the user has specified it explicitly in -smp." Will this be more clear?

Quoted 43 lines

Tested qemu-system-aarch64 with -smp 8 and linux 6.1-rc1, without this patch:

estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff	# cluster_cpus
0-7	# cluster_cpus_list
56	# cluster_id

with this patch:

estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff	# cluster_cpus
0-7	# cluster_cpus_list
36	# cluster_id, with no cluster node kernel will make it to
	  physical package id
---
  hw/acpi/aml-build.c                         | 2 +-
  hw/core/machine-smp.c                       | 3 +++
  include/hw/boards.h                         | 3 +++
  qemu-options.hx                             | 3 +++
  tests/qtest/bios-tables-test-allowed-diff.h | 1 +
  5 files changed, 11 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +1 -1
index e6bfac95c7..60c1acf3da 100644
@@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
                  0, socket_id, NULL, 0);
          }
 
-        if (mc->smp_props.clusters_supported) {
+        if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
              if (cpus->cpus[n].props.cluster_id != cluster_id) {
                  assert(cpus->cpus[n].props.cluster_id > cluster_id);
                  cluster_id = cpus->cpus[n].props.cluster_id;
hw/core/machine-smp.c +0 -0
index b39ed21e65..9c8950b2b0 100644

hw/core/machine-smp.c void machine_parse_smp_config(MachineState *ms, · line 163

Quoted 6 lines
hw/core/machine-smp.c +3 -0
@@ -158,6 +158,9 @@ void machine_parse_smp_config(MachineState *ms,
      ms->smp.threads = threads;
      ms->smp.max_cpus = maxcpus;
 
+    if (config->has_clusters)
+        mc->smp_props.has_clusters = true;
+

why not "mc->smp_props.has_clusters = config->has_clusters"?

Quoted 41 lines
hw/core/machine-smp.c +0 -0
      /* sanity-check of the computed topology */
      if (sockets * dies * clusters * cores * threads != maxcpus) {
          g_autofree char *topo_msg = cpu_hierarchy_to_string(ms);
include/hw/boards.h +3 -0
index 311ed17e18..06ed66453f 100644
@@ -130,11 +130,14 @@ typedef struct {
   * @prefer_sockets - whether sockets are preferred over cores in smp parsing
   * @dies_supported - whether dies are supported by the machine
   * @clusters_supported - whether clusters are supported by the machine
+ * @has_clusters - whether clusters are explicitly specified in the user
+ *                 provided SMP configuration
   */
  typedef struct {
      bool prefer_sockets;
      bool dies_supported;
      bool clusters_supported;
+    bool has_clusters;
  } SMPCompatProps;
 
  /**
qemu-options.hx +3 -0
index eb38e5dc40..bbdbdef0af 100644
@@ -349,6 +349,9 @@ SRST
      ::
 
          -smp 2
+
+    Note: The cluster topology will only be generated in ACPI and exposed
+    to guest if it's explicitly specified in -smp.
  ERST
 
  DEF("numa", HAS_ARG, QEMU_OPTION_numa,
tests/qtest/bios-tables-test-allowed-diff.h +0 -0
index dfb8523c8b..cb143a55a6 100644

tests/qtest/bios-tables-test-allowed-diff.h line 2

Quoted 2 lines
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
@@ -1 +1,2 @@
  /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/PPTT",

This change in bios-tables-test-allowed-diff.h should be in a standalone patch before this patch.

For your reference: see patch 4-6 in [1]:
https://patchew.org/QEMU/[email protected]/

Thanks,
Yanan

#3 lore raw

Re: [PATCH v3 1/5] hw/acpi/aml-build: Only generate cluster node in PPTT when specified

Quoted 12 lines · wangyanan (Y)
Quoted 10 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Currently we'll always generate a cluster node no matter user has specified '-smp clusters=X' or not. Cluster is an optional level and will participant the building of Linux scheduling domains and only appears on a few platforms.
It's unncessary to always build
it which cannot reflect the real topology on platforms have no cluster and to avoid affecting the linux scheduling domains in the VM.

Quoted 5 lines

This sentence is a bit confusing, better to re-organize it.

Quoted 1 line

So only generate it when user specified explicitly.

"So only generate the cluster topology in ACPI PPTT when the user has specified it explicitly in -smp." Will this be more clear?

ok. seems better.

will also address the comments below.

thanks.

Quoted 98 lines
Quoted 42 lines

Tested qemu-system-aarch64 with -smp 8 and linux 6.1-rc1, without this patch:

estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff    # cluster_cpus
0-7    # cluster_cpus_list
56    # cluster_id

with this patch:

estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff    # cluster_cpus
0-7    # cluster_cpus_list
36    # cluster_id, with no cluster node kernel will make it to
      physical package id

---
  hw/acpi/aml-build.c                         | 2 +- hw/core/machine-smp.c                       | 3 +++ include/hw/boards.h                         | 3 +++ qemu-options.hx                             | 3 +++ tests/qtest/bios-tables-test-allowed-diff.h | 1 +

  5 files changed, 11 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +1 -0
index e6bfac95c7..60c1acf3da 100644
@@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
                   0, socket_id, NULL, 0);
           }
   -        if (mc->smp_props.clusters_supported) {
+        if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
               if (cpus->cpus[n].props.cluster_id != cluster_id) {
                   assert(cpus->cpus[n].props.cluster_id > cluster_id);
                   cluster_id = cpus->cpus[n].props.cluster_id;
hw/core/machine-smp.c +0 -0
index b39ed21e65..9c8950b2b0 100644

hw/core/machine-smp.c void machine_parse_smp_config(MachineState *ms, · line 162

Quoted 5 lines
hw/core/machine-smp.c +2 -0
@@ -158,6 +158,9 @@ void machine_parse_smp_config(MachineState *ms,
       ms->smp.threads = threads;
       ms->smp.max_cpus = maxcpus;
   +    if (config->has_clusters)
+        mc->smp_props.has_clusters = true;
+

why not "mc->smp_props.has_clusters = config->has_clusters"?

Quoted 38 lines
hw/core/machine-smp.c +0 -0
       /* sanity-check of the computed topology */
       if (sockets * dies * clusters * cores * threads != maxcpus) {
           g_autofree char *topo_msg = cpu_hierarchy_to_string(ms);
include/hw/boards.h +3 -0
index 311ed17e18..06ed66453f 100644
@@ -130,11 +130,14 @@ typedef struct {
    * @prefer_sockets - whether sockets are preferred over cores in smp parsing
    * @dies_supported - whether dies are supported by the machine
    * @clusters_supported - whether clusters are supported by the machine
+ * @has_clusters - whether clusters are explicitly specified in the user
+ *                 provided SMP configuration
    */
   typedef struct {
       bool prefer_sockets;
       bool dies_supported;
       bool clusters_supported;
+    bool has_clusters;
   } SMPCompatProps;
     /**
qemu-options.hx +0 -0
index eb38e5dc40..bbdbdef0af 100644
@@ -349,6 +349,9 @@ SRST

      ::
            -smp 2
+
+    Note: The cluster topology will only be generated in ACPI and exposed +    to guest if it's explicitly specified in -smp.
  ERST
    DEF("numa", HAS_ARG, QEMU_OPTION_numa,

tests/qtest/bios-tables-test-allowed-diff.h +0 -0
index dfb8523c8b..cb143a55a6 100644

tests/qtest/bios-tables-test-allowed-diff.h line 2

Quoted 2 lines
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
@@ -1 +1,2 @@
   /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/PPTT",

This change in bios-tables-test-allowed-diff.h should be in a standalone patch before this patch.

For your reference: see patch 4-6 in [1]:
https://patchew.org/QEMU/[email protected]/

Thanks,
Yanan

.

#4 lore raw

PATCH v3 2/5 tests: virt: update expected ACPI tables for virt test

In reply to Yicong Yang via

From: Yicong Yang <[email protected]>

Update the ACPI tables according to the acpi aml_build change.

---
 tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 2 files changed, 1 deletion(-)
tests/data/acpi/virt/PPTT binary +0 -0
index f56ea63b369a604877374ad696c396e796ab1c83..7a1258ecf123555b24462c98ccbb76b4ac1d0c2b 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index cb143a55a6..dfb8523c8b 100644
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/PPTT",
Signature · 1 line
2.24.0
#5 lore raw

Re: [PATCH v3 2/5] tests: virt: update expected ACPI tables for virt test

Hi Yicong,

Quoted 3 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Update the ACPI tables according to the acpi aml_build change.

We may also need the disassembled context of the table change in the commit message, for review.

For your reference: see patch 6 in [1]:
https://patchew.org/QEMU/[email protected]/

Thanks,
Yanan

Quoted 23 lines
---
  tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
  tests/qtest/bios-tables-test-allowed-diff.h |   1 -
  2 files changed, 1 deletion(-)
tests/data/acpi/virt/PPTT binary +0 -0
index f56ea63b369a604877374ad696c396e796ab1c83..7a1258ecf123555b24462c98ccbb76b4ac1d0c2b 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index cb143a55a6..dfb8523c8b 100644
@@ -1,2 +1 @@
  /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/PPTT",
#6 lore raw

Re: [PATCH v3 2/5] tests: virt: update expected ACPI tables for virt test

Quoted 8 lines · wangyanan (Y)

Hi Yicong,

Quoted 3 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Update the ACPI tables according to the acpi aml_build change.

We may also need the disassembled context of the table change in the commit message, for review.

not just for review - in case it has to be rebased. also pls make sure to
- edit the diff for clarify only retaining relevant parts
- prefix the diff with some prefix e.g. leading space in each line to avoid confusing git

Quoted 28 lines

For your reference: see patch 6 in [1]:
https://patchew.org/QEMU/[email protected]/

Thanks,
Yanan

Quoted 23 lines
---
  tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
  tests/qtest/bios-tables-test-allowed-diff.h |   1 -
  2 files changed, 1 deletion(-)
tests/data/acpi/virt/PPTT binary +0 -0
index f56ea63b369a604877374ad696c396e796ab1c83..7a1258ecf123555b24462c98ccbb76b4ac1d0c2b 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index cb143a55a6..dfb8523c8b 100644
@@ -1,2 +1 @@
  /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/PPTT",
#7 lore raw

Re: [PATCH v3 2/5] tests: virt: update expected ACPI tables for virt test

In reply to wangyanan (Y) via
Quoted 7 lines · wangyanan (Y)

Hi Yicong,

Quoted 3 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Update the ACPI tables according to the acpi aml_build change.

We may also need the disassembled context of the table change

and it's not a "maybe need". We do need it.

Quoted 30 lines

in the commit message, for review.

For your reference: see patch 6 in [1]:
https://patchew.org/QEMU/[email protected]/

Thanks,
Yanan

Quoted 23 lines
---
  tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
  tests/qtest/bios-tables-test-allowed-diff.h |   1 -
  2 files changed, 1 deletion(-)
tests/data/acpi/virt/PPTT binary +0 -0
index f56ea63b369a604877374ad696c396e796ab1c83..7a1258ecf123555b24462c98ccbb76b4ac1d0c2b 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index cb143a55a6..dfb8523c8b 100644
@@ -1,2 +1 @@
  /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/PPTT",
#8 lore raw

Re: [PATCH v3 2/5] tests: virt: update expected ACPI tables for virt test

Hi Michael and Yanan,

Quoted 11 lines · Michael S. Tsirkin
Quoted 7 lines · wangyanan (Y)

Hi Yicong,

Quoted 3 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Update the ACPI tables according to the acpi aml_build change.

We may also need the disassembled context of the table change

and it's not a "maybe need". We do need it.

Got it. Let me check and attach these diff informations for all the test table changes in this series. Thanks for the guidance!

Thanks.

Quoted 33 lines
Quoted 23 lines

in the commit message, for review.

For your reference: see patch 6 in [1]:
https://patchew.org/QEMU/[email protected]/

Thanks,
Yanan

Quoted 16 lines
---
  tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
  tests/qtest/bios-tables-test-allowed-diff.h |   1 -
  2 files changed, 1 deletion(-)
tests/data/acpi/virt/PPTT binary +0 -0
index f56ea63b369a604877374ad696c396e796ab1c83..7a1258ecf123555b24462c98ccbb76b4ac1d0c2b 100644
GIT binary patch
Quoted 7 lines

tests/qtest/bios-tables-test-allowed-diff.h line 2

Quoted 7 lines
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index cb143a55a6..dfb8523c8b 100644
@@ -1,2 +1 @@
  /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/PPTT",

.

#9 lore raw

PATCH v3 3/5 tests: acpi: add and whitelist *.topology blobs

In reply to Yicong Yang via

From: Yicong Yang <[email protected]>

Add and whitelist *.topology blobs, prepares for the aarch64's ACPI topology building test.

---
 tests/data/acpi/virt/APIC.topology          | 0
 tests/data/acpi/virt/DSDT.topology          | 0
 tests/data/acpi/virt/PPTT.topology          | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 3 +++
 4 files changed, 3 insertions(+)
 create mode 100644 tests/data/acpi/virt/APIC.topology
 create mode 100644 tests/data/acpi/virt/DSDT.topology
 create mode 100644 tests/data/acpi/virt/PPTT.topology
tests/data/acpi/virt/APIC.topology new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/data/acpi/virt/DSDT.topology new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/data/acpi/virt/PPTT.topology new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/qtest/bios-tables-test-allowed-diff.h +3 -0
index dfb8523c8b..90f53f9c1d 100644
@@ -1 +1,4 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/APIC.topology",
+"tests/data/acpi/virt/DSDT.topology",
+"tests/data/acpi/virt/PPTT.topology",
Signature · 1 line
2.24.0
#10 lore raw

PATCH v3 4/5 tests: acpi: aarch64: add topology test for aarch64

In reply to Yicong Yang via

From: Yicong Yang <[email protected]>

Add test for aarch64's ACPI topology building for all the supported levels.

---
 tests/qtest/bios-tables-test.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
tests/qtest/bios-tables-test.c +22 -0
index e6096e7f73..099b723444 100644
@@ -1533,6 +1533,27 @@ static void test_acpi_virt_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_virt_tcg_topology(void)
+{
+    test_data data = {
+        .machine = "virt",
+        .variant = ".topology",
+        .tcg_only = true,
+        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+        .ram_start = 0x40000000ULL,
+        .scan_len = 128ULL * 1024 * 1024,
+    };
+
+    data.smbios_cpu_max_speed = 2900;
+    data.smbios_cpu_curr_speed = 2700;
+    test_acpi_one("-cpu cortex-a57 "
+                  "-smbios type=4,max-speed=2900,current-speed=2700 "
+                  "-smp sockets=1,clusters=2,cores=2,threads=2", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_viot(void)
 {
     test_data data = {
@@ -1864,6 +1885,7 @@ int main(int argc, char *argv[])
     } else if (strcmp(arch, "aarch64") == 0) {
         if (has_tcg) {
             qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+            qtest_add_func("acpi/virt/topology", test_acpi_virt_tcg_topology);
             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);
Signature · 1 line
2.24.0
#11 lore raw

Re: [PATCH v3 4/5] tests: acpi: aarch64: add topology test for aarch64

Hi Yicong,

Quoted 24 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Add test for aarch64's ACPI topology building for all the supported levels.

---
  tests/qtest/bios-tables-test.c | 22 ++++++++++++++++++++++
  1 file changed, 22 insertions(+)
tests/qtest/bios-tables-test.c +5 -0
index e6096e7f73..099b723444 100644
@@ -1533,6 +1533,27 @@ static void test_acpi_virt_tcg(void)
      free_test_data(&data);
  }
 
+static void test_acpi_virt_tcg_topology(void)
+{
+    test_data data = {
+        .machine = "virt",
+        .variant = ".topology",

tests/qtest/bios-tables-test.c static void test_acpi_virt_tcg(void) · line 1550

Quoted 10 lines
tests/qtest/bios-tables-test.c +10 -0
+        .tcg_only = true,
+        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+        .ram_start = 0x40000000ULL,
+        .scan_len = 128ULL * 1024 * 1024,
+    };
+
+    data.smbios_cpu_max_speed = 2900;
+    data.smbios_cpu_curr_speed = 2700;

I'm not sure. But why do we need this two lines? Can we keep the test as simple as test_acpi_virt_tcg_numamem and avoid unrelated parts.

Thanks,
Yanan

Quoted 17 lines
tests/qtest/bios-tables-test.c +7 -0
+    test_acpi_one("-cpu cortex-a57 "
+                  "-smbios type=4,max-speed=2900,current-speed=2700 "
+                  "-smp sockets=1,clusters=2,cores=2,threads=2", &data);
+    free_test_data(&data);
+}
+
  static void test_acpi_q35_viot(void)
  {
      test_data data = {
@@ -1864,6 +1885,7 @@ int main(int argc, char *argv[])
      } else if (strcmp(arch, "aarch64") == 0) {
          if (has_tcg) {
              qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+            qtest_add_func("acpi/virt/topology", test_acpi_virt_tcg_topology);
              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);
#12 lore raw

Re: [PATCH v3 4/5] tests: acpi: aarch64: add topology test for aarch64

Quoted 31 lines · wangyanan (Y)

Hi Yicong,

Quoted 28 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Add test for aarch64's ACPI topology building for all the supported levels.

---
  tests/qtest/bios-tables-test.c | 22 ++++++++++++++++++++++

  1 file changed, 22 insertions(+)
tests/qtest/bios-tables-test.c +9 -0
index e6096e7f73..099b723444 100644
@@ -1533,6 +1533,27 @@ static void test_acpi_virt_tcg(void)
       free_test_data(&data);
   }
   +static void test_acpi_virt_tcg_topology(void)
+{
+    test_data data = {
+        .machine = "virt",
+        .variant = ".topology",
+        .tcg_only = true,
+        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+        .ram_start = 0x40000000ULL,
Quoted 9 lines

tests/qtest/bios-tables-test.c static void test_acpi_virt_tcg(void) · line 1550

Quoted 5 lines
tests/qtest/bios-tables-test.c +5 -0
+        .scan_len = 128ULL * 1024 * 1024,
+    };
+
+    data.smbios_cpu_max_speed = 2900;
+    data.smbios_cpu_curr_speed = 2700;

I'm not sure. But why do we need this two lines? Can we keep the test as simple as test_acpi_virt_tcg_numamem and avoid unrelated parts.

I guess it's because my silly copy and paste... will make it simpler.

Quoted 21 lines

Thanks,
Yanan

Quoted 10 lines
tests/qtest/bios-tables-test.c +6 -0
+    test_acpi_one("-cpu cortex-a57 "
+                  "-smbios type=4,max-speed=2900,current-speed=2700 "
+                  "-smp sockets=1,clusters=2,cores=2,threads=2", &data);
+    free_test_data(&data);
+}
+
   static void test_acpi_q35_viot(void)
   {
       test_data data = {

tests/qtest/bios-tables-test.c int main(int argc, char *argv[]) · line 1891

Quoted 7 lines
tests/qtest/bios-tables-test.c +1 -0
@@ -1864,6 +1885,7 @@ int main(int argc, char *argv[])
       } else if (strcmp(arch, "aarch64") == 0) {
           if (has_tcg) {
               qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+            qtest_add_func("acpi/virt/topology", test_acpi_virt_tcg_topology);
               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);

.

#13 lore raw

PATCH v3 5/5 tests: acpi: aarch64: add *.topology tables

In reply to Yicong Yang via

From: Yicong Yang <[email protected]>

Add *.topology tables for the aarch64's topology test.

---
 tests/data/acpi/virt/APIC.topology          | Bin 0 -> 700 bytes
 tests/data/acpi/virt/DSDT.topology          | Bin 0 -> 5398 bytes
 tests/data/acpi/virt/PPTT.topology          | Bin 0 -> 336 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   3 ---
 4 files changed, 3 deletions(-)
tests/data/acpi/virt/APIC.topology binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..558a1856981531b0e18e6d4aa12569cd80aa0015 100644
GIT binary patch
tests/data/acpi/virt/DSDT.topology binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..501314c91be01d927fd125e0c72e919fdd85592e 100644
GIT binary patch
tests/data/acpi/virt/PPTT.topology binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3fbcae5ff08aaf16fedf4da45e941661d79c1174 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -3
index 90f53f9c1d..dfb8523c8b 100644
@@ -1,4 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/APIC.topology",
-"tests/data/acpi/virt/DSDT.topology",
-"tests/data/acpi/virt/PPTT.topology",
Signature · 1 line
2.24.0