* [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs @ 2016-07-01 11:50 Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 1/5] tests: acpi: add CPU hotplug testcase Igor Mammedov ` (4 more replies) 0 siblings, 5 replies; 13+ messages in thread From: Igor Mammedov @ 2016-07-01 11:50 UTC (permalink / raw) To: qemu-devel; +Cc: mst, zhaoshenglong, peter.maydell, david, marcel Changelog: v1->v3: - fix commit message for 4/5 - add numa_get_node_for_cpu() helper - add comment in code explaining why _PXM is being added 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 (5): tests: acpi: add CPU hotplug testcase tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs numa: reduce code duplication by adding helper numa_get_node_for_cpu() 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 | 12 ++++++++++++ hw/arm/virt-acpi-build.c | 6 ++---- hw/arm/virt.c | 7 +++---- hw/i386/acpi-build.c | 7 ++----- hw/i386/pc.c | 8 +++----- hw/ppc/spapr_cpu_core.c | 6 ++---- include/sysemu/numa.h | 3 +++ numa.c | 12 ++++++++++++ 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 ++++++++++++++++++++++++++++++ 15 files changed, 69 insertions(+), 22 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/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 -- 1.8.3.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH v3 1/5] tests: acpi: add CPU hotplug testcase 2016-07-01 11:50 [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs Igor Mammedov @ 2016-07-01 11:50 ` Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 2/5] tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs Igor Mammedov ` (3 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Igor Mammedov @ 2016-07-01 11:50 UTC (permalink / raw) To: qemu-devel; +Cc: mst, zhaoshenglong, peter.maydell, david, marcel Test with: -smp 2,cores=3,sockets=2,maxcpus=6 to capture sparse APIC ID values that default AMD CPU has in above configuration. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> --- 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(+) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 92c90dd..de4019e 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -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); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH v3 2/5] tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs 2016-07-01 11:50 [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 1/5] tests: acpi: add CPU hotplug testcase Igor Mammedov @ 2016-07-01 11:50 ` Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() Igor Mammedov ` (2 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Igor Mammedov @ 2016-07-01 11:50 UTC (permalink / raw) To: qemu-devel; +Cc: mst, zhaoshenglong, peter.maydell, david, marcel Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- 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 diff --git a/tests/acpi-test-data/pc/APIC.cphp b/tests/acpi-test-data/pc/APIC.cphp new file mode 100644 index 0000000000000000000000000000000000000000..1bf8a0a63bc1c9b716d937b96eb34b05016b9366 GIT binary patch literal 160 zcmXwx!3}^Q3`JW6f}%UP3UJYrBwpObWgNv(oJ8%n@zB24pP!~WmxG9S&r6xsF>kdb z$yhQtNOavFgY<9)W~DJWDKu7Tozi)bd+hVZHk}Lv=1?18ZTnj%1<hjo%=$-Oyrt<4 A0RR91 literal 0 HcmV?d00001 diff --git a/tests/acpi-test-data/pc/DSDT.cphp b/tests/acpi-test-data/pc/DSDT.cphp new file mode 100644 index 0000000000000000000000000000000000000000..e8b146208eb3877e1cde2cc361c5afd270d194c6 GIT binary patch literal 6435 zcmb7IUvC@75#PN#O2;KB9i_7@TXsyyPSUt_%s;Y{phaQwjuL6{s56gpU7XQ7$_h#u zX?;*^Ac_z`VgSX-TfjPK-)KY6_D5(xLOwzY^b@3L;-{!Hciba=(g6tpQ8PQg{q4-| z?CdUeOK)F3M+p5-WnHUTxyoHr)1i$LLQuy4N?p1~?0vnm>d=%RQTrg}%kWi^)!*oq zjaB;huKSJaKKjC?9gl22SDtQmyw9Jwn*>3RH$BEsP!=7l;@G_fQ>*7?r&ia~<!_lN zJ7v8^WM`wUQ^k-2OjWL#)iwuF0D&3YsF`hpqzU=<rxcOw0|oWjJJqJ1Gh4coQ<oj9 zT_zs3xE?ljK6RPm4$@!uUD9_`$HzxxF!go6L;luDlYjp&aYT;TwCrdtE1P9ghe?PS z$caSAE>Yfm7rjAu?cO=_ZlUD+nidHKSIk0569_w2ZYIWHnpC&SPJn}nMch(e6PU}u z-M9YqF0x=xLTcB^WW%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test-data/q35/APIC.cphp new file mode 100644 index 0000000000000000000000000000000000000000..1bf8a0a63bc1c9b716d937b96eb34b05016b9366 GIT binary patch literal 160 zcmXwx!3}^Q3`JW6f}%UP3UJYrBwpObWgNv(oJ8%n@zB24pP!~WmxG9S&r6xsF>kdb z$yhQtNOavFgY<9)W~DJWDKu7Tozi)bd+hVZHk}Lv=1?18ZTnj%1<hjo%=$-Oyrt<4 A0RR91 literal 0 HcmV?d00001 diff --git a/tests/acpi-test-data/q35/DSDT.cphp b/tests/acpi-test-data/q35/DSDT.cphp new file mode 100644 index 0000000000000000000000000000000000000000..6cc28c6daec2b331030ab0600a4d79034c1dfc40 GIT binary patch literal 9197 zcmb7KU2hx56`duQ)M`mdD`_RmUy)!JO_SCMB{^=<kHF+EMY7^b6iMd;G(g%-S}AFp zh2j87g8-HS<iigI5;j5mMhAM%Uub?p-Ws4!eJ#+ZqKKcOo_mKw%`7D#)&n_r_MCg? z?C#7N?ka4B?f+aA!n#q~4yvt{(o2mXM4u&upf-JbHT$;c+z(5Yu9ZvKR_7qcZG4m* z|0iMTR>k`3ZtwG6@7{+!>rO20e&Ky~_fGu&N4>j(KyTfRU6&f(Q{7gn+qvHeT5T&Q zzI5~4E?K$!my{O$rJIeQR&u=UJVOsFdBg>$Tdjrp;@7U@bOYH+JKbW~6i)Y6Ewr50 ztwuvQLAzNOemL3PZUy#(*F_M%xH{OF=<m+XyIv>y=lZwHmu`Ok;=STmzxu~-AH43` z0IcEL!S{Mh0p+2_I;DD-KHSUnIq*L1?^*BR$SR{(2aBKf6;5`0bTB3`^*_wZUMjJA z^tu;0Qcu~bHp*?K$ASusA7{7PXh$M1#Mj^DgxxvtD4u_zycMoAnqhavztL^Aiz23; zUQAtg{?v25-XQ-;zbE>=-0|^|7)*cCza#!~Colf>zs!+1a%XV1nyuMcclv`#Tu3Ar zwh-?K@8-laG#om$ox>noYZbeEIx&D{45m?Q?xfrvU7kAbhm?EYO?3{=Q(FYvQ86tn ze3kH3Z?wY{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N#sjgvoj9)=Sbf+=cx@^v&S(VKn*2}8*X*7qui&62V zA@%~A)i`RFszjnjof4r@uM&Y8bxN{N-P9m11$>y;1OGGXqvQJ&TiiLzoz}fk54Gxa ztUd@Q`qV8Td3|km*}e23T=hgUNhO&ik>#zgxh~Rop$W}taEHxB45%AZWjY*Fayl5( zIO)*v3K4D8ym8(CLDYCDvXU1dMsHVL)SmyN2<wDB2HK0Z%P+*Q;b0(B`d1<>E~zn~ zh3?@1JihUHFEI34+|mAd%!GB_Cg`rGTh*)Or9;bqpP-lPr3v?sA5DoAp8U~?p%1() zf0Tcew;c3a^5lJs!;kW#c#2QsfAy2=;-u2AUHVH2K0*_h{=Pas{`+^s=JWJYJ+Lub z<-czvrXlrf+ZX(MM7!wb<c6BJFDu!Vtc5r8-cz?Rb6e}(xvWj=DB9P%bB^t%Tr8J} zo}(jF)ceJW<j&zU8!rZO>o~Pjj&5PCUn6v)ikI;+v`O-U>D&BvJaV+{7q20_8fXK< z&wW=c(Y~tMh?@967S~<s94u3irh9*dW&%Fy)T*O}TVkbiaG3x_ant45jC&1h1TP7= z#Q5iz1<9u^7u_BBXay^NmKKbZw_(eF)yTC91^kZ!{o_mL@ab0JXEMMgvjjHTt<@0A R7B$vXW1Sn>MzGZu{|B7Hnt1>K literal 0 HcmV?d00001 -- 1.8.3.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-07-01 11:50 [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 1/5] tests: acpi: add CPU hotplug testcase Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 2/5] tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs Igor Mammedov @ 2016-07-01 11:50 ` Igor Mammedov 2016-07-01 12:30 ` Andrew Jones ` (2 more replies) 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 4/5] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check Igor Mammedov 4 siblings, 3 replies; 13+ messages in thread From: Igor Mammedov @ 2016-07-01 11:50 UTC (permalink / raw) To: qemu-devel; +Cc: mst, zhaoshenglong, peter.maydell, david, marcel Replace repeated pattern for (i = 0; i < nb_numa_nodes; i++) { if (test_bit(idx, numa_info[i].node_cpu)) { ... break; with a helper function to lookup numa node index for cpu. Suggested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/arm/virt-acpi-build.c | 6 ++---- hw/arm/virt.c | 7 +++---- hw/i386/acpi-build.c | 7 ++----- hw/i386/pc.c | 8 +++----- hw/ppc/spapr_cpu_core.c | 6 ++---- include/sysemu/numa.h | 3 +++ numa.c | 12 ++++++++++++ 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 28fc59c..5923b3d 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -426,11 +426,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); for (i = 0; i < guest_info->smp_cpus; i++) { - for (j = 0; j < nb_numa_nodes; j++) { - if (test_bit(i, numa_info[j].node_cpu)) { + j = numa_get_node_for_cpu(i); + if (j < nb_numa_nodes) { cpu_node[i] = j; - break; - } } } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index c5c125e..b066f15 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -411,10 +411,9 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) armcpu->mp_affinity); } - for (i = 0; i < nb_numa_nodes; i++) { - if (test_bit(cpu, numa_info[i].node_cpu)) { - qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); - } + i = numa_get_node_for_cpu(cpu); + if (i < nb_numa_nodes) { + qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); } g_free(nodename); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 5a594be..60be550 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2344,18 +2344,15 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) srat->reserved1 = cpu_to_le32(1); for (i = 0; i < apic_ids->len; i++) { - int j; + int j = numa_get_node_for_cpu(i); int apic_id = apic_ids->cpus[i].arch_id; core = acpi_data_push(table_data, sizeof *core); core->type = ACPI_SRAT_PROCESSOR_APIC; core->length = sizeof(*core); core->local_apic_id = apic_id; - for (j = 0; j < nb_numa_nodes; j++) { - if (test_bit(i, numa_info[j].node_cpu)) { + if (j < nb_numa_nodes) { core->proximity_lo = j; - break; - } } memset(core->proximity_hi, 0, 3); core->local_sapic_eid = 0; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 44a8f3b..fef34e7 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -780,11 +780,9 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) for (i = 0; i < max_cpus; i++) { unsigned int apic_id = x86_cpu_apic_id_from_index(i); assert(apic_id < pcms->apic_id_limit); - for (j = 0; j < nb_numa_nodes; j++) { - if (test_bit(i, numa_info[j].node_cpu)) { - numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); - break; - } + j = numa_get_node_for_cpu(i); + if (j < nb_numa_nodes) { + numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); } } for (i = 0; i < nb_numa_nodes; i++) { diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 3a5da09..030016c 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -69,11 +69,9 @@ void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp) } /* Set NUMA node for the added CPUs */ - for (i = 0; i < nb_numa_nodes; i++) { - if (test_bit(cs->cpu_index, numa_info[i].node_cpu)) { + i = numa_get_node_for_cpu(cs->cpu_index); + if (i < nb_numa_nodes) { cs->numa_node = i; - break; - } } xics_cpu_setup(spapr->icp, cpu); diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index bb184c9..4da808a 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -32,4 +32,7 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); uint32_t numa_get_node(ram_addr_t addr, Error **errp); +/* on success returns node index in numa_info, + * on failure returns nb_numa_nodes */ +int numa_get_node_for_cpu(int idx); #endif diff --git a/numa.c b/numa.c index 572712c..5790858 100644 --- a/numa.c +++ b/numa.c @@ -548,3 +548,15 @@ MemdevList *qmp_query_memdev(Error **errp) object_child_foreach(obj, query_memdev, &list); return list; } + +int numa_get_node_for_cpu(int idx) +{ + int i; + + for (i = 0; i < nb_numa_nodes; i++) { + if (test_bit(idx, numa_info[i].node_cpu)) { + break; + } + } + return i; +} -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() Igor Mammedov @ 2016-07-01 12:30 ` Andrew Jones 2016-07-04 7:06 ` Igor Mammedov 2016-07-04 3:34 ` David Gibson 2016-07-04 12:13 ` Michael S. Tsirkin 2 siblings, 1 reply; 13+ messages in thread From: Andrew Jones @ 2016-07-01 12:30 UTC (permalink / raw) To: Igor Mammedov Cc: qemu-devel, marcel, peter.maydell, zhaoshenglong, david, mst On Fri, Jul 01, 2016 at 01:50:24PM +0200, Igor Mammedov wrote: > Replace repeated pattern > > for (i = 0; i < nb_numa_nodes; i++) { > if (test_bit(idx, numa_info[i].node_cpu)) { > ... > break; > > with a helper function to lookup numa node index for cpu. > > Suggested-by: Michael S. Tsirkin <mst@redhat.com> > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > --- > hw/arm/virt-acpi-build.c | 6 ++---- > hw/arm/virt.c | 7 +++---- > hw/i386/acpi-build.c | 7 ++----- > hw/i386/pc.c | 8 +++----- > hw/ppc/spapr_cpu_core.c | 6 ++---- > include/sysemu/numa.h | 3 +++ > numa.c | 12 ++++++++++++ > 7 files changed, 27 insertions(+), 22 deletions(-) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 28fc59c..5923b3d 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -426,11 +426,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) > uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); > > for (i = 0; i < guest_info->smp_cpus; i++) { > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > + j = numa_get_node_for_cpu(i); > + if (j < nb_numa_nodes) { > cpu_node[i] = j; I think this, and all other occurrences, would read nicer like if (numa_enabled()) { cpu_node[i] = numa_get_node_for_cpu(i); } We just need to also add bool numa_enabled() { return nb_numa_nodes != 0; } > - break; > - } > } > } > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index c5c125e..b066f15 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -411,10 +411,9 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) > armcpu->mp_affinity); > } > > - for (i = 0; i < nb_numa_nodes; i++) { > - if (test_bit(cpu, numa_info[i].node_cpu)) { > - qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); We were missing the break here, which I had queued to send some day, now I don't need to :-) > - } > + i = numa_get_node_for_cpu(cpu); > + if (i < nb_numa_nodes) { > + qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); > } > > g_free(nodename); > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 5a594be..60be550 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -2344,18 +2344,15 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) > srat->reserved1 = cpu_to_le32(1); > > for (i = 0; i < apic_ids->len; i++) { > - int j; > + int j = numa_get_node_for_cpu(i); > int apic_id = apic_ids->cpus[i].arch_id; > > core = acpi_data_push(table_data, sizeof *core); > core->type = ACPI_SRAT_PROCESSOR_APIC; > core->length = sizeof(*core); > core->local_apic_id = apic_id; > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > + if (j < nb_numa_nodes) { > core->proximity_lo = j; > - break; > - } > } > memset(core->proximity_hi, 0, 3); > core->local_sapic_eid = 0; > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 44a8f3b..fef34e7 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -780,11 +780,9 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) > for (i = 0; i < max_cpus; i++) { > unsigned int apic_id = x86_cpu_apic_id_from_index(i); > assert(apic_id < pcms->apic_id_limit); > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > - numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > - break; > - } > + j = numa_get_node_for_cpu(i); > + if (j < nb_numa_nodes) { > + numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > } > } > for (i = 0; i < nb_numa_nodes; i++) { > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > index 3a5da09..030016c 100644 > --- a/hw/ppc/spapr_cpu_core.c > +++ b/hw/ppc/spapr_cpu_core.c > @@ -69,11 +69,9 @@ void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp) > } > > /* Set NUMA node for the added CPUs */ > - for (i = 0; i < nb_numa_nodes; i++) { > - if (test_bit(cs->cpu_index, numa_info[i].node_cpu)) { > + i = numa_get_node_for_cpu(cs->cpu_index); > + if (i < nb_numa_nodes) { > cs->numa_node = i; > - break; > - } > } > > xics_cpu_setup(spapr->icp, cpu); > diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h > index bb184c9..4da808a 100644 > --- a/include/sysemu/numa.h > +++ b/include/sysemu/numa.h > @@ -32,4 +32,7 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); > void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); > uint32_t numa_get_node(ram_addr_t addr, Error **errp); > > +/* on success returns node index in numa_info, > + * on failure returns nb_numa_nodes */ Or zero when nb_numa_nodes == 0, which requires another condition to disambiguate it from node=0. You could return -1 for both failure to find the node and for when nb_numa_nodes == 0, but no users are checking for error right now, only for nb_numa_nodes == 0, which, as I said above, would look better with numa_enabled() > +int numa_get_node_for_cpu(int idx); > #endif > diff --git a/numa.c b/numa.c > index 572712c..5790858 100644 > --- a/numa.c > +++ b/numa.c > @@ -548,3 +548,15 @@ MemdevList *qmp_query_memdev(Error **errp) > object_child_foreach(obj, query_memdev, &list); > return list; > } > + > +int numa_get_node_for_cpu(int idx) > +{ > + int i; > + > + for (i = 0; i < nb_numa_nodes; i++) { > + if (test_bit(idx, numa_info[i].node_cpu)) { > + break; > + } > + } > + return i; > +} > -- > 1.8.3.1 > > numa.c has one of these patterns too in numa_post_machine_init that could be replaced. Thanks, drew ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-07-01 12:30 ` Andrew Jones @ 2016-07-04 7:06 ` Igor Mammedov 2016-07-07 12:03 ` Andrew Jones 0 siblings, 1 reply; 13+ messages in thread From: Igor Mammedov @ 2016-07-04 7:06 UTC (permalink / raw) To: Andrew Jones; +Cc: qemu-devel, marcel, peter.maydell, zhaoshenglong, david, mst On Fri, 1 Jul 2016 14:30:12 +0200 Andrew Jones <drjones@redhat.com> wrote: > On Fri, Jul 01, 2016 at 01:50:24PM +0200, Igor Mammedov wrote: > > Replace repeated pattern > > > > for (i = 0; i < nb_numa_nodes; i++) { > > if (test_bit(idx, numa_info[i].node_cpu)) { > > ... > > break; > > > > with a helper function to lookup numa node index for cpu. > > > > Suggested-by: Michael S. Tsirkin <mst@redhat.com> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > --- > > hw/arm/virt-acpi-build.c | 6 ++---- > > hw/arm/virt.c | 7 +++---- > > hw/i386/acpi-build.c | 7 ++----- > > hw/i386/pc.c | 8 +++----- > > hw/ppc/spapr_cpu_core.c | 6 ++---- > > include/sysemu/numa.h | 3 +++ > > numa.c | 12 ++++++++++++ > > 7 files changed, 27 insertions(+), 22 deletions(-) > > > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > > index 28fc59c..5923b3d 100644 > > --- a/hw/arm/virt-acpi-build.c > > +++ b/hw/arm/virt-acpi-build.c > > @@ -426,11 +426,9 @@ build_srat(GArray *table_data, BIOSLinker > > *linker, VirtGuestInfo *guest_info) uint32_t *cpu_node = > > g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); > > for (i = 0; i < guest_info->smp_cpus; i++) { > > - for (j = 0; j < nb_numa_nodes; j++) { > > - if (test_bit(i, numa_info[j].node_cpu)) { > > + j = numa_get_node_for_cpu(i); > > + if (j < nb_numa_nodes) { > > cpu_node[i] = j; > > I think this, and all other occurrences, would read nicer like > > if (numa_enabled()) { > cpu_node[i] = numa_get_node_for_cpu(i); > } it would be nicer but it could be a guest visible change as in case of if cpu is not in numa_info[].node_cpu then old code won't do assignment, if done as suggested it will assign whatever value numa_get_node_for_cpu(i) returns. > > We just need to also add > > bool numa_enabled() > { > return nb_numa_nodes != 0; > } > > > - break; > > - } > > } > > } > > > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > > index c5c125e..b066f15 100644 > > --- a/hw/arm/virt.c > > +++ b/hw/arm/virt.c > > @@ -411,10 +411,9 @@ static void fdt_add_cpu_nodes(const > > VirtBoardInfo *vbi) armcpu->mp_affinity); > > } > > > > - for (i = 0; i < nb_numa_nodes; i++) { > > - if (test_bit(cpu, numa_info[i].node_cpu)) { > > - qemu_fdt_setprop_cell(vbi->fdt, nodename, > > "numa-node-id", i); > > We were missing the break here, which I had queued to send some day, > now I don't need to :-) > > > - } > > + i = numa_get_node_for_cpu(cpu); > > + if (i < nb_numa_nodes) { > > + qemu_fdt_setprop_cell(vbi->fdt, nodename, > > "numa-node-id", i); } > > > > g_free(nodename); > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > > index 5a594be..60be550 100644 > > --- a/hw/i386/acpi-build.c > > +++ b/hw/i386/acpi-build.c > > @@ -2344,18 +2344,15 @@ build_srat(GArray *table_data, BIOSLinker > > *linker, MachineState *machine) srat->reserved1 = cpu_to_le32(1); > > > > for (i = 0; i < apic_ids->len; i++) { > > - int j; > > + int j = numa_get_node_for_cpu(i); > > int apic_id = apic_ids->cpus[i].arch_id; > > > > core = acpi_data_push(table_data, sizeof *core); > > core->type = ACPI_SRAT_PROCESSOR_APIC; > > core->length = sizeof(*core); > > core->local_apic_id = apic_id; > > - for (j = 0; j < nb_numa_nodes; j++) { > > - if (test_bit(i, numa_info[j].node_cpu)) { > > + if (j < nb_numa_nodes) { > > core->proximity_lo = j; > > - break; > > - } > > } > > memset(core->proximity_hi, 0, 3); > > core->local_sapic_eid = 0; > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > index 44a8f3b..fef34e7 100644 > > --- a/hw/i386/pc.c > > +++ b/hw/i386/pc.c > > @@ -780,11 +780,9 @@ static FWCfgState > > *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) for (i = > > 0; i < max_cpus; i++) { unsigned int apic_id = > > x86_cpu_apic_id_from_index(i); assert(apic_id < > > pcms->apic_id_limit); > > - for (j = 0; j < nb_numa_nodes; j++) { > > - if (test_bit(i, numa_info[j].node_cpu)) { > > - numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > > - break; > > - } > > + j = numa_get_node_for_cpu(i); > > + if (j < nb_numa_nodes) { > > + numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > > } > > } > > for (i = 0; i < nb_numa_nodes; i++) { > > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > > index 3a5da09..030016c 100644 > > --- a/hw/ppc/spapr_cpu_core.c > > +++ b/hw/ppc/spapr_cpu_core.c > > @@ -69,11 +69,9 @@ void spapr_cpu_init(sPAPRMachineState *spapr, > > PowerPCCPU *cpu, Error **errp) } > > > > /* Set NUMA node for the added CPUs */ > > - for (i = 0; i < nb_numa_nodes; i++) { > > - if (test_bit(cs->cpu_index, numa_info[i].node_cpu)) { > > + i = numa_get_node_for_cpu(cs->cpu_index); > > + if (i < nb_numa_nodes) { > > cs->numa_node = i; > > - break; > > - } > > } > > > > xics_cpu_setup(spapr->icp, cpu); > > diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h > > index bb184c9..4da808a 100644 > > --- a/include/sysemu/numa.h > > +++ b/include/sysemu/numa.h > > @@ -32,4 +32,7 @@ void numa_set_mem_node_id(ram_addr_t addr, > > uint64_t size, uint32_t node); void > > numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t > > node); uint32_t numa_get_node(ram_addr_t addr, Error **errp); > > +/* on success returns node index in numa_info, > > + * on failure returns nb_numa_nodes */ > > Or zero when nb_numa_nodes == 0, which requires another > condition to disambiguate it from node=0. You could > return -1 for both failure to find the node and for > when nb_numa_nodes == 0, but no users are checking > for error right now, only for nb_numa_nodes == 0, which, > as I said above, would look better with numa_enabled() > > > +int numa_get_node_for_cpu(int idx); > > #endif > > diff --git a/numa.c b/numa.c > > index 572712c..5790858 100644 > > --- a/numa.c > > +++ b/numa.c > > @@ -548,3 +548,15 @@ MemdevList *qmp_query_memdev(Error **errp) > > object_child_foreach(obj, query_memdev, &list); > > return list; > > } > > + > > +int numa_get_node_for_cpu(int idx) > > +{ > > + int i; > > + > > + for (i = 0; i < nb_numa_nodes; i++) { > > + if (test_bit(idx, numa_info[i].node_cpu)) { > > + break; > > + } > > + } > > + return i; > > +} > > -- > > 1.8.3.1 > > > > > > numa.c has one of these patterns too in numa_post_machine_init that > could be replaced. I didn't touch it intentionally as numa_post_machine_init is broken code when combined with sparse cpu_index and I plan to remove it in favor of explicit assignment (spapr does it, pc needs to be taught) or may be event redo sole user of CPUState:numa_node (HMP command info numa) and drop CPUState:numa_node field along with numa_post_machine_init() but all that said it's topic for another not related patch. > > Thanks, > drew ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-07-04 7:06 ` Igor Mammedov @ 2016-07-07 12:03 ` Andrew Jones 0 siblings, 0 replies; 13+ messages in thread From: Andrew Jones @ 2016-07-07 12:03 UTC (permalink / raw) To: Igor Mammedov Cc: peter.maydell, mst, qemu-devel, zhaoshenglong, marcel, david On Mon, Jul 04, 2016 at 09:06:16AM +0200, Igor Mammedov wrote: > On Fri, 1 Jul 2016 14:30:12 +0200 > Andrew Jones <drjones@redhat.com> wrote: > > On Fri, Jul 01, 2016 at 01:50:24PM +0200, Igor Mammedov wrote: > > > --- a/hw/arm/virt-acpi-build.c > > > +++ b/hw/arm/virt-acpi-build.c > > > @@ -426,11 +426,9 @@ build_srat(GArray *table_data, BIOSLinker > > > *linker, VirtGuestInfo *guest_info) uint32_t *cpu_node = > > > g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); > > > for (i = 0; i < guest_info->smp_cpus; i++) { > > > - for (j = 0; j < nb_numa_nodes; j++) { > > > - if (test_bit(i, numa_info[j].node_cpu)) { > > > + j = numa_get_node_for_cpu(i); > > > + if (j < nb_numa_nodes) { > > > cpu_node[i] = j; > > > > I think this, and all other occurrences, would read nicer like > > > > if (numa_enabled()) { > > cpu_node[i] = numa_get_node_for_cpu(i); > > } > it would be nicer but it could be a guest visible change as in case of > if cpu is not in numa_info[].node_cpu then old code won't do > assignment, if done as suggested it will assign whatever value > numa_get_node_for_cpu(i) returns. I see. So how about creating static inline bool numa_node_is_valid(int node) { return node >= 0 && node < nb_numa_nodes; } and then using that for the condition, instead of the inequality. It's not a huge improvement, so take it or leave it. Thanks, drew ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() Igor Mammedov 2016-07-01 12:30 ` Andrew Jones @ 2016-07-04 3:34 ` David Gibson 2016-07-04 12:13 ` Michael S. Tsirkin 2 siblings, 0 replies; 13+ messages in thread From: David Gibson @ 2016-07-04 3:34 UTC (permalink / raw) To: Igor Mammedov; +Cc: qemu-devel, mst, zhaoshenglong, peter.maydell, marcel [-- Attachment #1: Type: text/plain, Size: 5921 bytes --] On Fri, Jul 01, 2016 at 01:50:24PM +0200, Igor Mammedov wrote: > Replace repeated pattern > > for (i = 0; i < nb_numa_nodes; i++) { > if (test_bit(idx, numa_info[i].node_cpu)) { > ... > break; > > with a helper function to lookup numa node index for cpu. > > Suggested-by: Michael S. Tsirkin <mst@redhat.com> > Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > hw/arm/virt-acpi-build.c | 6 ++---- > hw/arm/virt.c | 7 +++---- > hw/i386/acpi-build.c | 7 ++----- > hw/i386/pc.c | 8 +++----- > hw/ppc/spapr_cpu_core.c | 6 ++---- > include/sysemu/numa.h | 3 +++ > numa.c | 12 ++++++++++++ > 7 files changed, 27 insertions(+), 22 deletions(-) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 28fc59c..5923b3d 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -426,11 +426,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) > uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); > > for (i = 0; i < guest_info->smp_cpus; i++) { > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > + j = numa_get_node_for_cpu(i); > + if (j < nb_numa_nodes) { > cpu_node[i] = j; > - break; > - } > } > } > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index c5c125e..b066f15 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -411,10 +411,9 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) > armcpu->mp_affinity); > } > > - for (i = 0; i < nb_numa_nodes; i++) { > - if (test_bit(cpu, numa_info[i].node_cpu)) { > - qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); > - } > + i = numa_get_node_for_cpu(cpu); > + if (i < nb_numa_nodes) { > + qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); > } > > g_free(nodename); > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 5a594be..60be550 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -2344,18 +2344,15 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) > srat->reserved1 = cpu_to_le32(1); > > for (i = 0; i < apic_ids->len; i++) { > - int j; > + int j = numa_get_node_for_cpu(i); > int apic_id = apic_ids->cpus[i].arch_id; > > core = acpi_data_push(table_data, sizeof *core); > core->type = ACPI_SRAT_PROCESSOR_APIC; > core->length = sizeof(*core); > core->local_apic_id = apic_id; > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > + if (j < nb_numa_nodes) { > core->proximity_lo = j; > - break; > - } > } > memset(core->proximity_hi, 0, 3); > core->local_sapic_eid = 0; > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 44a8f3b..fef34e7 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -780,11 +780,9 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) > for (i = 0; i < max_cpus; i++) { > unsigned int apic_id = x86_cpu_apic_id_from_index(i); > assert(apic_id < pcms->apic_id_limit); > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > - numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > - break; > - } > + j = numa_get_node_for_cpu(i); > + if (j < nb_numa_nodes) { > + numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > } > } > for (i = 0; i < nb_numa_nodes; i++) { > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > index 3a5da09..030016c 100644 > --- a/hw/ppc/spapr_cpu_core.c > +++ b/hw/ppc/spapr_cpu_core.c > @@ -69,11 +69,9 @@ void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp) > } > > /* Set NUMA node for the added CPUs */ > - for (i = 0; i < nb_numa_nodes; i++) { > - if (test_bit(cs->cpu_index, numa_info[i].node_cpu)) { > + i = numa_get_node_for_cpu(cs->cpu_index); > + if (i < nb_numa_nodes) { > cs->numa_node = i; > - break; > - } > } > > xics_cpu_setup(spapr->icp, cpu); > diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h > index bb184c9..4da808a 100644 > --- a/include/sysemu/numa.h > +++ b/include/sysemu/numa.h > @@ -32,4 +32,7 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); > void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); > uint32_t numa_get_node(ram_addr_t addr, Error **errp); > > +/* on success returns node index in numa_info, > + * on failure returns nb_numa_nodes */ > +int numa_get_node_for_cpu(int idx); > #endif > diff --git a/numa.c b/numa.c > index 572712c..5790858 100644 > --- a/numa.c > +++ b/numa.c > @@ -548,3 +548,15 @@ MemdevList *qmp_query_memdev(Error **errp) > object_child_foreach(obj, query_memdev, &list); > return list; > } > + > +int numa_get_node_for_cpu(int idx) > +{ > + int i; > + > + for (i = 0; i < nb_numa_nodes; i++) { > + if (test_bit(idx, numa_info[i].node_cpu)) { > + break; > + } > + } > + return i; > +} -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() Igor Mammedov 2016-07-01 12:30 ` Andrew Jones 2016-07-04 3:34 ` David Gibson @ 2016-07-04 12:13 ` Michael S. Tsirkin 2 siblings, 0 replies; 13+ messages in thread From: Michael S. Tsirkin @ 2016-07-04 12:13 UTC (permalink / raw) To: Igor Mammedov; +Cc: qemu-devel, zhaoshenglong, peter.maydell, david, marcel On Fri, Jul 01, 2016 at 01:50:24PM +0200, Igor Mammedov wrote: > Replace repeated pattern > > for (i = 0; i < nb_numa_nodes; i++) { > if (test_bit(idx, numa_info[i].node_cpu)) { > ... > break; > > with a helper function to lookup numa node index for cpu. > > Suggested-by: Michael S. Tsirkin <mst@redhat.com> > Signed-off-by: Igor Mammedov <imammedo@redhat.com> Nice, but please make it return a negative return code on error. > --- > hw/arm/virt-acpi-build.c | 6 ++---- > hw/arm/virt.c | 7 +++---- > hw/i386/acpi-build.c | 7 ++----- > hw/i386/pc.c | 8 +++----- > hw/ppc/spapr_cpu_core.c | 6 ++---- > include/sysemu/numa.h | 3 +++ > numa.c | 12 ++++++++++++ > 7 files changed, 27 insertions(+), 22 deletions(-) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 28fc59c..5923b3d 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -426,11 +426,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) > uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); > > for (i = 0; i < guest_info->smp_cpus; i++) { > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > + j = numa_get_node_for_cpu(i); > + if (j < nb_numa_nodes) { > cpu_node[i] = j; > - break; > - } > } > } > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index c5c125e..b066f15 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -411,10 +411,9 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) > armcpu->mp_affinity); > } > > - for (i = 0; i < nb_numa_nodes; i++) { > - if (test_bit(cpu, numa_info[i].node_cpu)) { > - qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); > - } > + i = numa_get_node_for_cpu(cpu); > + if (i < nb_numa_nodes) { > + qemu_fdt_setprop_cell(vbi->fdt, nodename, "numa-node-id", i); > } > > g_free(nodename); > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 5a594be..60be550 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -2344,18 +2344,15 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) > srat->reserved1 = cpu_to_le32(1); > > for (i = 0; i < apic_ids->len; i++) { > - int j; > + int j = numa_get_node_for_cpu(i); > int apic_id = apic_ids->cpus[i].arch_id; > > core = acpi_data_push(table_data, sizeof *core); > core->type = ACPI_SRAT_PROCESSOR_APIC; > core->length = sizeof(*core); > core->local_apic_id = apic_id; > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > + if (j < nb_numa_nodes) { > core->proximity_lo = j; > - break; > - } > } > memset(core->proximity_hi, 0, 3); > core->local_sapic_eid = 0; > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 44a8f3b..fef34e7 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -780,11 +780,9 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) > for (i = 0; i < max_cpus; i++) { > unsigned int apic_id = x86_cpu_apic_id_from_index(i); > assert(apic_id < pcms->apic_id_limit); > - for (j = 0; j < nb_numa_nodes; j++) { > - if (test_bit(i, numa_info[j].node_cpu)) { > - numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > - break; > - } > + j = numa_get_node_for_cpu(i); > + if (j < nb_numa_nodes) { > + numa_fw_cfg[apic_id + 1] = cpu_to_le64(j); > } > } > for (i = 0; i < nb_numa_nodes; i++) { > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > index 3a5da09..030016c 100644 > --- a/hw/ppc/spapr_cpu_core.c > +++ b/hw/ppc/spapr_cpu_core.c > @@ -69,11 +69,9 @@ void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **errp) > } > > /* Set NUMA node for the added CPUs */ > - for (i = 0; i < nb_numa_nodes; i++) { > - if (test_bit(cs->cpu_index, numa_info[i].node_cpu)) { > + i = numa_get_node_for_cpu(cs->cpu_index); > + if (i < nb_numa_nodes) { > cs->numa_node = i; > - break; > - } > } > > xics_cpu_setup(spapr->icp, cpu); > diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h > index bb184c9..4da808a 100644 > --- a/include/sysemu/numa.h > +++ b/include/sysemu/numa.h > @@ -32,4 +32,7 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); > void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); > uint32_t numa_get_node(ram_addr_t addr, Error **errp); > > +/* on success returns node index in numa_info, > + * on failure returns nb_numa_nodes */ > +int numa_get_node_for_cpu(int idx); > #endif > diff --git a/numa.c b/numa.c > index 572712c..5790858 100644 > --- a/numa.c > +++ b/numa.c > @@ -548,3 +548,15 @@ MemdevList *qmp_query_memdev(Error **errp) > object_child_foreach(obj, query_memdev, &list); > return list; > } > + > +int numa_get_node_for_cpu(int idx) > +{ > + int i; > + > + for (i = 0; i < nb_numa_nodes; i++) { > + if (test_bit(idx, numa_info[i].node_cpu)) { > + break; > + } > + } > + return i; > +} > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH v3 4/5] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled 2016-07-01 11:50 [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs Igor Mammedov ` (2 preceding siblings ...) 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() Igor Mammedov @ 2016-07-01 11:50 ` Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check Igor Mammedov 4 siblings, 0 replies; 13+ messages in thread From: Igor Mammedov @ 2016-07-01 11:50 UTC (permalink / raw) To: qemu-devel; +Cc: mst, zhaoshenglong, peter.maydell, david, marcel Workaround for long standing issue where Linux kernel assigns 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. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> --- v3: - use numa_get_node_for_cpu() instead of duplicating lookup code - added comment in code blaming linux --- hw/acpi/cpu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index c13b65c..902f5c9 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -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,16 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_arg(1), aml_arg(2)) ); aml_append(dev, method); + + /* 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. + */ + j = numa_get_node_for_cpu(i); + if (j < nb_numa_nodes) { + aml_append(dev, aml_name_decl("_PXM", aml_int(j))); + } + aml_append(cpus_dev, dev); } } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check 2016-07-01 11:50 [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs Igor Mammedov ` (3 preceding siblings ...) 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 4/5] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled Igor Mammedov @ 2016-07-01 11:50 ` Igor Mammedov 2016-07-04 12:14 ` Michael S. Tsirkin 4 siblings, 1 reply; 13+ messages in thread From: Igor Mammedov @ 2016-07-01 11:50 UTC (permalink / raw) To: qemu-devel; +Cc: mst, zhaoshenglong, peter.maydell, david, marcel so it would be possible to verify _PXM generation in DSDT and SRAT tables. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> --- 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 diff --git a/tests/acpi-test-data/pc/SRAT.cphp b/tests/acpi-test-data/pc/SRAT.cphp new file mode 100644 index 0000000000000000000000000000000000000000..ff2137642f488ec70b85207ed6c20e7351d61e98 GIT binary patch literal 304 zcmWFzattwGWME)4bMklg2v%^42yhMtiUEZfKx_~V!f+sf!DmF1XF}yOvY_!<(fDl0 pd`1npO;83GTmZW|po75R12aq^syaB21u74tQT&BzFU&Ml8UVWm2>}2A literal 0 HcmV?d00001 diff --git a/tests/acpi-test-data/q35/SRAT.cphp b/tests/acpi-test-data/q35/SRAT.cphp new file mode 100644 index 0000000000000000000000000000000000000000..ff2137642f488ec70b85207ed6c20e7351d61e98 GIT binary patch literal 304 zcmWFzattwGWME)4bMklg2v%^42yhMtiUEZfKx_~V!f+sf!DmF1XF}yOvY_!<(fDl0 pd`1npO;83GTmZW|po75R12aq^syaB21u74tQT&BzFU&Ml8UVWm2>}2A literal 0 HcmV?d00001 diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index de4019e..3796089 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -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); } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check Igor Mammedov @ 2016-07-04 12:14 ` Michael S. Tsirkin 2016-07-04 12:49 ` Igor Mammedov 0 siblings, 1 reply; 13+ messages in thread From: Michael S. Tsirkin @ 2016-07-04 12:14 UTC (permalink / raw) To: Igor Mammedov; +Cc: qemu-devel, zhaoshenglong, peter.maydell, david, marcel On Fri, Jul 01, 2016 at 01:50:26PM +0200, Igor Mammedov wrote: > so it would be possible to verify _PXM generation in > DSDT and SRAT tables. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> It's still a pain to backport, pls make it a separate patch if you repost. > --- > 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 > > diff --git a/tests/acpi-test-data/pc/SRAT.cphp b/tests/acpi-test-data/pc/SRAT.cphp > new file mode 100644 > index 0000000000000000000000000000000000000000..ff2137642f488ec70b85207ed6c20e7351d61e98 > GIT binary patch > literal 304 > zcmWFzattwGWME)4bMklg2v%^42yhMtiUEZfKx_~V!f+sf!DmF1XF}yOvY_!<(fDl0 > pd`1npO;83GTmZW|po75R12aq^syaB21u74tQT&BzFU&Ml8UVWm2>}2A > > literal 0 > HcmV?d00001 > > diff --git a/tests/acpi-test-data/q35/SRAT.cphp b/tests/acpi-test-data/q35/SRAT.cphp > new file mode 100644 > index 0000000000000000000000000000000000000000..ff2137642f488ec70b85207ed6c20e7351d61e98 > GIT binary patch > literal 304 > zcmWFzattwGWME)4bMklg2v%^42yhMtiUEZfKx_~V!f+sf!DmF1XF}yOvY_!<(fDl0 > pd`1npO;83GTmZW|po75R12aq^syaB21u74tQT&BzFU&Ml8UVWm2>}2A > > literal 0 > HcmV?d00001 > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c > index de4019e..3796089 100644 > --- a/tests/bios-tables-test.c > +++ b/tests/bios-tables-test.c > @@ -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); > } > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check 2016-07-04 12:14 ` Michael S. Tsirkin @ 2016-07-04 12:49 ` Igor Mammedov 0 siblings, 0 replies; 13+ messages in thread From: Igor Mammedov @ 2016-07-04 12:49 UTC (permalink / raw) To: Michael S. Tsirkin Cc: qemu-devel, zhaoshenglong, peter.maydell, david, marcel On Mon, 4 Jul 2016 15:14:40 +0300 "Michael S. Tsirkin" <mst@redhat.com> wrote: > On Fri, Jul 01, 2016 at 01:50:26PM +0200, Igor Mammedov wrote: > > so it would be possible to verify _PXM generation in > > DSDT and SRAT tables. > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> > > It's still a pain to backport, pls make it a separate patch if > you repost. Ok, I'll split it. > > > --- > > 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 > > > > diff --git a/tests/acpi-test-data/pc/SRAT.cphp > > b/tests/acpi-test-data/pc/SRAT.cphp new file mode 100644 > > index > > 0000000000000000000000000000000000000000..ff2137642f488ec70b85207ed6c20e7351d61e98 > > GIT binary patch literal 304 > > zcmWFzattwGWME)4bMklg2v%^42yhMtiUEZfKx_~V!f+sf!DmF1XF}yOvY_!<(fDl0 > > pd`1npO;83GTmZW|po75R12aq^syaB21u74tQT&BzFU&Ml8UVWm2>}2A > > > > literal 0 > > HcmV?d00001 > > > > diff --git a/tests/acpi-test-data/q35/SRAT.cphp > > b/tests/acpi-test-data/q35/SRAT.cphp new file mode 100644 > > index > > 0000000000000000000000000000000000000000..ff2137642f488ec70b85207ed6c20e7351d61e98 > > GIT binary patch literal 304 > > zcmWFzattwGWME)4bMklg2v%^42yhMtiUEZfKx_~V!f+sf!DmF1XF}yOvY_!<(fDl0 > > pd`1npO;83GTmZW|po75R12aq^syaB21u74tQT&BzFU&Ml8UVWm2>}2A > > > > literal 0 > > HcmV?d00001 > > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c > > index de4019e..3796089 100644 > > --- a/tests/bios-tables-test.c > > +++ b/tests/bios-tables-test.c > > @@ -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); > > } > > -- > > 1.8.3.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-07-07 12:03 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-01 11:50 [Qemu-devel] [PATCH v3 0/5] fix numa node mapping for hotplugged CPUs Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 1/5] tests: acpi: add CPU hotplug testcase Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 2/5] tests: DO NOT APPLY: add APIC.cphp and DSDT.cphp blobs Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 3/5] numa: reduce code duplication by adding helper numa_get_node_for_cpu() Igor Mammedov 2016-07-01 12:30 ` Andrew Jones 2016-07-04 7:06 ` Igor Mammedov 2016-07-07 12:03 ` Andrew Jones 2016-07-04 3:34 ` David Gibson 2016-07-04 12:13 ` Michael S. Tsirkin 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 4/5] acpi: provide _PXM method for CPU devices if QEMU is started numa enabled Igor Mammedov 2016-07-01 11:50 ` [Qemu-devel] [PATCH v3 5/5] tests: acpi: extend cphp testcase with numa check Igor Mammedov 2016-07-04 12:14 ` Michael S. Tsirkin 2016-07-04 12:49 ` Igor Mammedov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).