Skip to contentSkip to conversation

ACPI/unit-test: Add a testcase

PATCH RESEND In review Dou Liyang 4 participants 13 messages Dec 14, 2017 – Jan 12, 2018

lore
Share & tools
lore

Dou Liyang

author
#0 lore raw

cover ACPI/unit-test: Add a testcase

These are the patches left over from the pull request:

[Qemu-devel] [PULL 0/9] x86 and machine queue, 2017-10-05

because of some errors when tested by "make check" command[1].

Now, the QEMU 2.11.0 has been released, rebase/retest/respin them for v2.12 dev.

Changelog:
--Rebase and retest this patch in v2.11.0
--Update the DSDT.numamem:

[1]: http://lists.gnu.org/archive/html/qemu-devel/2017-10/msg01334.html

Dou Liyang (2):
ACPI/unit-test: Add a testcase for RAM allocation in numa node hw/acpi-build: Make next_base easy to follow

 hw/i386/acpi-build.c                  |   2 +-
 tests/acpi-test-data/pc/DSDT.numamem  | Bin 0 -> 5150 bytes
 tests/acpi-test-data/pc/SRAT.numamem  | Bin 0 -> 224 bytes
 tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 7834 bytes
 tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 224 bytes
 tests/bios-tables-test.c              |  24 ++++++++++++++++++++++++
 6 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 tests/acpi-test-data/pc/DSDT.numamem
 create mode 100644 tests/acpi-test-data/pc/SRAT.numamem
 create mode 100644 tests/acpi-test-data/q35/DSDT.numamem
 create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
Signature · 1 line
2.14.3
author
#1 lore raw

PATCH RESEND 1/2 ACPI/unit-test: Add a testcase for RAM allocation in numa node

As QEMU supports the memory-less node, it is possible that there is no RAM in the first numa node(also be called as node0). eg:
... \
-m 128,slots=3,maxmem=1G \
-numa node -numa node,mem=128M \

But, this makes it hard for QEMU to build a known-to-work ACPI SRAT table. Only fixing it is not enough.

Add a testcase for this situation to make sure the ACPI table is correct for guest.

---
 tests/acpi-test-data/pc/DSDT.numamem  | Bin 0 -> 5150 bytes
 tests/acpi-test-data/pc/SRAT.numamem  | Bin 0 -> 224 bytes
 tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 7834 bytes
 tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 224 bytes
 tests/bios-tables-test.c              |  24 ++++++++++++++++++++++++
 5 files changed, 24 insertions(+)
 create mode 100644 tests/acpi-test-data/pc/DSDT.numamem
 create mode 100644 tests/acpi-test-data/pc/SRAT.numamem
 create mode 100644 tests/acpi-test-data/q35/DSDT.numamem
 create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
tests/acpi-test-data/pc/DSDT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..224cfdd9e983e02dac5f4bf7e210eaa64cb0dc78
GIT binary patch
tests/acpi-test-data/pc/SRAT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..dbc595d9cb85d3fcb5a4243153f42bb431c9de8f
GIT binary patch
tests/acpi-test-data/q35/DSDT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8c9fa445b0119b6f67533cb968855b41fb9925d9
GIT binary patch
tests/acpi-test-data/q35/SRAT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..dbc595d9cb85d3fcb5a4243153f42bb431c9de8f
GIT binary patch
tests/bios-tables-test.c +24 -0
index e28e0c98cf..def81fc243 100644
@@ -810,6 +810,28 @@ static void test_acpi_piix4_tcg_memhp(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_numamem(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".numamem";
+    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_piix4_tcg_numamem(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_PC;
+    data.variant = ".numamem";
+    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    free_test_data(&data);
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -832,6 +854,8 @@ int main(int argc, char *argv[])
         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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
Signature · 1 line
2.14.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [RESEND PATCH for-2.12 1/2] ACPI/unit-test: Add a testcase for RAM allocation in numa node

Quoted 198 lines · On Thu, 14 Dec 2017 12:08:54 +0800 Dou Liyang <[email protected]> wrote:

As QEMU supports the memory-less node, it is possible that there is no RAM in the first numa node(also be called as node0). eg:
... \
-m 128,slots=3,maxmem=1G \
-numa node -numa node,mem=128M \

But, this makes it hard for QEMU to build a known-to-work ACPI SRAT table. Only fixing it is not enough.

Add a testcase for this situation to make sure the ACPI table is correct for guest.

---
 tests/acpi-test-data/pc/DSDT.numamem  | Bin 0 -> 5150 bytes
 tests/acpi-test-data/pc/SRAT.numamem  | Bin 0 -> 224 bytes
 tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 7834 bytes
 tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 224 bytes
 tests/bios-tables-test.c              |  24 ++++++++++++++++++++++++
 5 files changed, 24 insertions(+)
 create mode 100644 tests/acpi-test-data/pc/DSDT.numamem
 create mode 100644 tests/acpi-test-data/pc/SRAT.numamem
 create mode 100644 tests/acpi-test-data/q35/DSDT.numamem
 create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
tests/acpi-test-data/pc/DSDT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..224cfdd9e983e02dac5f4bf7e210eaa64cb0dc78
GIT binary patch
tests/acpi-test-data/pc/SRAT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..dbc595d9cb85d3fcb5a4243153f42bb431c9de8f
GIT binary patch
tests/acpi-test-data/q35/DSDT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8c9fa445b0119b6f67533cb968855b41fb9925d9
GIT binary patch
tests/acpi-test-data/q35/SRAT.numamem new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..dbc595d9cb85d3fcb5a4243153f42bb431c9de8f
GIT binary patch
tests/bios-tables-test.c +22 -0
index e28e0c98cf..def81fc243 100644
@@ -810,6 +810,28 @@ static void test_acpi_piix4_tcg_memhp(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_numamem(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".numamem";
+    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_piix4_tcg_numamem(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_PC;
+    data.variant = ".numamem";
+    test_acpi_one(" -numa node -numa node,mem=128", &data);
+    free_test_data(&data);
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();

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

Quoted 8 lines
tests/bios-tables-test.c +2 -0
@@ -832,6 +854,8 @@ int main(int argc, char *argv[])
         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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
author
#3 lore raw

PATCH RESEND 2/2 hw/acpi-build: Make next_base easy to follow

In reply to Dou Liyang

It may be hard to read the assignment statement of "next_base", so

S/next_base += (1ULL << 32) - pcms->below_4g_mem_size;
/next_base = mem_base + mem_len;

... for readability.

No functionality change.

---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/acpi-build.c +1 -1
index 73519ab3ac..2010108ae0 100644
@@ -2381,7 +2381,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
             }
             mem_base = 1ULL << 32;
             mem_len = next_base - pcms->below_4g_mem_size;
-            next_base += (1ULL << 32) - pcms->below_4g_mem_size;
+            next_base = mem_base + mem_len;
         }
         numamem = acpi_data_push(table_data, sizeof *numamem);
         build_srat_memory(numamem, mem_base, mem_len, i - 1,
Signature · 1 line
2.14.3
Reviewed-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [RESEND PATCH for-2.12 2/2] hw/acpi-build: Make next_base easy to follow

Quoted 10 lines · Dou Liyang

It may be hard to read the assignment statement of "next_base", so

S/next_base += (1ULL << 32) - pcms->below_4g_mem_size;
/next_base = mem_base + mem_len;

... for readability.

No functionality change.

Quoted 21 lines
---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/acpi-build.c +1 -1
index 73519ab3ac..2010108ae0 100644
@@ -2381,7 +2381,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
             }
             mem_base = 1ULL << 32;
             mem_len = next_base - pcms->below_4g_mem_size;
-            next_base += (1ULL << 32) - pcms->below_4g_mem_size;
+            next_base = mem_base + mem_len;
         }
         numamem = acpi_data_push(table_data, sizeof *numamem);
         build_srat_memory(numamem, mem_base, mem_len, i - 1,
Signature · 1 line
2.14.3
Reviewed-by on v1 2/2
#5 lore raw

Re: [Qemu-devel] [RESEND PATCH for-2.12 2/2] hw/acpi-build: Make next_base easy to follow

In reply to Dou Liyang
Quoted 19 lines · On Thu, 14 Dec 2017 12:08:55 +0800 Dou Liyang <[email protected]> wrote:

It may be hard to read the assignment statement of "next_base", so

S/next_base += (1ULL << 32) - pcms->below_4g_mem_size;
/next_base = mem_base + mem_len;

... for readability.

No functionality change.

---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/acpi-build.c +0 -0
index 73519ab3ac..2010108ae0 100644

hw/i386/acpi-build.c build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) · line 2387

Quoted 8 lines
hw/i386/acpi-build.c +1 -1
@@ -2381,7 +2381,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
             }
             mem_base = 1ULL << 32;
             mem_len = next_base - pcms->below_4g_mem_size;
-            next_base += (1ULL << 32) - pcms->below_4g_mem_size;
+            next_base = mem_base + mem_len;
         }
         numamem = acpi_data_push(table_data, sizeof *numamem);
         build_srat_memory(numamem, mem_base, mem_len, i - 1,
#6 lore raw
In reply to Dou Liyang
Quoted 6 lines · Dou Liyang

These are the patches left over from the pull request:

[Qemu-devel] [PULL 0/9] x86 and machine queue, 2017-10-05

because of some errors when tested by "make check" command[1].

Quoted 8 lines

Now, the QEMU 2.11.0 has been released, rebase/retest/respin them for v2.12 dev.

Changelog:
--Rebase and retest this patch in v2.11.0
--Update the DSDT.numamem:

[1]: http://lists.gnu.org/archive/html/qemu-devel/2017-10/msg01334.html

Do we know what caused the failures Peter saw, and if we can now be sure it won't happen again?

Signature · 1 line
Eduardo
author
#7 lore raw

Hi Eduardo,

Quoted 10 lines · Eduardo Habkost
Quoted 9 lines · Dou Liyang

These are the patches left over from the pull request:

   [Qemu-devel] [PULL 0/9] x86 and machine queue, 2017-10-05

because of some errors when tested by "make check" command[1].

Now, the QEMU 2.11.0 has been released, rebase/retest/respin them for v2.12 dev.

Quoted 8 lines
Quoted 5 lines

Changelog:
--Rebase and retest this patch in v2.11.0
--Update the DSDT.numamem:

[1]: http://lists.gnu.org/archive/html/qemu-devel/2017-10/msg01334.html

Do we know what caused the failures Peter saw, and if we can now be sure it won't happen again?

Sorry, I can't. I tested it many times with my colleagues, it won't happen like Peter saw. This issue is very subtle and funny. Could you give me some suggestions?

BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct?

Thanks,
dou.

Quoted 1 line
#8 lore raw
Quoted 17 lines · Dou Liyang

Hi Eduardo,

Quoted 14 lines · Eduardo Habkost
Quoted 13 lines · Dou Liyang

These are the patches left over from the pull request:

   [Qemu-devel] [PULL 0/9] x86 and machine queue, 2017-10-05

because of some errors when tested by "make check" command[1].

Now, the QEMU 2.11.0 has been released, rebase/retest/respin them for v2.12 dev.

Changelog:
--Rebase and retest this patch in v2.11.0
--Update the DSDT.numamem:

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

[1]: http://lists.gnu.org/archive/html/qemu-devel/2017-10/msg01334.html

Do we know what caused the failures Peter saw, and if we can now be sure it won't happen again?

Sorry, I can't. I tested it many times with my colleagues, it won't happen like Peter saw. This issue is very subtle and funny. Could you give me some suggestions?

I guess all we can do is to ask Peter to test if the issue is still reproducible.

Peter, do you prefer that I just send a regular pull request asking for testing, or do you prefer to apply this series and test it manually before I send a pull request?

Quoted 3 lines

BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct?

This sounds correct to me. Igor, can you confirm?

Signature · 1 line
Eduardo
#9 lore raw
Quoted 35 lines · On Wed, 20 Dec 2017 19:38:20 -0200 Eduardo Habkost <[email protected]> wrote:
Quoted 17 lines · Dou Liyang

Hi Eduardo,

Quoted 14 lines · Eduardo Habkost
Quoted 13 lines · Dou Liyang

These are the patches left over from the pull request:

   [Qemu-devel] [PULL 0/9] x86 and machine queue, 2017-10-05

because of some errors when tested by "make check" command[1].

Now, the QEMU 2.11.0 has been released, rebase/retest/respin them for v2.12 dev.

Changelog:
--Rebase and retest this patch in v2.11.0
--Update the DSDT.numamem:

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

[1]: http://lists.gnu.org/archive/html/qemu-devel/2017-10/msg01334.html

Do we know what caused the failures Peter saw, and if we can now be sure it won't happen again?

Sorry, I can't. I tested it many times with my colleagues, it won't happen like Peter saw. This issue is very subtle and funny. Could you give me some suggestions?

I guess all we can do is to ask Peter to test if the issue is still reproducible.

Peter, do you prefer that I just send a regular pull request asking for testing, or do you prefer to apply this series and test it manually before I send a pull request?

Quoted 1 line
Quoted 4 lines
Quoted 2 lines

BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct?

This sounds correct to me. Igor, can you confirm?

It's will rebuild/update reference tables.

I'm for merging it early and tracking/fixing issue Peter saw during this dev cycle.

#10 lore raw
Quoted 38 lines · Igor Mammedov
Quoted 35 lines · On Wed, 20 Dec 2017 19:38:20 -0200 Eduardo Habkost <[email protected]> wrote:
Quoted 17 lines · Dou Liyang

Hi Eduardo,

Quoted 14 lines · Eduardo Habkost
Quoted 13 lines · Dou Liyang

These are the patches left over from the pull request:

   [Qemu-devel] [PULL 0/9] x86 and machine queue, 2017-10-05

because of some errors when tested by "make check" command[1].

Now, the QEMU 2.11.0 has been released, rebase/retest/respin them for v2.12 dev.

Changelog:
--Rebase and retest this patch in v2.11.0
--Update the DSDT.numamem:

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

[1]: http://lists.gnu.org/archive/html/qemu-devel/2017-10/msg01334.html

Do we know what caused the failures Peter saw, and if we can now be sure it won't happen again?

Sorry, I can't. I tested it many times with my colleagues, it won't happen like Peter saw. This issue is very subtle and funny. Could you give me some suggestions?

I guess all we can do is to ask Peter to test if the issue is still reproducible.

Peter, do you prefer that I just send a regular pull request asking for testing, or do you prefer to apply this series and test it manually before I send a pull request?

Quoted 1 line
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct?

This sounds correct to me. Igor, can you confirm?

It's will rebuild/update reference tables.

I'm for merging it early and tracking/fixing issue Peter saw during this dev cycle.

Send an ack then?

author
#11 lore raw

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct?

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

This sounds correct to me. Igor, can you confirm?

It's will rebuild/update reference tables.

I'm for merging it early and tracking/fixing issue Peter saw during this dev cycle.

Send an ack then?

Hi Michael,

I saw Igor gave the Reviewed-by at 21 Dec 2017.

What is the state of this patchset?

I rebase and retest it again, Do I need to send it again?

Thanks,
dou

Quoted 2 lines
author
#12 lore raw
Quoted 12 lines · Dou Liyang

[...]

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines

BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct?

This sounds correct to me.  Igor, can you confirm?

It's will rebuild/update reference tables.

I'm for merging it early and tracking/fixing issue Peter saw during this dev cycle.

Quoted 5 lines
Quoted 2 lines

Send an ack then?

Hi Michael,

I saw Igor gave the Reviewed-by at 21 Dec 2017

                                     ^^ Oops! Sorry, it's 27 Dec.

Quoted 9 lines

What is the state of this patchset?

I rebase and retest it again, Do I need to send it again?

Thanks,
    dou

Quoted 2 lines