hw/acpi-build: Fix ACPI SRAT Memory Affinity building
v4 cover hw/acpi-build: Fix ACPI SRAT Memory Affinity building
V3 --> v4:
-add a new testcase.
This patchset fixs an ACPI building bug which caused by no RAM in the first NUAM node. and also add a new testcase for the bug.
Dou Liyang (2):
hw/acpi-build: Fix SRAT memory building when there is no memory in
node0
ACPI/unit-test: Add a new testcase for RAM allocation in numa node
hw/i386/acpi-build.c | 78 ++++++++++++++++++++++------------ tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 +++++++++++++ 8 files changed, 80 insertions(+), 28 deletions(-) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
Signature · 1 line
2.5.5
PATCH v4 1/2 hw/acpi-build: Fix SRAT memory building when there is no memory in node0
Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.
This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M), but, actually it can have no memory.
Fix this problem by replace the node0 with the first node which has memory on it. Add a new function for each node. Also do some cleanup.
--- hw/i386/acpi-build.c | 78 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 28 deletions(-)
hw/i386/acpi-build.c +50 -28
@@ -2318,15 +2318,43 @@ build_tpm2(GArray *table_data, BIOSLinker *linker) (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL, NULL); } +static uint64_t +build_srat_node_entry (GArray *table_data,PCMachineState *pcms, +int i,uint64_t mem_base,uint64_t mem_len) +{ +AcpiSratMemoryAffinity *numamem; +uint64_t next_base; + + next_base = mem_base + mem_len; + +/* Cut out the ACPI_PCI hole */ +if (mem_base <= pcms->below_4g_mem_size && + next_base > pcms->below_4g_mem_size) { + mem_len -= next_base - pcms->below_4g_mem_size; +if (mem_len >0 ) { + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem, mem_base, mem_len, i, +MEM_AFFINITY_ENABLED ); + } + mem_base =1ULL <<32 ; + mem_len = next_base - pcms->below_4g_mem_size; + next_base += (1ULL <<32 ) - pcms->below_4g_mem_size; + } + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem, mem_base, mem_len, i, +MEM_AFFINITY_ENABLED ); +return next_base; +} +static void build_srat (GArray *table_data,BIOSLinker *linker,MachineState *machine) {AcpiSystemResourceAffinityTable *srat;AcpiSratMemoryAffinity *numamem; -int i; +int i, node;int srat_start, numa_start, slots; -uint64_t mem_len, mem_base, next_base; +uint64_t mem_len, mem_base;MachineClass *mc =MACHINE_GET_CLASS (machine);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (machine);PCMachineState *pcms =PC_MACHINE (machine);
@@ -2370,36 +2398,30 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)/* the memory map is a bit tricky, it contains at least one hole * from 640k-1M and possibly another one from 3.5G-4G. */ - next_base =0 ; + numa_start = table_data->len; - numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem,0 ,640 *1024 ,0 ,MEM_AFFINITY_ENABLED ); - next_base =1024 *1024 ; -for (i =1 ; i < pcms->numa_nodes +1 ; ++i) { - mem_base = next_base; - mem_len = pcms->node_mem[i -1 ]; -if (i ==1 ) { - mem_len -=1024 *1024 ; +/* get the first node which has memory and map the hole from 640K-1M */ +for (node =0 ; node < pcms->numa_nodes; node++) { +if (pcms->node_mem[node] !=0 ) { +break ; } - next_base = mem_base + mem_len; - -/* Cut out the ACPI_PCI hole */ -if (mem_base <= pcms->below_4g_mem_size && - next_base > pcms->below_4g_mem_size) { - mem_len -= next_base - pcms->below_4g_mem_size; -if (mem_len >0 ) { - numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem, mem_base, mem_len, i -1 , -MEM_AFFINITY_ENABLED ); - } - mem_base =1ULL <<32 ; - mem_len = next_base - pcms->below_4g_mem_size; - next_base += (1ULL <<32 ) - pcms->below_4g_mem_size; + } + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem,0 ,640 *1024 , node,MEM_AFFINITY_ENABLED ); + +/* map the rest of memory from 1M */ + mem_base =1024 *1024 ; + mem_len = pcms->node_mem[node] - mem_base; + mem_base =build_srat_node_entry (table_data, pcms, node, + mem_base, mem_len); + +for (i =0 ; i < pcms->numa_nodes; i++) { +if (i == node) { +continue ; } - numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem, mem_base, mem_len, i -1 , -MEM_AFFINITY_ENABLED ); + mem_base =build_srat_node_entry (table_data, pcms, i, + mem_base, pcms->node_mem[i]); } slots = (table_data->len - numa_start) /sizeof *numamem;for (; slots < pcms->numa_nodes +2 ; slots++) {
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH v4 1/2] hw/acpi-build: Fix SRAT memory building when there is no memory in node0
Quoted 113 lines · Dou Liyang
Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M), but, actually it can have no memory.
Fix this problem by replace the node0 with the first node which has memory on it. Add a new function for each node. Also do some cleanup.
Signed-off-by Dou Liyang <[email protected]>--- hw/i386/acpi-build.c | 78 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 28 deletions(-)hw/i386/acpi-build.c +39
-25@@ -2318,15 +2318,43 @@ build_tpm2(GArray *table_data, BIOSLinker *linker) (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL, NULL); } +static uint64_t +build_srat_node_entry (GArray *table_data,PCMachineState *pcms, +int i,uint64_t mem_base,uint64_t mem_len) +{ +AcpiSratMemoryAffinity *numamem; +uint64_t next_base; + + next_base = mem_base + mem_len; + +/* Cut out the ACPI_PCI hole */ +if (mem_base <= pcms->below_4g_mem_size && + next_base > pcms->below_4g_mem_size) { + mem_len -= next_base - pcms->below_4g_mem_size; +if (mem_len >0 ) { + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem, mem_base, mem_len, i, +MEM_AFFINITY_ENABLED ); + } + mem_base =1ULL <<32 ; + mem_len = next_base - pcms->below_4g_mem_size; + next_base += (1ULL <<32 ) - pcms->below_4g_mem_size; + } + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem, mem_base, mem_len, i, +MEM_AFFINITY_ENABLED ); +return next_base; +} +static void build_srat (GArray *table_data,BIOSLinker *linker,MachineState *machine) {AcpiSystemResourceAffinityTable *srat;AcpiSratMemoryAffinity *numamem; -int i; +int i, node;int srat_start, numa_start, slots; -uint64_t mem_len, mem_base, next_base; +uint64_t mem_len, mem_base;MachineClass *mc =MACHINE_GET_CLASS (machine);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (machine);PCMachineState *pcms =PC_MACHINE (machine);@@ -2370,36 +2398,30 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)/* the memory map is a bit tricky, it contains at least one hole * from 640k-1M and possibly another one from 3.5G-4G. */ - next_base =0 ; + numa_start = table_data->len; - numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem,0 ,640 *1024 ,0 ,MEM_AFFINITY_ENABLED ); - next_base =1024 *1024 ; -for (i =1 ; i < pcms->numa_nodes +1 ; ++i) { - mem_base = next_base; - mem_len = pcms->node_mem[i -1 ]; -if (i ==1 ) { - mem_len -=1024 *1024 ; +/* get the first node which has memory and map the hole from 640K-1M */ +for (node =0 ; node < pcms->numa_nodes; node++) { +if (pcms->node_mem[node] !=0 ) { +break ; } - next_base = mem_base + mem_len; - -/* Cut out the ACPI_PCI hole */ -if (mem_base <= pcms->below_4g_mem_size && - next_base > pcms->below_4g_mem_size) { - mem_len -= next_base - pcms->below_4g_mem_size; -if (mem_len >0 ) { - numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem, mem_base, mem_len, i -1 , -MEM_AFFINITY_ENABLED ); - } - mem_base =1ULL <<32 ; - mem_len = next_base - pcms->below_4g_mem_size; - next_base += (1ULL <<32 ) - pcms->below_4g_mem_size; + } + numamem =acpi_data_push (table_data,sizeof *numamem); +build_srat_memory (numamem,0 ,640 *1024 , node,MEM_AFFINITY_ENABLED ); +
hw/i386/acpi-build.c build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) · line 2422
Quoted 10 lines
hw/i386/acpi-build.c +9
-0+/* map the rest of memory from 1M */ + mem_base =1024 *1024 ; + mem_len = pcms->node_mem[node] - mem_base; + mem_base =build_srat_node_entry (table_data, pcms, node, + mem_base, mem_len); + +for (i =0 ; i < pcms->numa_nodes; i++) { +if (i == node) { +continue ; }
Now the nodes will be out of order, if node 0 has no RAM. Why?
Why not implement this in the same way the PCI 4GB hole is already implemented. e.g.:
#define HOLE_640K_START (640 * 1024)
#define HOLE_640K_END (1024 * 1024)
for (node = 0; node < pcms->numa_nodes; node++) {
mem_base = next_base;
mem_len = pcms->node_mem[node];
next_base = mem_base + mem_len;
/* Cut out the 640K hole */
if (mem_base <= HOLE_640K_START &&
next_base > HOLE_640K_START) {
mem_len -= next_base - HOLE_640K;
if (mem_len > 0) {
numamem = acpi_data_push(table_data, sizeof *numamem);
build_srat_memory(numamem, mem_base, mem_len, node,
MEM_AFFINITY_ENABLED);
}
mem_base = HOLE_640K_END;
/* ... */
}
/* Cut out the ACPI_PCI hole */
if (mem_base <= pcms->below_4g_mem_size &&
next_base > pcms->below_4g_mem_size) {
mem_len -= next_base - pcms->below_4g_mem_size;
/* ... *]
}
numamem = acpi_data_push(table_data, sizeof *numamem);
build_srat_memory(numamem, mem_base, mem_len, node,
MEM_AFFINITY_ENABLED);
/* ... */
}Quoted 14 lines
hw/i386/acpi-build.c +2
-3- numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem, mem_base, mem_len, i -1 , -MEM_AFFINITY_ENABLED ); + mem_base =build_srat_node_entry (table_data, pcms, i, + mem_base, pcms->node_mem[i]); } slots = (table_data->len - numa_start) /sizeof *numamem;for (; slots < pcms->numa_nodes +2 ; slots++) {Signature · 1 line
2.5.5
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v4 1/2] hw/acpi-build: Fix SRAT memory building when there is no memory in node0
Hi Eduardo,
[...]
Quoted 5 lines
Quoted 2 lines
+ continue; }Now the nodes will be out of order, if node 0 has no RAM. Why?
Because the code parsed the other node with RAM first, then parsed the node 0.
Quoted 3 lines
Why not implement this in the same way the PCI 4GB hole is already implemented. e.g.:
Indeed, it is better and more refined. I will do it in the next version.
Quoted 19 lines
#define
HOLE_640K_START(640 * 1024)
#defineHOLE_640K_END(1024 * 1024)for (node = 0; node < pcms->numa_nodes; node++) { mem_base = next_base; mem_len = pcms->node_mem[node]; next_base = mem_base + mem_len; /* Cut out the 640K hole */ if (mem_base <= HOLE_640K_START && next_base > HOLE_640K_START) { mem_len -= next_base - HOLE_640K; if (mem_len > 0) { numamem = acpi_data_push(table_data, sizeof *numamem); build_srat_memory(numamem, mem_base, mem_len, node, MEM_AFFINITY_ENABLED); } mem_base = HOLE_640K_END; /* ... */
BTW, in case
0
|-----------|-------|--------|------- | | | | mem_base 640K next_base 1M
I wanna add a check here,
/* Check for the rare case: 640K < RAM < 1M */
if (next_base <= HOLE_640K_END) {
next_base = HOLE_640K_END;
continue;
}
mem_base = HOLE_640K_END;
mem_len = next_base - HOLE_640K_END;I guess no one would set a node with this less RAM, So, Is that necessary?
Thanks,
dou.
Quoted 28 lines
} /* Cut out the ACPI_PCI hole */ if (mem_base <= pcms->below_4g_mem_size && next_base > pcms->below_4g_mem_size) { mem_len -= next_base - pcms->below_4g_mem_size; /* ... *] } numamem = acpi_data_push(table_data, sizeof *numamem); build_srat_memory(numamem, mem_base, mem_len, node, MEM_AFFINITY_ENABLED); /* ... */ }Quoted 14 lines
hw/i386/acpi-build.c +2
-4- numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem, mem_base, mem_len, i -1 , -MEM_AFFINITY_ENABLED ); + mem_base =build_srat_node_entry (table_data, pcms, i, + mem_base, pcms->node_mem[i]); } slots = (table_data->len - numa_start) /sizeof *numamem;for (; slots < pcms->numa_nodes +2 ; slots++) { --2.5.5
Re: [Qemu-devel] [PATCH v4 1/2] hw/acpi-build: Fix SRAT memory building when there is no memory in node0
Hi Eduardo,
Quoted 56 lines · Dou Liyang
Hi Eduardo,
[...]
Quoted 5 lines
Quoted 2 lines
+ continue; }Now the nodes will be out of order, if node 0 has no RAM. Why?
Because the code parsed the other node with RAM first, then parsed the node 0.
Quoted 3 lines
Why not implement this in the same way the PCI 4GB hole is already implemented. e.g.:
Indeed, it is better and more refined. I will do it in the next version.
Quoted 19 lines
#define
HOLE_640K_START(640 * 1024)
#defineHOLE_640K_END(1024 * 1024)for (node = 0; node < pcms->numa_nodes; node++) { mem_base = next_base; mem_len = pcms->node_mem[node]; next_base = mem_base + mem_len; /* Cut out the 640K hole */ if (mem_base <= HOLE_640K_START && next_base > HOLE_640K_START) { mem_len -= next_base - HOLE_640K; if (mem_len > 0) { numamem = acpi_data_push(table_data, sizeof *numamem); build_srat_memory(numamem, mem_base, mem_len, node, MEM_AFFINITY_ENABLED); } mem_base = HOLE_640K_END; /* ... */BTW, in case
0 |-----------|-------|--------|------- | | | |
mem_base640Knext_base1MI wanna add a check here,
/* Check for the rare case: 640K < RAM < 1M */ if (next_base <= HOLE_640K_END) { next_base = HOLE_640K_END; continue; } mem_base = HOLE_640K_END; mem_len = next_base - HOLE_640K_END;
Quoted 3 lines
I guess no one would set a node with this less RAM, So, Is that necessary?
I post the V5 patches, and use your code.
It may be not very clearly, for the detail, Please see the new version.
Thanks,
dou.
Quoted 32 lines
Thanks,
dou.Quoted 29 lines
} /* Cut out the ACPI_PCI hole */ if (mem_base <= pcms->below_4g_mem_size && next_base > pcms->below_4g_mem_size) { mem_len -= next_base - pcms->below_4g_mem_size; /* ... *] } numamem = acpi_data_push(table_data, sizeof *numamem); build_srat_memory(numamem, mem_base, mem_len, node, MEM_AFFINITY_ENABLED); /* ... */ }Quoted 15 lines
hw/i386/acpi-build.c +2
-3- numamem =acpi_data_push (table_data,sizeof *numamem); -build_srat_memory (numamem, mem_base, mem_len, i -1 , -MEM_AFFINITY_ENABLED ); + mem_base = build_srat_node_entry(table_data, pcms, i, + mem_base,pcms->node_mem[i]); } slots = (table_data->len - numa_start) / sizeof *numamem; for (; slots < pcms->numa_nodes + 2; slots++) {--
2.5.5
PATCH v4 2/2 ACPI/unit-test: Add a new testcase for RAM allocation in numa node
In reply to Dou LiyangAs 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 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
tests/acpi-test-data/pc/DSDT.numamem new file binary +0 -0
tests/acpi-test-data/pc/SLIT.numamem new file binary +0 -0
tests/acpi-test-data/pc/SRAT.numamem new file binary +0 -0
tests/acpi-test-data/q35/DSDT.numamem new file binary +0 -0
tests/acpi-test-data/q35/SLIT.numamem new file binary +0 -0
tests/acpi-test-data/q35/SRAT.numamem new file binary +0 -0
tests/bios-tables-test.c +30 -0
@@ -808,6 +808,34 @@ 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 (" -m 128,slots=3,maxmem=1G" +" -numa node -numa node,mem=128" +" -numa dist,src=0,dst=1,val=21" , + &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 (" -m 128,slots=3,maxmem=1G" +" -numa node -numa node,mem=128" +" -numa dist,src=0,dst=1,val=21" , + &data); +free_test_data (&data); +} +int main (int argc,char *argv[]) {const char *arch =qtest_get_arch ();
@@ -830,6 +858,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.5.5
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>
Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
tests/acpi-test-data/[pc|q35]/SRAT.numamem
in this patch and drop the rest of *.numamem tables as test case should fallback to default tables when .numamem variant doesn't exists
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamem
Quoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
+ test_acpi_one(" -m 128,slots=3,maxmem=1G"
+ " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);
The DSDT and SLIT don't match with default blobs.
So, they can't be dropped.
Thanks,
dou.
Quoted 7 lines
tests/acpi-test-data/[pc|q35]/SRAT.numamem
in this patch and drop the rest of *.numamem tables as test case should fallback to default tables when .numamem variant doesn't exists
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
tests/bios-tables-test.c +4
-0+test_acpi_one (" -m 128,slots=3,maxmem=1G" +" -numa node -numa node,mem=128" +" -numa dist,src=0,dst=1,val=21" , + &data);
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
Quoted 2 lines
So, they can't be dropped.
I wonder what's changed, could you post DSDT diff here?
(to get diff run 'make V=1 check' without DSDT.numamem being present)
Quoted 13 lines
Thanks,
dou.Quoted 7 lines
tests/acpi-test-data/[pc|q35]/SRAT.numamem
in this patch and drop the rest of *.numamem tables as test case should fallback to default tables when .numamem variant doesn't exists
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Hi Igor,
Quoted 51 lines · Igor Mammedov
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
(quoted diff) +4
-0+ test_acpi_one(" -m 128,slots=3,maxmem=1G" + " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);
Quoted 5 lines
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
OK, Got it, will drop '-numa dist' option in next version.
Quoted 5 lines
Quoted 2 lines
So, they can't be dropped.
I wonder what's changed, could you post DSDT diff here?
Just like memory hot-plug cases, when we use the '-m 128,slots=3,maxmem=1G' option, As the ACPI spec said, There may be some Memory Device in the DSDT table.
Quoted 1 line
(to get diff run 'make V=1 check' without DSDT.numamem being present)
asl-JLX34Y.dsl renamed from asl-YJ034Y.dsl +2 -2
@@ -5,13 +5,13 @@ * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/acpi-test-data/pc/DSDT, Wed Aug 23 21:22:56 2017 + * Disassembly of /tmp/aml-8IX34Y, Wed Aug 23 21:22:56 2017 * * Original Table Header: * Signature "DSDT" - * Length 0x000013EA (5098) + * Length 0x0000193F (6463) * Revision 0x01 **** 32-bit table (V1), no 64-bit math
support
- * Checksum 0x78
+ * Checksum 0x7B
* OEM ID "BOCHS "
* OEM Table ID "BXPCDSDT"
* OEM Revision 0x00000001 (1)
@@ -783,6 +783,8 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPCDSDT", 0x00000001)
{
COST (Zero, Arg0, Arg1, Arg2)
}
+
+ Name (_PXM, Zero) // _PXM: Device Proximity
}
}
}
@@ -792,6 +794,310 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPCDSDT", 0x00000001)
\_SB.CPUS.CSCN ()
}+ Device (\_SB.PCI0.MHPD)
+ {
+ Name (_HID, "PNP0A06" /* Generic Container Device */) // _HID: Hardware ID
+ Name (_UID, "Memory hotplug resources") // _UID: Unique ID
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ IO (Decode16,
+ 0x0A00, // Range Minimum
+ 0x0A00, // Range Maximum
+ 0x00, // Alignment
+ 0x18, // Length
+ )+ })
+ OperationRegion (HPMR, SystemIO, 0x0A00, 0x18)
+ }
+
+ Device (\_SB.MHPC)
+ {
+ Name (_HID, "PNP0A06" /* Generic Container Device */) // _HID: Hardware ID
+ Name (_UID, "DIMM devices") // _UID: Unique ID
+ Name (MDNR, 0x03)
+ Field (\_SB.PCI0.MHPD.HPMR, DWordAcc, NoLock, Preserve)
+ {
+ MRBL, 32,
+ MRBH, 32,
+ MRLL, 32,
+ MRLH, 32,
+ MPX, 32+ }
+
+ Field (\_SB.PCI0.MHPD.HPMR, ByteAcc, NoLock, WriteAsZeros)
+ {
+ Offset (0x14), + MES, 1, + MINS, 1, + MRMV, 1, + MEJ, 1
+ }
+
+ Field (\_SB.PCI0.MHPD.HPMR, DWordAcc, NoLock, Preserve)
+ {
+ MSEL, 32, + MOEV, 32, + MOSC, 32
+ }
+
+ Method (_STA, 0, NotSerialized) // _STA: Status
+ {
+ If (MDNR == Zero)
+ {
+ Return (Zero)
+ }
+
+ Return (0x0B)
+ }
+
+ Mutex (MLCK, 0x00)
+ Method (MSCN, 0, NotSerialized)
+ {+ If (MDNR == Zero)
+ {
+ Return (Zero)
+ }
+
+ Local0 = Zero
+ Acquire (MLCK, 0xFFFF)
+ While (Local0 < MDNR)
+ {
+ MSEL = Local0
+ If (MINS == One)
+ {
+ MTFY (Local0, One)
+ MINS = One
+ }
+ ElseIf (MRMV == One)
+ {+ MTFY (Local0, 0x03)
+ MRMV = One
+ }
+
+ Local0 += One
+ }
+
+ Release (MLCK)
+ Return (One)
+ }
+
+ Method (MRST, 1, NotSerialized)
+ {
+ Local0 = Zero
+ Acquire (MLCK, 0xFFFF)
+ MSEL = ToInteger (Arg0)
+ If (MES == One)
+ {+ Local0 = 0x0F
+ }
+
+ Release (MLCK)
+ Return (Local0)
+ }
+
+ Method (MCRS, 1, Serialized)
+ {
+ Acquire (MLCK, 0xFFFF)
+ MSEL = ToInteger (Arg0)
+ Name (MR64, ResourceTemplate ()
+ {
+ QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
+ 0x0000000000000000, // Granularity
+ 0x0000000000000000, // Range Minimum
+ 0xFFFFFFFFFFFFFFFE, // Range Maximum
+ 0x0000000000000000, // Translation Offset
+ 0xFFFFFFFFFFFFFFFF, // Length
+ ,, _Y01, AddressRangeMemory, TypeStatic)
+ })
+ CreateDWordField (MR64, \_SB.MHPC.MCRS._Y01._MIN, MINL) // _MIN: Minimum Base Address
+ CreateDWordField (MR64, 0x12, MINH)
+ CreateDWordField (MR64, \_SB.MHPC.MCRS._Y01._LEN, LENL) // _LEN: Length
+ CreateDWordField (MR64, 0x2A, LENH)
+ CreateDWordField (MR64, \_SB.MHPC.MCRS._Y01._MAX, MAXL) // _MAX: Maximum Base Address
+ CreateDWordField (MR64, 0x1A, MAXH)
+ MINH = MRBH /* \_SB_.MHPC.MRBH */
+ MINL = MRBL /* \_SB_.MHPC.MRBL */
+ LENH = MRLH /* \_SB_.MHPC.MRLH */
+ LENL = MRLL /* \_SB_.MHPC.MRLL */
+ MAXL = (MINL + LENL) /* \_SB_.MHPC.MCRS.LENL */
+ MAXH = (MINH + LENH) /* \_SB_.MHPC.MCRS.LENH */
+ If (MAXL < MINL)
+ {+ MAXH += One
+ }
+
+ If (MAXL < One)
+ {
+ MAXH -= One
+ }
+
+ MAXL -= One
+ If (MAXH == Zero)
+ {
+ Name (MR32, ResourceTemplate ()
+ {
+ DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
+ 0x00000000, // Granularity
+ 0x00000000, // Range Minimum
+ 0xFFFFFFFE, // Range Maximum
+ 0x00000000, // Translation Offset
+ 0xFFFFFFFF, // Length
+ ,, _Y02, AddressRangeMemory, TypeStatic)
+ })
+ CreateDWordField (MR32, \_SB.MHPC.MCRS._Y02._MIN, MIN) // _MIN: Minimum Base Address
+ CreateDWordField (MR32, \_SB.MHPC.MCRS._Y02._MAX, MAX) // _MAX: Maximum Base Address
+ CreateDWordField (MR32, \_SB.MHPC.MCRS._Y02._LEN, LEN) // _LEN: Length
+ MIN = MINL /* \_SB_.MHPC.MCRS.MINL */
+ MAX = MAXL /* \_SB_.MHPC.MCRS.MAXL */
+ LEN = LENL /* \_SB_.MHPC.MCRS.LENL */
+ Release (MLCK)
+ Return (MR32) /* \_SB_.MHPC.MCRS.MR32 */+ }
+
+ Release (MLCK)
+ Return (MR64) /* \_SB_.MHPC.MCRS.MR64 */
+ }
+
+ Method (MPXM, 1, NotSerialized)
+ {
+ Acquire (MLCK, 0xFFFF) + MSEL = ToInteger (Arg0) + Local0 = MPX /* \_SB_.MHPC.MPX_ */ + Release (MLCK) + Return (Local0)
+ }
+
+ Method (MOST, 4, NotSerialized)
+ {
+ Acquire (MLCK, 0xFFFF) + MSEL = ToInteger (Arg0) + MOEV = Arg1 + MOSC = Arg2 + Release (MLCK)
+ }
+
+ Method (MEJ0, 2, NotSerialized)
+ {
+ Acquire (MLCK, 0xFFFF) + MSEL = ToInteger (Arg0) + MEJ = One + Release (MLCK)
+ }
+
+ Device (MP00)
+ {
+ Name (_UID, "0x00") // _UID: Unique ID
+ Name (_HID, EisaId ("PNP0C80") /* Memory Device */) // _HID: Hardware ID
+ Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
+ {+ Return (MCRS (_UID))
+ }
+
+ Method (_STA, 0, NotSerialized) // _STA: Status
+ {
+ Return (MRST (_UID))
+ }
+
+ Method (_PXM, 0, NotSerialized) // _PXM: Device Proximity
+ {
+ Return (MPXM (_UID))
+ }
+
+ Method (_OST, 3, NotSerialized) // _OST: OSPM Status Indication
+ {
+ Return (MOST (_UID, Arg0, Arg1, Arg2))
+ }
+
+ Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device
+ {
+ Return (MEJ0 (_UID, Arg0))
+ }
+ }
+
+ Device (MP01)
+ {
+ Name (_UID, "0x01") // _UID: Unique ID
+ Name (_HID, EisaId ("PNP0C80") /* Memory Device */) // _HID: Hardware ID
+ Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
+ {+ Return (MCRS (_UID))
+ }
+
+ Method (_STA, 0, NotSerialized) // _STA: Status
+ {
+ Return (MRST (_UID))
+ }
+
+ Method (_PXM, 0, NotSerialized) // _PXM: Device Proximity
+ {
+ Return (MPXM (_UID))
+ }
+
+ Method (_OST, 3, NotSerialized) // _OST: OSPM Status Indication
+ {
+ Return (MOST (_UID, Arg0, Arg1, Arg2))
+ }
+
+ Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device
+ {
+ Return (MEJ0 (_UID, Arg0))
+ }
+ }
+
+ Device (MP02)
+ {
+ Name (_UID, "0x02") // _UID: Unique ID
+ Name (_HID, EisaId ("PNP0C80") /* Memory Device */) // _HID: Hardware ID
+ Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
+ {+ Return (MCRS (_UID))
+ }
+
+ Method (_STA, 0, NotSerialized) // _STA: Status
+ {
+ Return (MRST (_UID))
+ }
+
+ Method (_PXM, 0, NotSerialized) // _PXM: Device Proximity
+ {
+ Return (MPXM (_UID))
+ }
+
+ Method (_OST, 3, NotSerialized) // _OST: OSPM Status Indication
+ {
+ Return (MOST (_UID, Arg0, Arg1, Arg2))
+ }
+
+ Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device
+ {
+ Return (MEJ0 (_UID, Arg0))
+ }
+ }
+
+ Method (MTFY, 2, NotSerialized)
+ {
+ If (Arg0 == Zero)
+ {
+ Notify (MP00, Arg1)
+ }
+
+ If (Arg0 == One)
+ {
+ Notify (MP01, Arg1)
+ }
+
+ If (Arg0 == 0x02)
+ {
+ Notify (MP02, Arg1)
+ }
+ }
+ }
+
+ Method (\_GPE._E03, 0, NotSerialized) // _Exx: Edge-Triggered GPE
+ {
+ \_SB.MHPC.MSCN ()
+ }
+
Scope (_GPE)
{
Name (_HID, "ACPI0006" /* GPE Block Device */) // _HID: Hardware ID
Quoted 19 lines
Quoted 15 lines
Thanks,
dou.Quoted 7 lines
tests/acpi-test-data/[pc|q35]/SRAT.numamem
in this patch and drop the rest of *.numamem tables as test case should fallback to default tables when .numamem variant doesn't exists
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Quoted 63 lines · Dou Liyang
Hi Igor,
Quoted 51 lines · Igor Mammedov
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
(quoted diff) +4
-0+ test_acpi_one(" -m 128,slots=3,maxmem=1G" + " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);Quoted 5 lines
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
OK, Got it, will drop '-numa dist' option in next version.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
So, they can't be dropped.
I wonder what's changed, could you post DSDT diff here?
Just like memory hot-plug cases, when we use the '-m 128,slots=3,maxmem=1G' option, As the ACPI spec said, There may be some Memory Device in the DSDT table.
Do you really need to use -m 128,slots=3,maxmem=1G to test your bug fix?
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Hi Eduardo,
Quoted 69 lines · Eduardo Habkost
Quoted 68 lines · Dou Liyang
Hi Igor,
Quoted 51 lines · Igor Mammedov
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
(quoted diff) +4
-0+ test_acpi_one(" -m 128,slots=3,maxmem=1G" + " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);Quoted 5 lines
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
OK, Got it, will drop '-numa dist' option in next version.
Quoted 5 lines
Quoted 2 lines
So, they can't be dropped.
I wonder what's changed, could you post DSDT diff here?
Quoted 7 lines
Quoted 3 lines
Just like memory hot-plug cases, when we use the '-m 128,slots=3,maxmem=1G' option, As the ACPI spec said, There may be some Memory Device in the DSDT table.
Do you really need to use -m 128,slots=3,maxmem=1G to test your bug fix?
I was wrong, As the default memory for x86 is 128Mb, I will remove this option to make one case just do one thing.
Thanks,
dou.
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
In reply to Dou LiyangQuoted 63 lines · On Wed, 23 Aug 2017 21:35:29 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 51 lines · Igor Mammedov
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
(quoted diff) +4
-0+ test_acpi_one(" -m 128,slots=3,maxmem=1G" + " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);Quoted 5 lines
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
OK, Got it, will drop '-numa dist' option in next version.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
So, they can't be dropped.
I wonder what's changed, could you post DSDT diff here?
Just like memory hot-plug cases, when we use the '-m 128 128,slots=3,maxmem=1G' option, As the ACPI spec said, There may be some Memory Device in the DSDT table.
for your case '-numa node -numa node,mem=128', there is no need in enabling memory hotplug. If I recall it correctly the default memory for x86 is 128Mb,
hence removing "-m" would probably make DSDT match default one.
[...]
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Hi Igor,
Quoted 68 lines · Igor Mammedov
Quoted 65 lines · On Wed, 23 Aug 2017 21:35:29 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 51 lines · Igor Mammedov
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
(quoted diff) +4
-0+ test_acpi_one(" -m 128,slots=3,maxmem=1G" + " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);Quoted 5 lines
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
OK, Got it, will drop '-numa dist' option in next version.
Quoted 3 lines
Quoted 2 lines
So, they can't be dropped.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
I wonder what's changed, could you post DSDT diff here?
Just like memory hot-plug cases, when we use the '-m 128 128,slots=3,maxmem=1G' option, As the ACPI spec said, There may be some Memory Device in the DSDT table.
for your case '-numa node -numa node,mem=128', there is no need in enabling memory hotplug.
Thank you very much for your kind explanation.
Yes, I understood.
Quoted 2 lines
If I recall it correctly the default memory for x86 is 128Mb, hence removing "-m" would probably make DSDT match default one.
Yes, I removed the "-m":
test_acpi_one(" -numa node -numa node,mem=128", &data);
but, the DSDT didn't match the default one. because, if we support NUMA, the DSDT will give us "_PXM" to map the CPU to node.
tmp/asl-EWM54Y.dsl renamed from tmp/asl-7QO54Y.dsl +2 -2
@@ -5,13 +5,13 @@ * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/acpi-test-data/pc/DSDT, Thu Aug 24 09:20:29 2017 + * Disassembly of /tmp/aml-1YM54Y, Thu Aug 24 09:20:29 2017 * * Original Table Header: * Signature "DSDT" - * Length 0x000013EA (5098) + * Length 0x000013F0 (5104) * Revision 0x01 **** 32-bit table (V1), no 64-bit math
support
- * Checksum 0x78
+ * Checksum 0x13
* OEM ID "BOCHS "
* OEM Table ID "BXPCDSDT"
* OEM Revision 0x00000001 (1)
@@ -783,6 +783,8 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPCDSDT", 0x00000001)
{
COST (Zero, Arg0, Arg1, Arg2)
}
+
+ Name (_PXM, Zero) // _PXM: Device Proximity
}
}
}Thanks,
dou.
Quoted 7 lines
[...]
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Quoted 86 lines · On Thu, 24 Aug 2017 09:42:28 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 68 lines · Igor Mammedov
Quoted 65 lines · On Wed, 23 Aug 2017 21:35:29 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 51 lines · Igor Mammedov
Quoted 48 lines · On Wed, 23 Aug 2017 20:12:51 +0800 Dou Liyang <[email protected]> wrote:
Hi Igor,
Quoted 34 lines · Igor Mammedov
Quoted 14 lines · On Tue, 22 Aug 2017 11:24:10 +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.
Suggested-by Eduardo Habkost <[email protected]>Signed-off-by Dou Liyang <[email protected]>Quoted 15 lines
--- tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemQuoted 2 lines
considering only SRAT table has been changed and the other tables match with default blobs, I'd suggest to keep only
Our testcase is:
(quoted diff) +4
-0+ test_acpi_one(" -m 128,slots=3,maxmem=1G" + " -numa node -numa node,mem=128" + " -numa dist,src=0,dst=1,val=21", + &data);Quoted 5 lines
Quoted 1 line
The DSDT and SLIT don't match with default blobs.
do you actually need SLIT table /i.e. -numa dist/ for test at all? it looks not relevant for the test case at the hand, I'd suggest to drop '-numa dist' option for the test.
OK, Got it, will drop '-numa dist' option in next version.
Quoted 3 lines
Quoted 2 lines
So, they can't be dropped.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
I wonder what's changed, could you post DSDT diff here?
Just like memory hot-plug cases, when we use the '-m 128 128,slots=3,maxmem=1G' option, As the ACPI spec said, There may be some Memory Device in the DSDT table.
for your case '-numa node -numa node,mem=128', there is no need in enabling memory hotplug.
Thank you very much for your kind explanation.
Yes, I understood.
Quoted 2 lines
If I recall it correctly the default memory for x86 is 128Mb, hence removing "-m" would probably make DSDT match default one.
Quoted 6 lines
Yes, I removed the "-m":
test_acpi_one(" -numa node -numa node,mem=128", &data);but, the DSDT didn't match the default one. because, if we support NUMA, the DSDT will give us "
_PXM" to map the CPU to node.
Ok, looks like you'll have to include your variant of DSDT along with SRAT
Re: [Qemu-devel] [PATCH v4 2/2] ACPI/unit-test: Add a new testcase for RAM allocation in numa node
Hi Igor,
Quoted 6 lines · Igor Mammedov
Quoted 4 lines
Quoted 4 lines
test_acpi_one(" -numa node -numa node,mem=128", &data);but, the DSDT didn't match the default one. because, if we support NUMA, the DSDT will give us "
_PXM" to map the CPU to node.Ok, looks like you'll have to include your variant of DSDT along with SRAT
Yes, got it.
I will modify and post this patch first.
Thanks,
dou.
Quoted 4 lines
PATCH v5 2/2 ACPI/unit-test: Add a new testcase for RAM allocation in numa node
In reply to Dou LiyangAs 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.
---
v4 --> v5:
- rewrite the testcase.
- Drop the SLIT date
tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 5104 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 224 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 7788 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
tests/acpi-test-data/pc/SRAT.numamem new file binary +0 -0
tests/acpi-test-data/q35/DSDT.numamem new file binary +0 -0
tests/acpi-test-data/q35/SRAT.numamem new file binary +0 -0
tests/bios-tables-test.c +24 -0
@@ -808,6 +808,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 ();
@@ -830,6 +852,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.5.5
Quoted 5 lines · Dou Liyang
V3 --> v4:
-add a new testcase.This patchset fixs an ACPI building bug which caused by no RAM in the first NUAM node. and also add a new testcase for the bug.
thanks!
Pls remember to ping or repost after release is out.
Quoted 25 lines
Dou Liyang (2):
hw/acpi-build: Fix SRAT memory building when there is no memory in
node0
ACPI/unit-test: Add a new testcase for RAM allocation in numa nodehw/i386/acpi-build.c | 78 ++++++++++++++++++++++------------ tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 +++++++++++++ 8 files changed, 80 insertions(+), 28 deletions(-) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamemSignature · 1 line
2.5.5
Hi Michael,
Quoted 10 lines · Michael S. Tsirkin
Quoted 5 lines · Dou Liyang
V3 --> v4:
-add a new testcase.This patchset fixs an ACPI building bug which caused by no RAM in the first NUAM node. and also add a new testcase for the bug.
thanks!
Pls remember to ping or repost after release is out.
OK, I will.
Thanks,
dou.
Quoted 28 lines
Quoted 25 lines
Dou Liyang (2):
hw/acpi-build: Fix SRAT memory building when there is no memory in
node0
ACPI/unit-test: Add a new testcase for RAM allocation in numa nodehw/i386/acpi-build.c | 78 ++++++++++++++++++++++------------ tests/acpi-test-data/pc/DSDT.numamem | Bin 0 -> 6463 bytes tests/acpi-test-data/pc/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/pc/SRAT.numamem | Bin 0 -> 264 bytes tests/acpi-test-data/q35/DSDT.numamem | Bin 0 -> 9147 bytes tests/acpi-test-data/q35/SLIT.numamem | Bin 0 -> 48 bytes tests/acpi-test-data/q35/SRAT.numamem | Bin 0 -> 264 bytes tests/bios-tables-test.c | 30 +++++++++++++ 8 files changed, 80 insertions(+), 28 deletions(-) create mode 100644 tests/acpi-test-data/pc/DSDT.numamem create mode 100644 tests/acpi-test-data/pc/SLIT.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/SLIT.numamem create mode 100644 tests/acpi-test-data/q35/SRAT.numamem--
2.5.5