fix numa node mapping for hotplugged CPUs
cover fix numa node mapping for hotplugged CPUs
Series adds acpi tables tests for CPU hotplug and
makes hotplugged CPUs assigned to correct numa nodes for Linux guests
+ extends CPU hotplug test with numa options
Igor Mammedov (4):
tests: acpi: add CPU hotplug testcase
tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs
acpi: provide _PXM method for CPU devices if QEMU is started numa
enabled
tests: acpi: extend cphp testcase with numa check
hw/acpi/cpu.c | 9 +++++++++ tests/acpi-test-data/pc/APIC.cphp | Bin 0 -> 160 bytes tests/acpi-test-data/pc/DSDT.cphp | Bin 0 -> 6435 bytes tests/acpi-test-data/pc/SRAT.cphp | Bin 0 -> 304 bytes tests/acpi-test-data/q35/APIC.cphp | Bin 0 -> 160 bytes tests/acpi-test-data/q35/DSDT.cphp | Bin 0 -> 9197 bytes tests/acpi-test-data/q35/SRAT.cphp | Bin 0 -> 304 bytes tests/bios-tables-test.c | 30 ++++++++++++++++++++++++++++++ 8 files changed, 39 insertions(+) create mode 100644 tests/acpi-test-data/pc/APIC.cphp create mode 100644 tests/acpi-test-data/pc/DSDT.cphp create mode 100644 tests/acpi-test-data/pc/SRAT.cphp create mode 100644 tests/acpi-test-data/q35/APIC.cphp create mode 100644 tests/acpi-test-data/q35/DSDT.cphp create mode 100644 tests/acpi-test-data/q35/SRAT.cphp
Signature · 1 line
1.8.3.1
PATCH 1/4 tests: acpi: add CPU hotplug testcase
Test with:
-smp 2,cores=3,sockets=2,maxcpus=6
to capture sparse APIC ID values that default
AMD CPU has in above configuration.
---
NOTE to maintainer:
following table blobs should be added to git tree as poart of this commit after running ./tests/acpi-test-data/rebuild-expected-aml.sh
tests/acpi-test-data/q35/APIC.cphp
tests/acpi-test-data/q35/DSDT.cphp
tests/acpi-test-data/pc/APIC.cphp
tests/acpi-test-data/pc/DSDT.cphp
--- tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
tests/bios-tables-test.c +28 -0
@@ -801,6 +801,32 @@ static void test_acpi_q35_tcg_bridge(void)free_test_data (&data); } +static void test_acpi_piix4_tcg_cphp (void ) +{ +test_data data; + +memset (&data,0 ,sizeof (data)); + data.machine =MACHINE_PC ; + data.variant =".cphp" ; +test_acpi_one ("-machine accel=tcg" +" -smp 2,cores=3,sockets=2,maxcpus=6" , + &data); +free_test_data (&data); +} + +static void test_acpi_q35_tcg_cphp (void ) +{ +test_data data; + +memset (&data,0 ,sizeof (data)); + data.machine =MACHINE_Q35 ; + data.variant =".cphp" ; +test_acpi_one ("-machine q35,accel=tcg" +" -smp 2,cores=3,sockets=2,maxcpus=6" , + &data); +free_test_data (&data); +} +static uint8_t ipmi_required_struct_types[] = {0 ,1 ,3 ,4 ,16 ,17 ,19 ,32 ,38 ,127 };
@@ -856,6 +882,8 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/q35/tcg/bridge" , test_acpi_q35_tcg_bridge);qtest_add_func ("acpi/piix4/tcg/ipmi" , test_acpi_piix4_tcg_ipmi);qtest_add_func ("acpi/q35/tcg/ipmi" , test_acpi_q35_tcg_ipmi); +qtest_add_func ("acpi/piix4/tcg/cpuhp" , test_acpi_piix4_tcg_cphp); +qtest_add_func ("acpi/q35/tcg/cpuhp" , test_acpi_q35_tcg_cphp); } ret =g_test_run ();boot_sector_cleanup (disk);
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/4] tests: acpi: add CPU hotplug testcase
Quoted 61 lines · Igor Mammedov
Test with:
-smp 2,cores=3,sockets=2,maxcpus=6to capture sparse APIC ID values that default
AMD CPU has in above configuration.Signed-off-by Igor Mammedov <[email protected]>---
NOTE to maintainer:following table blobs should be added to git tree as poart of this commit after running
./tests/acpi-test-data/rebuild-expected-aml.shtests/acpi-test-data/q35/APIC.cphp
tests/acpi-test-data/q35/DSDT.cphp
tests/acpi-test-data/pc/APIC.cphp
tests/acpi-test-data/pc/DSDT.cphp--- tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)tests/bios-tables-test.c +26
-0@@ -801,6 +801,32 @@ static void test_acpi_q35_tcg_bridge(void)free_test_data (&data); } +static void test_acpi_piix4_tcg_cphp (void ) +{ +test_data data; + +memset (&data,0 ,sizeof (data)); + data.machine =MACHINE_PC ; + data.variant =".cphp" ; +test_acpi_one ("-machine accel=tcg" +" -smp 2,cores=3,sockets=2,maxcpus=6" , + &data); +free_test_data (&data); +} + +static void test_acpi_q35_tcg_cphp (void ) +{ +test_data data; + +memset (&data,0 ,sizeof (data)); + data.machine =MACHINE_Q35 ; + data.variant =".cphp" ; +test_acpi_one ("-machine q35,accel=tcg" +" -smp 2,cores=3,sockets=2,maxcpus=6" , + &data); +free_test_data (&data); +} +static uint8_t ipmi_required_struct_types[] = {0 ,1 ,3 ,4 ,16 ,17 ,19 ,32 ,38 ,127 };
tests/bios-tables-test.c int main(int argc, char *argv[]) · line 889
Quoted 8 lines
tests/bios-tables-test.c +2
-0@@ -856,6 +882,8 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/q35/tcg/bridge" , test_acpi_q35_tcg_bridge);qtest_add_func ("acpi/piix4/tcg/ipmi" , test_acpi_piix4_tcg_ipmi);qtest_add_func ("acpi/q35/tcg/ipmi" , test_acpi_q35_tcg_ipmi); +qtest_add_func ("acpi/piix4/tcg/cpuhp" , test_acpi_piix4_tcg_cphp); +qtest_add_func ("acpi/q35/tcg/cpuhp" , test_acpi_q35_tcg_cphp); } ret =g_test_run ();boot_sector_cleanup (disk);
Thanks,
Marcel
PATCH 2/4 tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs
In reply to Igor Mammedov--- tests/acpi-test-data/pc/APIC.cphp | Bin 0 -> 160 bytes tests/acpi-test-data/pc/DSDT.cphp | Bin 0 -> 6435 bytes tests/acpi-test-data/q35/APIC.cphp | Bin 0 -> 160 bytes tests/acpi-test-data/q35/DSDT.cphp | Bin 0 -> 9197 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/acpi-test-data/pc/APIC.cphp create mode 100644 tests/acpi-test-data/pc/DSDT.cphp create mode 100644 tests/acpi-test-data/q35/APIC.cphp create mode 100644 tests/acpi-test-data/q35/DSDT.cphp
tests/acpi-test-data/pc/APIC.cphp new file binary +0 -0
tests/acpi-test-data/pc/DSDT.cphp new file binary +0 -0
tests/acpi-test-data/q35/APIC.cphp new file binary +0 -0
tests/acpi-test-data/q35/DSDT.cphp new file binary +0 -0
Signature · 1 line
1.8.3.1
PATCH 3/4 acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
In reply to Igor Mammedovfixes long standing issue where Linux kernel would assing hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/acpi/cpu.c +9 -0
@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0
@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );
@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method); + +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + } +aml_append (cpus_dev, dev); } }
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 3/4] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
Quoted 34 lines · Igor Mammedov
fixes long standing issue where Linux kernel would assing hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
Signed-off-by Igor Mammedov <[email protected]>--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)hw/acpi/cpu.c +2
-0@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method);
hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 560
Quoted 10 lines
hw/acpi/cpu.c +7
-0+ +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + } +aml_append (cpus_dev, dev); } }
I would add, at least in the commit message, a pointer to the ACPI spec:
ACPI 5.0 (6.2.13)
-----------------
If the Local APIC ID / Local SAPIC ID / Local x2APIC ID of a dynamically added processor is not present in the System Resource Affinity Table (SRAT), a _PXM object must exist for the processor’s device or one of its ancestors in the ACPI Namespace.
I suppose we don't have the APIC id in SRAT for all possible CPUs, so it OK.
Thanks,
Marcel
Re: [Qemu-devel] [PATCH 3/4] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
Quoted 48 lines · On Thu, 30 Jun 2016 15:48:54 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 34 lines · Igor Mammedov
fixes long standing issue where Linux kernel would assing hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
Signed-off-by Igor Mammedov <[email protected]>--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)hw/acpi/cpu.c +2
-0@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method);hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 560
Quoted 10 lines
hw/acpi/cpu.c +7
-0+ +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + } +aml_append (cpus_dev, dev); } }I would add, at least in the commit message, a pointer to the ACPI spec:
Quoted 8 lines
ACPI 5.0 (6.2.13)
-----------------
If the Local APIC ID / Local SAPIC ID / Local x2APIC ID of a dynamically added processor is not present in the System Resource Affinity Table (SRAT), a_PXMobject must exist for the processor’s device or one of its ancestors in the ACPI Namespace.I suppose we don't have the APIC id in SRAT for all possible CPUs, so it OK.
we have entries for possible CPUs in SRAT and commit says that Linux discards it, hence we need to add _PXM to CPU objects. So broken linux handling would put hotplugged CPUs into corrected nodes.
To fix it on linux side, ACPI part probably would need to be refactored to store parsed tables info somewhere else, so it would be available past boot time (not a small undertaking) I'd say.
While fixing it on QEMU side is easy and works well even for currently released kernels.
Quoted 3 lines
Reviewed-by Marcel Apfelbaum <[email protected]>
Thanks!
Quoted 3 lines
Thanks,
Marcel
Re: [Qemu-devel] [PATCH 3/4] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
Quoted 58 lines · Igor Mammedov
Quoted 55 lines · On Thu, 30 Jun 2016 15:48:54 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 34 lines · Igor Mammedov
fixes long standing issue where Linux kernel would assing hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
Signed-off-by Igor Mammedov <[email protected]>--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)hw/acpi/cpu.c +2
-0@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method);hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 560
Quoted 10 lines
hw/acpi/cpu.c +7
-0+ +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + } +aml_append (cpus_dev, dev); } }I would add, at least in the commit message, a pointer to the ACPI spec:
ACPI 5.0 (6.2.13)
-----------------
If the Local APIC ID / Local SAPIC ID / Local x2APIC ID of a dynamically added processor is not present in the System Resource Affinity Table (SRAT), a_PXMobject must exist for the processor’s device or one of its ancestors in the ACPI Namespace.
Quoted 5 lines
Quoted 1 line
I suppose we don't have the APIC id in SRAT for all possible CPUs, so it OK.
we have entries for possible CPUs in SRAT and commit says that Linux discards it, hence we need to add
_PXMto CPU objects. So broken linux handling would put hotplugged CPUs into corrected nodes.
OK, so the commit message was misleading: "Fixes" :) Just flip "Fix" with "Workaround for... "
Quoted 3 lines
To fix it on linux side, ACPI part probably would need to be refactored to store parsed tables info somewhere else, so it would be available past boot time (not a small undertaking) I'd say.
Maybe we should at least report it to the right mailing list.
Quoted 3 lines
While fixing it on QEMU side is easy and works well even for currently released kernels.
I have nothing against this approach.
Thanks,
Marcel
Quoted 10 lines
Quoted 4 lines
Reviewed-by Marcel Apfelbaum <[email protected]>Thanks!
Quoted 3 lines
Thanks,
Marcel
Re: [Qemu-devel] [PATCH 3/4] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
Quoted 65 lines · Marcel Apfelbaum
Quoted 58 lines · Igor Mammedov
Quoted 55 lines · On Thu, 30 Jun 2016 15:48:54 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 34 lines · Igor Mammedov
fixes long standing issue where Linux kernel would assing hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
Signed-off-by Igor Mammedov <[email protected]>--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)hw/acpi/cpu.c +2
-0@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method);hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 560
Quoted 10 lines
hw/acpi/cpu.c +7
-0+ +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + } +aml_append (cpus_dev, dev); } }I would add, at least in the commit message, a pointer to the ACPI spec:
ACPI 5.0 (6.2.13)
-----------------
If the Local APIC ID / Local SAPIC ID / Local x2APIC ID of a dynamically added processor is not present in the System Resource Affinity Table (SRAT), a_PXMobject must exist for the processor’s device or one of its ancestors in the ACPI Namespace.Quoted 5 lines
Quoted 1 line
I suppose we don't have the APIC id in SRAT for all possible CPUs, so it OK.
we have entries for possible CPUs in SRAT and commit says that Linux discards it, hence we need to add
_PXMto CPU objects. So broken linux handling would put hotplugged CPUs into corrected nodes.
Quoted 8 lines
OK, so the commit message was misleading: "Fixes" :) Just flip "Fix" with "Workaround for... "
Quoted 3 lines
To fix it on linux side, ACPI part probably would need to be refactored to store parsed tables info somewhere else, so it would be available past boot time (not a small undertaking) I'd say.
Maybe we should at least report it to the right mailing list.
For sure, this can't hurt, but does not have to block this patch.
Quoted 20 lines
Quoted 4 lines
While fixing it on QEMU side is easy and works well even for currently released kernels.
I have nothing against this approach.
Thanks,
MarcelQuoted 10 lines
Quoted 4 lines
Reviewed-by Marcel Apfelbaum <[email protected]>Thanks!
Quoted 3 lines
Thanks,
Marcel
PATCH v2 3/4 acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
In reply to Igor MammedovWorkaround for long standing issue where Linux kernel assings hotplugged CPU to 1st numa node as it discards proximity for possible CPUs from SRAT after it's parsed.
_PXM method allows linux query proximity directly from hotplugged CPU object, which allows Linux to assing CPU to the correct numa node.
---
* ammended commit message
--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/acpi/cpu.c +9 -0
@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0
@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );
@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method); + +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + } +aml_append (cpus_dev, dev); } }
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 3/4] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
In reply to Igor MammedovQuoted 1 line · Igor Mammedov
fixes long standing issue where Linux kernel would assing
assign?
Quoted 29 lines
hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
Signed-off-by Igor Mammedov <[email protected]>--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)hw/acpi/cpu.c +2
-0@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );
hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 556
Quoted 9 lines
hw/acpi/cpu.c +6
-0@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method); + +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + }
this code is duplicated in a couple of other places. how about a helper to find the numa node for a CPU?
hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 560
Quoted 4 lines
hw/acpi/cpu.c +1
-0+aml_append (cpus_dev, dev); } }
I'd like a comment here explaining why it's needed. E.g. /*
* Linux guests discard SRAT info for non-present CPUs
* as a result _PXM is required for all CPUs which might
* be hot-plugged. For simplicity, add it for all CPUs. */
Quoted 2 lines
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 3/4] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled
On Thu, 30 Jun 2016 20:47:33 +0300
"Michael S. Tsirkin" <[email protected]> wrote:
Thanks for review,
I'll fix up patch according to your comments and post v3 shortly
Quoted 65 lines · Igor Mammedov
Quoted 1 line
fixes long standing issue where Linux kernel would assing
assign?
Quoted 29 lines
hotplugged CPU to 1st numa node as it discards proximity for hotplugged CPUs after SRAT is parsed.
Signed-off-by Igor Mammedov <[email protected]>--- hw/acpi/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)hw/acpi/cpu.c +2
-0@@ -4,6 +4,7 @@#include "qapi/error.h" #include "qapi-event.h" #include "trace.h" +#include "sysemu/numa.h" #define ACPI_CPU_HOTPLUG_REG_LEN 12#define ACPI_CPU_SELECTOR_OFFSET_WR 0@@ -503,6 +504,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,/* build Processor object for each processor */ for (i =0 ; i < arch_ids->len; i++) { +int j;Aml *dev;Aml *uid =aml_int (i);GArray *madt_buf =g_array_new (0 ,1 ,1 );hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 556
Quoted 9 lines
hw/acpi/cpu.c +6
-0@@ -546,6 +548,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) );aml_append (dev, method); + +for (j =0 ; j < nb_numa_nodes; j++) { +if (test_bit (i, numa_info[j].node_cpu)) { +aml_append (dev,aml_name_decl ("_PXM" ,aml_int (j))); + } + }this code is duplicated in a couple of other places. how about a helper to find the numa node for a CPU?
hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 560
Quoted 4 lines
hw/acpi/cpu.c +1
-0+aml_append (cpus_dev, dev); } }I'd like a comment here explaining why it's needed. E.g. /*
* Linux guests discard SRAT info for non-present CPUs
* as a result_PXMis required for all CPUs which might
* be hot-plugged. For simplicity, add it for all CPUs. */Quoted 2 lines
Signature · 1 line
1.8.3.1
PATCH 4/4 tests: acpi: extend cphp testcase with numa check
In reply to Igor Mammedovso it would be possible to verify _PXM generation in DSDT and SRAT tables.
---
NOTE to maintainer:
SRAT table is included in patch as it doesn't have any chance for conflicts compared to often changing DSDT
following table blobs should be updated in git tree as part
of this commit after running ./tests/acpi-test-data/rebuild-expected-aml.sh
tests/acpi-test-data/q35/DSDT.cphp
tests/acpi-test-data/pc/DSDT.cphp
--- tests/acpi-test-data/pc/SRAT.cphp | Bin 0 -> 304 bytes tests/acpi-test-data/q35/SRAT.cphp | Bin 0 -> 304 bytes tests/bios-tables-test.c | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 tests/acpi-test-data/pc/SRAT.cphp create mode 100644 tests/acpi-test-data/q35/SRAT.cphp
tests/acpi-test-data/pc/SRAT.cphp new file binary +0 -0
tests/acpi-test-data/q35/SRAT.cphp new file binary +0 -0
tests/bios-tables-test.c +4 -2
@@ -809,7 +809,8 @@ static void test_acpi_piix4_tcg_cphp(void) data.machine =MACHINE_PC ; data.variant =".cphp" ;test_acpi_one ("-machine accel=tcg" -" -smp 2,cores=3,sockets=2,maxcpus=6" , +" -smp 2,cores=3,sockets=2,maxcpus=6" +" -numa node -numa node" , &data);free_test_data (&data); }
@@ -822,7 +823,8 @@ static void test_acpi_q35_tcg_cphp(void) data.machine =MACHINE_Q35 ; data.variant =".cphp" ;test_acpi_one ("-machine q35,accel=tcg" -" -smp 2,cores=3,sockets=2,maxcpus=6" , +" -smp 2,cores=3,sockets=2,maxcpus=6" +" -numa node -numa node" , &data);free_test_data (&data); }
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 4/4] tests: acpi: extend cphp testcase with numa check
Quoted 61 lines · Igor Mammedov
so it would be possible to verify
_PXMgeneration in DSDT and SRAT tables.Signed-off-by Igor Mammedov <[email protected]>---
NOTE to maintainer:
SRAT table is included in patch as it doesn't have any chance for conflicts compared to often changing DSDTfollowing table blobs should be updated in git tree as part
of this commit after running./tests/acpi-test-data/rebuild-expected-aml.shtests/acpi-test-data/q35/DSDT.cphp
tests/acpi-test-data/pc/DSDT.cphp--- tests/acpi-test-data/pc/SRAT.cphp | Bin 0 -> 304 bytes tests/acpi-test-data/q35/SRAT.cphp | Bin 0 -> 304 bytes tests/bios-tables-test.c | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-)create mode 100644 tests/acpi-test-data/pc/SRAT.cphp create mode 100644 tests/acpi-test-data/q35/SRAT.cphp
tests/acpi-test-data/pc/SRAT.cphp new file binary +0
-0tests/acpi-test-data/q35/SRAT.cphp new file binary +0
-0tests/bios-tables-test.c +2
-1@@ -809,7 +809,8 @@ static void test_acpi_piix4_tcg_cphp(void) data.machine =MACHINE_PC ; data.variant =".cphp" ;test_acpi_one ("-machine accel=tcg" -" -smp 2,cores=3,sockets=2,maxcpus=6" , +" -smp 2,cores=3,sockets=2,maxcpus=6" +" -numa node -numa node" , &data);free_test_data (&data); }
tests/bios-tables-test.c static void test_acpi_q35_tcg_cphp(void) · line 830
Quoted 9 lines
tests/bios-tables-test.c +2
-1@@ -822,7 +823,8 @@ static void test_acpi_q35_tcg_cphp(void) data.machine =MACHINE_Q35 ; data.variant =".cphp" ;test_acpi_one ("-machine q35,accel=tcg" -" -smp 2,cores=3,sockets=2,maxcpus=6" , +" -smp 2,cores=3,sockets=2,maxcpus=6" +" -numa node -numa node" , &data);free_test_data (&data); }
Thanks,
Marcel