From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189708755224.19827360743432; Wed, 22 Mar 2017 06:35:08 -0700 (PDT) Received: from localhost ([::1]:51112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPr-00004v-Dm for importer@patchew.org; Wed, 22 Mar 2017 09:35:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgNp-0006v3-DZ for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgNm-0001i9-QY for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43665) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgNi-0001gA-Ul; Wed, 22 Mar 2017 09:32:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD20C75EAB; Wed, 22 Mar 2017 13:32:54 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2A6AA5660; Wed, 22 Mar 2017 13:32:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BD20C75EAB Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BD20C75EAB From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:26 +0100 Message-Id: <1490189568-167621-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Mar 2017 13:32:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 01/23] tests: add CPUs to numa node mapping test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- tests/Makefile.include | 5 +++ tests/numa-test.c | 106 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 111 insertions(+) create mode 100644 tests/numa-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 402e71c..4547b01 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -260,6 +260,7 @@ check-qtest-i386-y +=3D tests/test-filter-mirror$(EXESU= F) check-qtest-i386-y +=3D tests/test-filter-redirector$(EXESUF) check-qtest-i386-y +=3D tests/postcopy-test$(EXESUF) check-qtest-i386-y +=3D tests/test-x86-cpuid-compat$(EXESUF) +check-qtest-i386-y +=3D tests/numa-test$(EXESUF) check-qtest-x86_64-y +=3D $(check-qtest-i386-y) gcov-files-i386-y +=3D i386-softmmu/hw/timer/mc146818rtc.c gcov-files-x86_64-y =3D $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files= -i386-y)) @@ -300,6 +301,7 @@ check-qtest-ppc64-y +=3D tests/test-netfilter$(EXESUF) check-qtest-ppc64-y +=3D tests/test-filter-mirror$(EXESUF) check-qtest-ppc64-y +=3D tests/test-filter-redirector$(EXESUF) check-qtest-ppc64-y +=3D tests/display-vga-test$(EXESUF) +check-qtest-ppc64-y +=3D tests/numa-test$(EXESUF) check-qtest-ppc64-$(CONFIG_EVENTFD) +=3D tests/ivshmem-test$(EXESUF) =20 check-qtest-sh4-y =3D tests/endianness-test$(EXESUF) @@ -324,6 +326,8 @@ gcov-files-arm-y +=3D arm-softmmu/hw/block/virtio-blk.c check-qtest-arm-y +=3D tests/test-arm-mptimer$(EXESUF) gcov-files-arm-y +=3D hw/timer/arm_mptimer.c =20 +check-qtest-aarch64-y =3D tests/numa-test$(EXESUF) + check-qtest-microblazeel-y =3D $(check-qtest-microblaze-y) =20 check-qtest-xtensaeb-y =3D $(check-qtest-xtensa-y) @@ -747,6 +751,7 @@ tests/vhost-user-bridge$(EXESUF): tests/vhost-user-brid= ge.o contrib/libvhost-use tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y) tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y) +tests/numa-test$(EXESUF): tests/numa-test.o =20 tests/migration/stress$(EXESUF): tests/migration/stress.o $(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"L= INK","$(TARGET_DIR)$@") diff --git a/tests/numa-test.c b/tests/numa-test.c new file mode 100644 index 0000000..f5da0c8 --- /dev/null +++ b/tests/numa-test.c @@ -0,0 +1,106 @@ +/* + * NUMA configuration test cases + * + * Copyright (c) 2017 Red Hat Inc. + * Authors: + * Igor Mammedov + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "libqtest.h" + +static char *make_cli(const char *generic_cli, const char *test_cli) +{ + return g_strdup_printf("%s %s", generic_cli ? generic_cli : "", test_c= li); +} + +static char *hmp_info_numa(void) +{ + QDict *resp; + char *s; + + resp =3D qmp("{ 'execute': 'human-monitor-command', 'arguments': " + "{ 'command-line': 'info numa '} }"); + g_assert(resp); + g_assert(qdict_haskey(resp, "return")); + s =3D g_strdup(qdict_get_str(resp, "return")); + g_assert(s); + QDECREF(resp); + return s; +} + +static void test_mon_explicit(const void *data) +{ + char *s; + char *cli; + + cli =3D make_cli(data, "-smp 8 " + "-numa node,nodeid=3D0,cpus=3D0-3 " + "-numa node,nodeid=3D1,cpus=3D4-7 "); + qtest_start(cli); + + s =3D hmp_info_numa(); + g_assert(strstr(s, "node 0 cpus: 0 1 2 3")); + g_assert(strstr(s, "node 1 cpus: 4 5 6 7")); + g_free(s); + + qtest_end(); + g_free(cli); +} + +static void test_mon_default(const void *data) +{ + char *s; + char *cli; + + cli =3D make_cli(data, "-smp 8 -numa node -numa node"); + qtest_start(cli); + + s =3D hmp_info_numa(); + g_assert(strstr(s, "node 0 cpus: 0 2 4 6")); + g_assert(strstr(s, "node 1 cpus: 1 3 5 7")); + g_free(s); + + qtest_end(); + g_free(cli); +} + +static void test_mon_partial(const void *data) +{ + char *s; + char *cli; + + cli =3D make_cli(data, "-smp 8 " + "-numa node,nodeid=3D0,cpus=3D0-1 " + "-numa node,nodeid=3D1,cpus=3D4-5 "); + qtest_start(cli); + + s =3D hmp_info_numa(); + g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7")); + g_assert(strstr(s, "node 1 cpus: 4 5")); + g_free(s); + + qtest_end(); + g_free(cli); +} + +int main(int argc, char **argv) +{ + const char *args =3D NULL; + const char *arch =3D qtest_get_arch(); + + if (strcmp(arch, "aarch64") =3D=3D 0) { + args =3D "-machine virt"; + } + + g_test_init(&argc, &argv, NULL); + + qtest_add_data_func("/numa/mon/default", args, test_mon_default); + qtest_add_data_func("/numa/mon/cpus/explicit", args, test_mon_explicit= ); + qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial); + + return g_test_run(); +} --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189703440305.5393524604708; Wed, 22 Mar 2017 06:35:03 -0700 (PDT) Received: from localhost ([::1]:51111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPl-0008St-FX for importer@patchew.org; Wed, 22 Mar 2017 09:35:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgNp-0006vk-TS for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgNn-0001iM-L0 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32790) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgNl-0001hM-4y; Wed, 22 Mar 2017 09:32:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0150A64E0; Wed, 22 Mar 2017 13:32:57 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0ACF35C6C9; Wed, 22 Mar 2017 13:32:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0150A64E0 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0150A64E0 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:27 +0100 Message-Id: <1490189568-167621-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Mar 2017 13:32:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 02/23] hw/arm/virt: extract mp-affinity calculation in separate function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hw/arm/virt.c | 59 ++++++++++++++++++++++++++++++++++++++++++-------------= ---- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 5f62a03..484754e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1194,6 +1194,45 @@ void virt_machine_done(Notifier *notifier, void *dat= a) virt_build_smbios(vms); } =20 +static uint64_t virt_idx2mp_affinity(VirtMachineState *vms, int idx) +{ + uint64_t mp_affinity; + uint8_t clustersz; + VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); + + if (!vmc->disallow_affinity_adjustment) { + uint8_t aff0, aff1; + + if (vms->gic_version =3D=3D 3) { + clustersz =3D GICV3_TARGETLIST_BITS; + } else { + clustersz =3D GIC_TARGETLIST_BITS; + } + + /* Adjust MPIDR like 64-bit KVM hosts, which incorporate the + * GIC's target-list limitations. 32-bit KVM hosts currently + * always create clusters of 4 CPUs, but that is expected to + * change when they gain support for gicv3. When KVM is enabled + * it will override the changes we make here, therefore our + * purposes are to make TCG consistent (with 64-bit KVM hosts) + * and to improve SGI efficiency. + */ + aff1 =3D idx / clustersz; + aff0 =3D idx % clustersz; + mp_affinity =3D (aff1 << ARM_AFF1_SHIFT) | aff0; + } else { + /* This cpu-id-to-MPIDR affinity is used only for TCG; + * KVM will override it. We don't support setting cluster ID + * ([16..23]) (known as Aff2 in later ARM ARM versions), or any of + * the higher affinity level fields, so these bits always RAZ. + */ + uint32_t Aff1 =3D idx / ARM_DEFAULT_CPUS_PER_CLUSTER; + uint32_t Aff0 =3D idx % ARM_DEFAULT_CPUS_PER_CLUSTER; + mp_affinity =3D (Aff1 << ARM_AFF1_SHIFT) | Aff0; + } + return mp_affinity; +} + static void machvirt_init(MachineState *machine) { VirtMachineState *vms =3D VIRT_MACHINE(machine); @@ -1210,7 +1249,6 @@ static void machvirt_init(MachineState *machine) CPUClass *cc; Error *err =3D NULL; bool firmware_loaded =3D bios_name || drive_get(IF_PFLASH, 0, 0); - uint8_t clustersz; =20 if (!cpu_model) { cpu_model =3D "cortex-a15"; @@ -1263,10 +1301,8 @@ static void machvirt_init(MachineState *machine) */ if (vms->gic_version =3D=3D 3) { virt_max_cpus =3D vms->memmap[VIRT_GIC_REDIST].size / 0x20000; - clustersz =3D GICV3_TARGETLIST_BITS; } else { virt_max_cpus =3D GIC_NCPU; - clustersz =3D GIC_TARGETLIST_BITS; } =20 if (max_cpus > virt_max_cpus) { @@ -1326,20 +1362,9 @@ static void machvirt_init(MachineState *machine) =20 for (n =3D 0; n < smp_cpus; n++) { Object *cpuobj =3D object_new(typename); - if (!vmc->disallow_affinity_adjustment) { - /* Adjust MPIDR like 64-bit KVM hosts, which incorporate the - * GIC's target-list limitations. 32-bit KVM hosts currently - * always create clusters of 4 CPUs, but that is expected to - * change when they gain support for gicv3. When KVM is enabled - * it will override the changes we make here, therefore our - * purposes are to make TCG consistent (with 64-bit KVM hosts) - * and to improve SGI efficiency. - */ - uint8_t aff1 =3D n / clustersz; - uint8_t aff0 =3D n % clustersz; - object_property_set_int(cpuobj, (aff1 << ARM_AFF1_SHIFT) | aff= 0, - "mp-affinity", NULL); - } + + object_property_set_int(cpuobj, virt_idx2mp_affinity(vms, n), + "mp-affinity", NULL); =20 if (!vms->secure) { object_property_set_bool(cpuobj, false, "has_el3", NULL); --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189856637926.789204953266; Wed, 22 Mar 2017 06:37:36 -0700 (PDT) Received: from localhost ([::1]:51132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgSF-0002KT-4X for importer@patchew.org; Wed, 22 Mar 2017 09:37:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgNq-0006wS-QL for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgNp-0001j2-Sq for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57298) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgNn-0001i4-AI; Wed, 22 Mar 2017 09:32:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4930B43A42; Wed, 22 Mar 2017 13:32:59 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 489C96046C; Wed, 22 Mar 2017 13:32:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4930B43A42 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4930B43A42 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:28 +0100 Message-Id: <1490189568-167621-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 22 Mar 2017 13:32:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 03/23] hw/arm/virt: use machine->possible_cpus for storing possible topology info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" for now precalculate and store mp_afinity in possible_cpus as ARM cpus don't have socket/core/thread-id properties yet. In follow patches possible_cpus will be used for storing and setting NUMA node mapping and replace legacy bitmap based numa_info[node_id].node_cpu/numa_get_node_for_cpu() For the lack of better idea, this patch cannibalizes possible_cpus.cpus[x].props.thread_id so that *_cpu_index_to_props() callback could return addressable by props CPU which will used by machine_set_cpu_numa_node() in follow up patches to assign a CPU to node. But cannibalizing is fine for now as that thread_id isn't exposed to users (no hotpluggable_cpus callback support for ARM yet) and it will be used only internally until 'device_add cpu' is supported where we can decide on which properties to use. Signed-off-by: Igor Mammedov --- hw/arm/virt.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 484754e..4de46b1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1237,6 +1237,7 @@ static void machvirt_init(MachineState *machine) { VirtMachineState *vms =3D VIRT_MACHINE(machine); VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(machine); + MachineClass *mc =3D MACHINE_GET_CLASS(machine); qemu_irq pic[NUM_IRQS]; MemoryRegion *sysmem =3D get_system_memory(); MemoryRegion *secure_sysmem =3D NULL; @@ -1360,10 +1361,16 @@ static void machvirt_init(MachineState *machine) exit(1); } =20 - for (n =3D 0; n < smp_cpus; n++) { - Object *cpuobj =3D object_new(typename); + mc->possible_cpu_arch_ids(machine); + for (n =3D 0; n < machine->possible_cpus->len; n++) { + Object *cpuobj; =20 - object_property_set_int(cpuobj, virt_idx2mp_affinity(vms, n), + if (n >=3D smp_cpus) { + break; + } + + cpuobj =3D object_new(typename); + object_property_set_int(cpuobj, machine->possible_cpus->cpus[n].ar= ch_id, "mp-affinity", NULL); =20 if (!vms->secure) { @@ -1543,6 +1550,31 @@ static void virt_set_gic_version(Object *obj, const = char *value, Error **errp) } } =20 +static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) +{ + int n; + VirtMachineState *vms =3D VIRT_MACHINE(ms); + + if (ms->possible_cpus) { + assert(ms->possible_cpus->len =3D=3D max_cpus); + return ms->possible_cpus; + } + + ms->possible_cpus =3D g_malloc0(sizeof(CPUArchIdList) + + sizeof(CPUArchId) * max_cpus); + ms->possible_cpus->len =3D max_cpus; + for (n =3D 0; n < ms->possible_cpus->len; n++) { + ms->possible_cpus->cpus[n].arch_id =3D + virt_idx2mp_affinity(vms, n); + ms->possible_cpus->cpus[n].props.has_thread_id =3D true; + ms->possible_cpus->cpus[n].props.thread_id =3D n; + + /* TODO: add 'has_node/node' here to describe + to which node core belongs */ + } + return ms->possible_cpus; +} + static void virt_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -1559,6 +1591,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) mc->pci_allow_0_address =3D true; /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */ mc->minimum_page_bits =3D 12; + mc->possible_cpu_arch_ids =3D virt_possible_cpu_arch_ids; } =20 static const TypeInfo virt_machine_info =3D { --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189878414634.2415331077507; Wed, 22 Mar 2017 06:37:58 -0700 (PDT) Received: from localhost ([::1]:51135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgSa-0002i0-VF for importer@patchew.org; Wed, 22 Mar 2017 09:37:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgNy-000748-9T for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgNx-0001lW-DF for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32828) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgNp-0001ii-IN; Wed, 22 Mar 2017 09:33:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87C9580482; Wed, 22 Mar 2017 13:33:01 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C6286046C; Wed, 22 Mar 2017 13:32:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 87C9580482 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 87C9580482 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:29 +0100 Message-Id: <1490189568-167621-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Mar 2017 13:33:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 04/23] hw/arm/virt: explicitly allocate cpu_index for cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently cpu_index is implicitly auto assigned during cpu.realize() time cpu_exec_realizefn()->cpu_list_add(). It happens to match index in possible_cpus so take control over it and make board initialize cpu_index to possible_cpus index explicitly. It will at least document that board is in control of it and when '-device cpu' support comes it will keep cpu_index stable regardless of order cpus are created so it won't break migration. Within this series it will be used for internal conversion from storing cpu_index based NUMA node bitmaps to property based mapping with possible_cpus, And will allow map cpu_index to a CPU entry in possible_cpus array. Signed-off-by: Igor Mammedov Reviewed-by: Andrew Jones --- hw/arm/virt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 4de46b1..0cbcbc1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1364,6 +1364,7 @@ static void machvirt_init(MachineState *machine) mc->possible_cpu_arch_ids(machine); for (n =3D 0; n < machine->possible_cpus->len; n++) { Object *cpuobj; + CPUState *cs; =20 if (n >=3D smp_cpus) { break; @@ -1373,6 +1374,9 @@ static void machvirt_init(MachineState *machine) object_property_set_int(cpuobj, machine->possible_cpus->cpus[n].ar= ch_id, "mp-affinity", NULL); =20 + cs =3D CPU(cpuobj); + cs->cpu_index =3D n; + if (!vms->secure) { object_property_set_bool(cpuobj, false, "has_el3", NULL); } --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190062719862.2853144748207; Wed, 22 Mar 2017 06:41:02 -0700 (PDT) Received: from localhost ([::1]:51158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgVZ-0005Jk-FB for importer@patchew.org; Wed, 22 Mar 2017 09:41:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgO9-0007D6-Up for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgO8-0001o9-At for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgO2-0001mv-Ix; Wed, 22 Mar 2017 09:33:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92EDFC1C5DF7; Wed, 22 Mar 2017 13:33:14 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD030A5660; Wed, 22 Mar 2017 13:33:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 92EDFC1C5DF7 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 92EDFC1C5DF7 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:30 +0100 Message-Id: <1490189568-167621-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 22 Mar 2017 13:33:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 05/23] numa: move source of default CPUs to NUMA node mapping into boards X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Originally CPU threads were by default assigned in round-robin fashion. However it was causing issues in guest since CPU threads from the same socket/core could be placed on different NUMA nodes. Commit fb43b73b (pc: fix default VCPU to NUMA node mapping) fixed it by grouping threads within a socket on the same node introducing cpu_index_to_socket_id() callback and commit 20bb648d (spapr: Fix default NUMA node allocation for threads) reused callback to fix similar issues for SPAPR machine even though socket doesn't make much sense there. As result QEMU ended up having 3 default distribution rules used by 3 targets /virt-arm, spapr, pc/. In effort of moving NUMA mapping for CPUs into possible_cpus, generalize default mapping in numa.c by making boards decide on default mapping and let them explicitly tell generic numa code to which node a CPU thread belongs to by replacing cpu_index_to_socket_id() with @cpu_index_to_instance_props() which provides default node_id assigned by board to specified cpu_index. Signed-off-by: Igor Mammedov --- Patch only moves source of default mapping to possible_cpus[] and leaves the rest of NUMA handling to numa_info[node_id].node_cpu bitmaps. It's up to follow up patches to replace bitmaps with possible_cpus[] internally. --- include/hw/boards.h | 8 ++++++-- include/sysemu/numa.h | 2 +- hw/arm/virt.c | 19 +++++++++++++++++-- hw/i386/pc.c | 22 ++++++++++++++++------ hw/ppc/spapr.c | 27 ++++++++++++++++++++------- numa.c | 15 +++++++++------ vl.c | 2 +- 7 files changed, 70 insertions(+), 25 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 269d0ba..1dd0fde 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -74,7 +74,10 @@ typedef struct { * of HotplugHandler object, which handles hotplug operation * for a given @dev. It may return NULL if @dev doesn't require * any actions to be performed by hotplug handler. - * @cpu_index_to_socket_id: + * @cpu_index_to_instance_props: + * used to provide @cpu_index to socket/core/thread number mapping, all= owing + * legacy code to perform maping from cpu_index to topology properties + * Returns: tuple of socket/core/thread ids given cpu_index belongs to. * used to provide @cpu_index to socket number mapping, allowing * a machine to group CPU threads belonging to the same socket/package * Returns: socket number given cpu_index belongs to. @@ -138,7 +141,8 @@ struct MachineClass { =20 HotplugHandler *(*get_hotplug_handler)(MachineState *machine, DeviceState *dev); - unsigned (*cpu_index_to_socket_id)(unsigned cpu_index); + CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *mac= hine, + unsigned cpu_inde= x); const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); }; =20 diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 8f09dcf..46ea6c7 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -24,7 +24,7 @@ typedef struct node_info { } NodeInfo; =20 extern NodeInfo numa_info[MAX_NODES]; -void parse_numa_opts(MachineClass *mc); +void parse_numa_opts(MachineState *ms); void numa_post_machine_init(void); void query_numa_node_mem(uint64_t node_mem[]); extern QemuOptsList qemu_numa_opts; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0cbcbc1..8748d25 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1554,6 +1554,16 @@ static void virt_set_gic_version(Object *obj, const = char *value, Error **errp) } } =20 +static CpuInstanceProperties +virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + const CPUArchIdList *possible_cpus =3D mc->possible_cpu_arch_ids(ms); + + assert(cpu_index < possible_cpus->len); + return possible_cpus->cpus[cpu_index].props;; +} + static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) { int n; @@ -1573,8 +1583,12 @@ static const CPUArchIdList *virt_possible_cpu_arch_i= ds(MachineState *ms) ms->possible_cpus->cpus[n].props.has_thread_id =3D true; ms->possible_cpus->cpus[n].props.thread_id =3D n; =20 - /* TODO: add 'has_node/node' here to describe - to which node core belongs */ + /* default distribution of CPUs over NUMA nodes */ + if (nb_numa_nodes) { + /* preset values but do not enable them i.e. 'has_node_id =3D = false', + * board will enable them if manual mapping wasn't present on = CLI */ + ms->possible_cpus->cpus[n].props.node_id =3D n % nb_numa_nodes= ;; + } } return ms->possible_cpus; } @@ -1596,6 +1610,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */ mc->minimum_page_bits =3D 12; mc->possible_cpu_arch_ids =3D virt_possible_cpu_arch_ids; + mc->cpu_index_to_instance_props =3D virt_cpu_index_to_props; } =20 static const TypeInfo virt_machine_info =3D { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d24388e..7031100 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2245,12 +2245,14 @@ static void pc_machine_reset(void) } } =20 -static unsigned pc_cpu_index_to_socket_id(unsigned cpu_index) +static CpuInstanceProperties +pc_cpu_index_to_props(MachineState *ms, unsigned cpu_index) { - X86CPUTopoInfo topo; - x86_topo_ids_from_idx(smp_cores, smp_threads, cpu_index, - &topo); - return topo.pkg_id; + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + const CPUArchIdList *possible_cpus =3D mc->possible_cpu_arch_ids(ms); + + assert(cpu_index < possible_cpus->len); + return possible_cpus->cpus[cpu_index].props;; } =20 static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms) @@ -2282,6 +2284,14 @@ static const CPUArchIdList *pc_possible_cpu_arch_ids= (MachineState *ms) ms->possible_cpus->cpus[i].props.core_id =3D topo.core_id; ms->possible_cpus->cpus[i].props.has_thread_id =3D true; ms->possible_cpus->cpus[i].props.thread_id =3D topo.smt_id; + + /* default distribution of CPUs over NUMA nodes */ + if (nb_numa_nodes) { + /* preset values but do not enable them i.e. 'has_node_id =3D = false', + * board will enable them if manual mapping wasn't present on = CLI */ + ms->possible_cpus->cpus[i].props.node_id =3D + topo.pkg_id % nb_numa_nodes; + } } return ms->possible_cpus; } @@ -2324,7 +2334,7 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) pcmc->acpi_data_size =3D 0x20000 + 0x8000; pcmc->save_tsc_khz =3D true; mc->get_hotplug_handler =3D pc_get_hotpug_handler; - mc->cpu_index_to_socket_id =3D pc_cpu_index_to_socket_id; + mc->cpu_index_to_instance_props =3D pc_cpu_index_to_props; mc->possible_cpu_arch_ids =3D pc_possible_cpu_arch_ids; mc->has_hotpluggable_cpus =3D true; mc->default_boot_order =3D "cad"; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6ee566d..9dcbbcc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2921,11 +2921,18 @@ static HotplugHandler *spapr_get_hotplug_handler(Ma= chineState *machine, return NULL; } =20 -static unsigned spapr_cpu_index_to_socket_id(unsigned cpu_index) +static CpuInstanceProperties +spapr_cpu_index_to_props(MachineState *machine, unsigned cpu_index) { - /* Allocate to NUMA nodes on a "socket" basis (not that concept of - * socket means much for the paravirtualized PAPR platform) */ - return cpu_index / smp_threads / smp_cores; + CPUArchId *core_slot; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); + int core_id =3D cpu_index / smp_threads * smp_threads; + + /* make sure possible_cpu are intialized */ + mc->possible_cpu_arch_ids(machine); + core_slot =3D spapr_find_cpu_slot(machine, core_id, NULL); + assert(core_slot); + return core_slot->props; } =20 static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *mach= ine) @@ -2952,8 +2959,14 @@ static const CPUArchIdList *spapr_possible_cpu_arch_= ids(MachineState *machine) machine->possible_cpus->cpus[i].arch_id =3D core_id; machine->possible_cpus->cpus[i].props.has_core_id =3D true; machine->possible_cpus->cpus[i].props.core_id =3D core_id; - /* TODO: add 'has_node/node' here to describe - to which node core belongs */ + + /* default distribution of CPUs over NUMA nodes */ + if (nb_numa_nodes) { + /* preset values but do not enable them i.e. 'has_node_id =3D = false', + * board will enable them if manual mapping wasn't present on = CLI */ + machine->possible_cpus->cpus[i].props.node_id =3D + core_id / smp_threads / smp_cores % nb_numa_nodes; + } } return machine->possible_cpus; } @@ -3076,7 +3089,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) hc->pre_plug =3D spapr_machine_device_pre_plug; hc->plug =3D spapr_machine_device_plug; hc->unplug =3D spapr_machine_device_unplug; - mc->cpu_index_to_socket_id =3D spapr_cpu_index_to_socket_id; + mc->cpu_index_to_instance_props =3D spapr_cpu_index_to_props; mc->possible_cpu_arch_ids =3D spapr_possible_cpu_arch_ids; hc->unplug_request =3D spapr_machine_device_unplug_request; =20 diff --git a/numa.c b/numa.c index e01cb54..b6e71bc 100644 --- a/numa.c +++ b/numa.c @@ -294,9 +294,10 @@ static void validate_numa_cpus(void) g_free(seen_cpus); } =20 -void parse_numa_opts(MachineClass *mc) +void parse_numa_opts(MachineState *ms) { int i; + MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 for (i =3D 0; i < MAX_NODES; i++) { numa_info[i].node_cpu =3D bitmap_new(max_cpus); @@ -378,14 +379,16 @@ void parse_numa_opts(MachineClass *mc) * rule grouping VCPUs by socket so that VCPUs from the same socket * would be on the same node. */ + if (!mc->cpu_index_to_instance_props) { + error_report("default CPUs to NUMA node mapping isn't supporte= d"); + exit(1); + } if (i =3D=3D nb_numa_nodes) { for (i =3D 0; i < max_cpus; i++) { - unsigned node_id =3D i % nb_numa_nodes; - if (mc->cpu_index_to_socket_id) { - node_id =3D mc->cpu_index_to_socket_id(i) % nb_numa_no= des; - } + CpuInstanceProperties props; + props =3D mc->cpu_index_to_instance_props(ms, i); =20 - set_bit(i, numa_info[node_id].node_cpu); + set_bit(i, numa_info[props.node_id].node_cpu); } } =20 diff --git a/vl.c b/vl.c index 0b4ed52..5ffb9c3 100644 --- a/vl.c +++ b/vl.c @@ -4498,7 +4498,7 @@ int main(int argc, char **argv, char **envp) default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS); default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS); =20 - parse_numa_opts(machine_class); + parse_numa_opts(current_machine); =20 if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, NULL)) { --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189916985260.39178590910933; Wed, 22 Mar 2017 06:38:36 -0700 (PDT) Received: from localhost ([::1]:51138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgT9-0003Ay-U6 for importer@patchew.org; Wed, 22 Mar 2017 09:38:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgOH-0007L2-Dp for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgOG-0001pU-Aj for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60104) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOB-0001oh-It; Wed, 22 Mar 2017 09:33:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83408C05490E; Wed, 22 Mar 2017 13:33:23 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA287A5660; Wed, 22 Mar 2017 13:33:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 83408C05490E Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 83408C05490E From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:31 +0100 Message-Id: <1490189568-167621-7-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 22 Mar 2017 13:33:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 06/23] spapr: add node-id property to sPAPR core X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it will allow switching from cpu_index to core based numa mapping in follow up patches. Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- include/hw/ppc/spapr_cpu_core.h | 1 + include/qom/cpu.h | 2 ++ hw/ppc/spapr.c | 17 +++++++++++++++++ hw/ppc/spapr_cpu_core.c | 11 ++++++++--- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_cor= e.h index 3c35665..93051e9 100644 --- a/include/hw/ppc/spapr_cpu_core.h +++ b/include/hw/ppc/spapr_cpu_core.h @@ -27,6 +27,7 @@ typedef struct sPAPRCPUCore { =20 /*< public >*/ void *threads; + int node_id; } sPAPRCPUCore; =20 typedef struct sPAPRCPUCoreClass { diff --git a/include/qom/cpu.h b/include/qom/cpu.h index c3292ef..7f27d56 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -258,6 +258,8 @@ typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_c= pu_data data); =20 struct qemu_work_item; =20 +#define CPU_UNSET_NUMA_NODE_ID -1 + /** * CPUState: * @cpu_index: CPU index (informative). diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9dcbbcc..9c61721 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2770,9 +2770,11 @@ static void spapr_core_pre_plug(HotplugHandler *hotp= lug_dev, DeviceState *dev, MachineClass *mc =3D MACHINE_GET_CLASS(hotplug_dev); Error *local_err =3D NULL; CPUCore *cc =3D CPU_CORE(dev); + sPAPRCPUCore *sc =3D SPAPR_CPU_CORE(dev); char *base_core_type =3D spapr_get_cpu_core_type(machine->cpu_model); const char *type =3D object_get_typename(OBJECT(dev)); CPUArchId *core_slot; + int node_id; int index; =20 if (dev->hotplugged && !mc->has_hotpluggable_cpus) { @@ -2801,6 +2803,21 @@ static void spapr_core_pre_plug(HotplugHandler *hotp= lug_dev, DeviceState *dev, goto out; } =20 + node_id =3D numa_get_node_for_cpu(cc->core_id); + if (node_id =3D=3D nb_numa_nodes) { + /* by default CPUState::numa_node was 0 if it's not set via CLI + * keep it this way for now but in future we probably should + * refuse to start up with incomplete numa mapping */ + node_id =3D 0; + } + if (sc->node_id =3D=3D CPU_UNSET_NUMA_NODE_ID) { + sc->node_id =3D node_id; + } else if (sc->node_id !=3D node_id) { + error_setg(&local_err, "node-id %d must match numa node specified" + "with -numa option for cpu-index %d", sc->node_id, cc->core_id= ); + goto out; + } + out: g_free(base_core_type); error_propagate(errp, local_err); diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 6883f09..25988f8 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -163,7 +163,6 @@ static void spapr_cpu_core_realize(DeviceState *dev, Er= ror **errp) const char *typename =3D object_class_get_name(scc->cpu_class); size_t size =3D object_type_get_instance_size(typename); Error *local_err =3D NULL; - int core_node_id =3D numa_get_node_for_cpu(cc->core_id);; void *obj; int i, j; =20 @@ -181,10 +180,10 @@ static void spapr_cpu_core_realize(DeviceState *dev, = Error **errp) =20 /* Set NUMA node for the added CPUs */ node_id =3D numa_get_node_for_cpu(cs->cpu_index); - if (node_id !=3D core_node_id) { + if (node_id !=3D sc->node_id) { error_setg(&local_err, "Invalid node-id=3D%d of thread[cpu-ind= ex: %d]" " on CPU[core-id: %d, node-id: %d], node-id must be the sa= me", - node_id, cs->cpu_index, cc->core_id, core_node_id); + node_id, cs->cpu_index, cc->core_id, sc->node_id); goto err; } if (node_id < nb_numa_nodes) { @@ -250,6 +249,11 @@ static const char *spapr_core_models[] =3D { "POWER9_v1.0", }; =20 +static Property spapr_cpu_core_properties[] =3D { + DEFINE_PROP_INT32("node-id", sPAPRCPUCore, node_id, CPU_UNSET_NUMA_NOD= E_ID), + DEFINE_PROP_END_OF_LIST() +}; + void spapr_cpu_core_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -257,6 +261,7 @@ void spapr_cpu_core_class_init(ObjectClass *oc, void *d= ata) =20 dc->realize =3D spapr_cpu_core_realize; dc->unrealize =3D spapr_cpu_core_unrealizefn; + dc->props =3D spapr_cpu_core_properties; scc->cpu_class =3D cpu_class_by_name(TYPE_POWERPC_CPU, data); g_assert(scc->cpu_class); } --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190054425390.79041203379825; Wed, 22 Mar 2017 06:40:54 -0700 (PDT) Received: from localhost ([::1]:51157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgVR-0005CY-2D for importer@patchew.org; Wed, 22 Mar 2017 09:40:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgOS-0007Yy-GD for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgOR-0001so-LP for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOK-0001pz-KZ; Wed, 22 Mar 2017 09:33:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D4D48EB54; Wed, 22 Mar 2017 13:33:32 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E30A5660; Wed, 22 Mar 2017 13:33:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8D4D48EB54 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8D4D48EB54 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:32 +0100 Message-Id: <1490189568-167621-8-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Mar 2017 13:33:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 07/23] pc: add node-id property to CPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it will allow switching from cpu_index to property based numa mapping in follow up patches. Signed-off-by: Igor Mammedov --- hw/i386/pc.c | 17 +++++++++++++++++ target/i386/cpu.c | 1 + 2 files changed, 18 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7031100..873bbfa 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1895,6 +1895,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_d= ev, DeviceState *dev, Error **errp) { int idx; + int node_id; CPUState *cs; CPUArchId *cpu_slot; X86CPUTopoInfo topo; @@ -1984,6 +1985,22 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_= dev, =20 cs =3D CPU(cpu); cs->cpu_index =3D idx; + + node_id =3D numa_get_node_for_cpu(cs->cpu_index); + if (node_id =3D=3D nb_numa_nodes) { + /* by default CPUState::numa_node was 0 if it's not set via CLI + * keep it this way for now but in future we probably should + * refuse to start up with incomplete numa mapping */ + node_id =3D 0; + } + if (cs->numa_node =3D=3D CPU_UNSET_NUMA_NODE_ID) { + cs->numa_node =3D node_id; + } else if (cs->numa_node !=3D node_id) { + error_setg(errp, "node-id %d must match numa node specified" + "with -numa option for cpu-index %d", + cs->numa_node, cs->cpu_index); + return; + } } =20 static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7aa7622..d690244 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3974,6 +3974,7 @@ static Property x86_cpu_properties[] =3D { DEFINE_PROP_INT32("core-id", X86CPU, core_id, -1), DEFINE_PROP_INT32("socket-id", X86CPU, socket_id, -1), #endif + DEFINE_PROP_INT32("node-id", CPUState, numa_node, CPU_UNSET_NUMA_NODE_= ID), DEFINE_PROP_BOOL("pmu", X86CPU, enable_pmu, false), { .name =3D "hv-spinlocks", .info =3D &qdev_prop_spinlocks }, DEFINE_PROP_BOOL("hv-relaxed", X86CPU, hyperv_relaxed_timing, false), --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190042876255.94379336122745; Wed, 22 Mar 2017 06:40:42 -0700 (PDT) Received: from localhost ([::1]:51156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgVF-00052n-BN for importer@patchew.org; Wed, 22 Mar 2017 09:40:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgOY-0007dK-4X for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgOS-0001t3-Gf for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19225) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOQ-0001sG-7M; Wed, 22 Mar 2017 09:33:38 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2710775EAB; Wed, 22 Mar 2017 13:33:38 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D33DAA5660; Wed, 22 Mar 2017 13:33:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2710775EAB Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2710775EAB From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:33 +0100 Message-Id: <1490189568-167621-9-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Mar 2017 13:33:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 08/23] virt-arm: add node-id property to CPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it will allow switching from cpu_index to property based numa mapping in follow up patches. Signed-off-by: Igor Mammedov --- hw/arm/virt.c | 15 +++++++++++++++ target/arm/cpu.c | 1 + 2 files changed, 16 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8748d25..68d44f3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1365,6 +1365,7 @@ static void machvirt_init(MachineState *machine) for (n =3D 0; n < machine->possible_cpus->len; n++) { Object *cpuobj; CPUState *cs; + int node_id; =20 if (n >=3D smp_cpus) { break; @@ -1377,6 +1378,20 @@ static void machvirt_init(MachineState *machine) cs =3D CPU(cpuobj); cs->cpu_index =3D n; =20 + node_id =3D numa_get_node_for_cpu(cs->cpu_index); + if (node_id =3D=3D nb_numa_nodes) { + /* by default CPUState::numa_node was 0 if it's not set via CLI + * keep it this way for now but in future we probably should + * refuse to start up with incomplete numa mapping */ + node_id =3D 0; + } + if (cs->numa_node =3D=3D CPU_UNSET_NUMA_NODE_ID) { + cs->numa_node =3D node_id; + } else { + /* CPU isn't device_add compatible yet, this shouldn't happen = */ + error_setg(&error_abort, "user set node-id not implemented"); + } + if (!vms->secure) { object_property_set_bool(cpuobj, false, "has_el3", NULL); } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 04b062c..a635048 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1606,6 +1606,7 @@ static Property arm_cpu_properties[] =3D { DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0), DEFINE_PROP_UINT64("mp-affinity", ARMCPU, mp_affinity, ARM64_AFFINITY_INVALID), + DEFINE_PROP_INT32("node-id", CPUState, numa_node, CPU_UNSET_NUMA_NODE_= ID), DEFINE_PROP_END_OF_LIST() }; =20 --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190235019397.12889004823126; Wed, 22 Mar 2017 06:43:55 -0700 (PDT) Received: from localhost ([::1]:51187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgYL-0007rz-K9 for importer@patchew.org; Wed, 22 Mar 2017 09:43:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgOg-0007j1-7y for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgOf-0001wp-9Y for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:33:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9973) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOZ-0001uN-M7; Wed, 22 Mar 2017 09:33:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F14D6196E; Wed, 22 Mar 2017 13:33:47 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B9F3A5660; Wed, 22 Mar 2017 13:33:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9F14D6196E Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9F14D6196E From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:34 +0100 Message-Id: <1490189568-167621-10-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Mar 2017 13:33:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 09/23] numa: add check that board supports cpu_index to node mapping X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Default node mapping initialization already checks that board supports cpu_index to node mapping and refuses to start if it's not supported. Do the same for explicitly provided mapping "-numa node,cpus=3D..." Signed-off-by: Igor Mammedov --- numa.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/numa.c b/numa.c index b6e71bc..24c596d 100644 --- a/numa.c +++ b/numa.c @@ -140,10 +140,12 @@ uint32_t numa_get_node(ram_addr_t addr, Error **errp) return -1; } =20 -static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error *= *errp) +static void numa_node_parse(MachineState *ms, NumaNodeOptions *node, + QemuOpts *opts, Error **errp) { uint16_t nodenr; uint16List *cpus =3D NULL; + MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 if (node->has_nodeid) { nodenr =3D node->nodeid; @@ -162,6 +164,10 @@ static void numa_node_parse(NumaNodeOptions *node, Qem= uOpts *opts, Error **errp) return; } =20 + if (!mc->cpu_index_to_instance_props) { + error_report("CPUs to NUMA node mapping isn't supported"); + exit(1); + } for (cpus =3D node->cpus; cpus; cpus =3D cpus->next) { if (cpus->value >=3D max_cpus) { error_setg(errp, @@ -215,6 +221,7 @@ static void numa_node_parse(NumaNodeOptions *node, Qemu= Opts *opts, Error **errp) static int parse_numa(void *opaque, QemuOpts *opts, Error **errp) { NumaOptions *object =3D NULL; + MachineState *ms =3D opaque; Error *err =3D NULL; =20 { @@ -229,7 +236,7 @@ static int parse_numa(void *opaque, QemuOpts *opts, Err= or **errp) =20 switch (object->type) { case NUMA_OPTIONS_TYPE_NODE: - numa_node_parse(&object->u.node, opts, &err); + numa_node_parse(ms, &object->u.node, opts, &err); if (err) { goto end; } @@ -303,7 +310,7 @@ void parse_numa_opts(MachineState *ms) numa_info[i].node_cpu =3D bitmap_new(max_cpus); } =20 - if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL))= { + if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) { exit(1); } =20 --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190203945620.2902063015409; Wed, 22 Mar 2017 06:43:23 -0700 (PDT) Received: from localhost ([::1]:51182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgXp-0007QK-VO for importer@patchew.org; Wed, 22 Mar 2017 09:43:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgOw-0007zc-5b for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgOs-00020W-4M for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58902) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOk-0001yH-BM; Wed, 22 Mar 2017 09:33:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46AF4254A; Wed, 22 Mar 2017 13:33:58 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E61BDA5660; Wed, 22 Mar 2017 13:33:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 46AF4254A Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 46AF4254A From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:35 +0100 Message-Id: <1490189568-167621-11-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 22 Mar 2017 13:33:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 10/23] numa: mirror cpu to node mapping in MachineState::possible_cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Introduce machine_set_cpu_numa_node() helper that stores node mapping for CPU in MachineState::possible_cpus. CPU and node it belongs to is specified by 'props' argument. Patch doesn't remove old way of storing mapping in numa_info[X].node_cpu as removing it at the same time makes patch rather big. Instead it just mirrors mapping in possible_cpus and follow up per target patches will switch to possible_cpus and numa_info[X].node_cpu will be removed once there isn't any users left. Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- include/hw/boards.h | 2 ++ hw/core/machine.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ numa.c | 8 +++++++ 3 files changed, 78 insertions(+) diff --git a/include/hw/boards.h b/include/hw/boards.h index 1dd0fde..40f30f1 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -42,6 +42,8 @@ bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); void machine_register_compat_props(MachineState *machine); HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine= ); +void machine_set_cpu_numa_node(MachineState *machine, + CpuInstanceProperties *props, Error **errp); =20 /** * CPUArchId: diff --git a/hw/core/machine.c b/hw/core/machine.c index 0d92672..6ff0b45 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -388,6 +388,74 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(M= achineState *machine) return head; } =20 +void machine_set_cpu_numa_node(MachineState *machine, + CpuInstanceProperties *props, Error **errp) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(machine); + bool match =3D false; + int i; + + if (!mc->possible_cpu_arch_ids) { + error_setg(errp, "mapping of CPUs to NUMA node is not supported"); + return; + } + + /* force board to initialize possible_cpus if it hasn't been done yet = */ + mc->possible_cpu_arch_ids(machine); + + for (i =3D 0; i < machine->possible_cpus->len; i++) { + CPUArchId *slot =3D &machine->possible_cpus->cpus[i]; + + /* reject unsupported by board properties */ + if (props->has_thread_id && !slot->props.has_thread_id) { + error_setg(errp, "thread-id is not supported"); + return; + } + + if (props->has_core_id && !slot->props.has_core_id) { + error_setg(errp, "core-id is not supported"); + return; + } + + if (props->has_socket_id && !slot->props.has_socket_id) { + error_setg(errp, "socket-id is not supported"); + return; + } + + /* skip slots with explicit mismatch */ + if (props->has_thread_id && props->thread_id !=3D slot->props.thre= ad_id) { + continue; + } + + if (props->has_core_id && props->core_id !=3D slot->props.core_id)= { + continue; + } + + if (props->has_socket_id && props->socket_id !=3D slot->props.sock= et_id) { + continue; + } + + /* reject assignment if slot is already assigned, for compatibility + * of legacy cpu_index mapping with SPAPR core based mapping do not + * error out if cpu thread and matched core have the same node-id = */ + if (slot->props.has_node_id && + slot->props.node_id !=3D props->node_id) { + error_setg(errp, "CPU is already assigned to node-id: %" PRId6= 4, + slot->props.node_id); + return; + } + + /* assign slot to node as it's matched '-numa cpu' key */ + match =3D true; + slot->props.node_id =3D props->node_id; + slot->props.has_node_id =3D props->has_node_id; + } + + if (!match) { + error_setg(errp, "no match found"); + } +} + static void machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); diff --git a/numa.c b/numa.c index 24c596d..44057f1 100644 --- a/numa.c +++ b/numa.c @@ -169,6 +169,7 @@ static void numa_node_parse(MachineState *ms, NumaNodeO= ptions *node, exit(1); } for (cpus =3D node->cpus; cpus; cpus =3D cpus->next) { + CpuInstanceProperties props; if (cpus->value >=3D max_cpus) { error_setg(errp, "CPU index (%" PRIu16 ")" @@ -177,6 +178,10 @@ static void numa_node_parse(MachineState *ms, NumaNode= Options *node, return; } bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1); + props =3D mc->cpu_index_to_instance_props(ms, cpus->value); + props.node_id =3D nodenr; + props.has_node_id =3D true; + machine_set_cpu_numa_node(ms, &props, &error_fatal); } =20 if (node->has_mem && node->has_memdev) { @@ -393,9 +398,12 @@ void parse_numa_opts(MachineState *ms) if (i =3D=3D nb_numa_nodes) { for (i =3D 0; i < max_cpus; i++) { CpuInstanceProperties props; + /* fetch default mapping from board and enable it */ props =3D mc->cpu_index_to_instance_props(ms, i); + props.has_node_id =3D true; =20 set_bit(i, numa_info[props.node_id].node_cpu); + machine_set_cpu_numa_node(ms, &props, &error_fatal); } } =20 --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189805123180.1245654058862; Wed, 22 Mar 2017 06:36:45 -0700 (PDT) Received: from localhost ([::1]:51128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgRP-0001W7-QM for importer@patchew.org; Wed, 22 Mar 2017 09:36:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgP0-00083s-T7 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgP0-00022O-0q for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOt-00020b-3A; Wed, 22 Mar 2017 09:34:07 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1890B67EC3; Wed, 22 Mar 2017 13:34:07 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21F82A5660; Wed, 22 Mar 2017 13:33:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1890B67EC3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1890B67EC3 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:36 +0100 Message-Id: <1490189568-167621-12-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Mar 2017 13:34:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 11/23] numa: do default mapping based on possible_cpus instead of node_cpu bitmaps X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- numa.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/numa.c b/numa.c index 44057f1..ab41776 100644 --- a/numa.c +++ b/numa.c @@ -309,6 +309,7 @@ static void validate_numa_cpus(void) void parse_numa_opts(MachineState *ms) { int i; + const CPUArchIdList *possible_cpus; MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 for (i =3D 0; i < MAX_NODES; i++) { @@ -379,11 +380,6 @@ void parse_numa_opts(MachineState *ms) =20 numa_set_mem_ranges(); =20 - for (i =3D 0; i < nb_numa_nodes; i++) { - if (!bitmap_empty(numa_info[i].node_cpu, max_cpus)) { - break; - } - } /* Historically VCPUs were assigned in round-robin order to NUMA * nodes. However it causes issues with guest not handling it nice * in case where cores/threads from a multicore CPU appear on @@ -391,11 +387,20 @@ void parse_numa_opts(MachineState *ms) * rule grouping VCPUs by socket so that VCPUs from the same socket * would be on the same node. */ - if (!mc->cpu_index_to_instance_props) { + if (!mc->cpu_index_to_instance_props || !mc->possible_cpu_arch_ids= ) { error_report("default CPUs to NUMA node mapping isn't supporte= d"); exit(1); } - if (i =3D=3D nb_numa_nodes) { + + possible_cpus =3D mc->possible_cpu_arch_ids(ms); + for (i =3D 0; i < possible_cpus->len; i++) { + if (possible_cpus->cpus[i].props.has_node_id) { + break; + } + } + + /* no CPUs are assigned to NUMA nodes */ + if (i =3D=3D possible_cpus->len) { for (i =3D 0; i < max_cpus; i++) { CpuInstanceProperties props; /* fetch default mapping from board and enable it */ --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490189954652901.0622821340648; Wed, 22 Mar 2017 06:39:14 -0700 (PDT) Received: from localhost ([::1]:51144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgTp-0003hV-9F for importer@patchew.org; Wed, 22 Mar 2017 09:39:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgP2-00085j-Nb for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgP1-00022v-I3 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10173) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgOy-00021h-KO; Wed, 22 Mar 2017 09:34:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DD4980B20; Wed, 22 Mar 2017 13:34:12 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6018C18A23; Wed, 22 Mar 2017 13:34:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7DD4980B20 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7DD4980B20 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:37 +0100 Message-Id: <1490189568-167621-13-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Mar 2017 13:34:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 12/23] pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hw/acpi/cpu.c | 7 +++---- hw/i386/acpi-build.c | 11 ++++------- hw/i386/pc.c | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 8c719d3..90fe24d 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -503,7 +503,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, = CPUHotplugFeatures opts, =20 /* build Processor object for each processor */ for (i =3D 0; i < arch_ids->len; i++) { - int j; Aml *dev; Aml *uid =3D aml_int(i); GArray *madt_buf =3D g_array_new(0, 1, 1); @@ -557,9 +556,9 @@ void build_cpus_aml(Aml *table, MachineState *machine, = CPUHotplugFeatures opts, * as a result _PXM is required for all CPUs which might * be hot-plugged. For simplicity, add it for all CPUs. */ - j =3D numa_get_node_for_cpu(i); - if (j < nb_numa_nodes) { - aml_append(dev, aml_name_decl("_PXM", aml_int(j))); + if (arch_ids->cpus[i].props.has_node_id) { + int node_id =3D arch_ids->cpus[i].props.node_id; + aml_append(dev, aml_name_decl("_PXM", aml_int(node_id))); } =20 aml_append(cpus_dev, dev); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2073108..a2be70b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2306,7 +2306,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, Ma= chineState *machine) srat->reserved1 =3D cpu_to_le32(1); =20 for (i =3D 0; i < apic_ids->len; i++) { - int j =3D numa_get_node_for_cpu(i); + int node_id =3D apic_ids->cpus[i].props.has_node_id ? + apic_ids->cpus[i].props.node_id : 0; uint32_t apic_id =3D apic_ids->cpus[i].arch_id; =20 if (apic_id < 255) { @@ -2316,9 +2317,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, Ma= chineState *machine) core->type =3D ACPI_SRAT_PROCESSOR_APIC; core->length =3D sizeof(*core); core->local_apic_id =3D apic_id; - if (j < nb_numa_nodes) { - core->proximity_lo =3D j; - } + core->proximity_lo =3D node_id; memset(core->proximity_hi, 0, 3); core->local_sapic_eid =3D 0; core->flags =3D cpu_to_le32(1); @@ -2329,9 +2328,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, Ma= chineState *machine) core->type =3D ACPI_SRAT_PROCESSOR_x2APIC; core->length =3D sizeof(*core); core->x2apic_id =3D cpu_to_le32(apic_id); - if (j < nb_numa_nodes) { - core->proximity_domain =3D cpu_to_le32(j); - } + core->proximity_domain =3D cpu_to_le32(node_id); core->flags =3D cpu_to_le32(1); } } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 873bbfa..6fdec59 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -747,7 +747,9 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PC= MachineState *pcms) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; - int i, j; + int i; + const CPUArchIdList *cpus; + MachineClass *mc =3D MACHINE_GET_CLASS(pcms); =20 fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, as); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); @@ -782,12 +784,12 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, = PCMachineState *pcms) */ numa_fw_cfg =3D g_new0(uint64_t, 1 + pcms->apic_id_limit + nb_numa_nod= es); numa_fw_cfg[0] =3D cpu_to_le64(nb_numa_nodes); - for (i =3D 0; i < max_cpus; i++) { - unsigned int apic_id =3D x86_cpu_apic_id_from_index(i); + cpus =3D mc->possible_cpu_arch_ids(MACHINE(pcms)); + for (i =3D 0; i < cpus->len; i++) { + unsigned int apic_id =3D cpus->cpus[i].arch_id; assert(apic_id < pcms->apic_id_limit); - j =3D numa_get_node_for_cpu(i); - if (j < nb_numa_nodes) { - numa_fw_cfg[apic_id + 1] =3D cpu_to_le64(j); + if (cpus->cpus[i].props.has_node_id) { + numa_fw_cfg[apic_id + 1] =3D cpu_to_le64(cpus->cpus[i].props.n= ode_id); } } for (i =3D 0; i < nb_numa_nodes; i++) { @@ -1986,8 +1988,8 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_d= ev, cs =3D CPU(cpu); cs->cpu_index =3D idx; =20 - node_id =3D numa_get_node_for_cpu(cs->cpu_index); - if (node_id =3D=3D nb_numa_nodes) { + node_id =3D cpu_slot->props.node_id; + if (!cpu_slot->props.has_node_id) { /* by default CPUState::numa_node was 0 if it's not set via CLI * keep it this way for now but in future we probably should * refuse to start up with incomplete numa mapping */ --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149019036525757.587864570632746; Wed, 22 Mar 2017 06:46:05 -0700 (PDT) Received: from localhost ([::1]:51210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgaR-0001Re-OI for importer@patchew.org; Wed, 22 Mar 2017 09:46:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgP8-0008A9-TM for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgP7-000254-Gb for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50452) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgP2-000232-K8; Wed, 22 Mar 2017 09:34:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9AF29804F4; Wed, 22 Mar 2017 13:34:16 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4E9719805; Wed, 22 Mar 2017 13:34:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9AF29804F4 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9AF29804F4 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:38 +0100 Message-Id: <1490189568-167621-14-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 22 Mar 2017 13:34:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 13/23] spapr: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it's safe to remove thread node_id !=3D core node_id error branch as machine_set_cpu_numa_node() also does mismatch check and is called even before any CPU is created. Signed-off-by: Igor Mammedov --- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_cpu_core.c | 14 ++------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9c61721..42cef3d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2803,8 +2803,8 @@ static void spapr_core_pre_plug(HotplugHandler *hotpl= ug_dev, DeviceState *dev, goto out; } =20 - node_id =3D numa_get_node_for_cpu(cc->core_id); - if (node_id =3D=3D nb_numa_nodes) { + node_id =3D core_slot->props.node_id; + if (!core_slot->props.has_node_id) { /* by default CPUState::numa_node was 0 if it's not set via CLI * keep it this way for now but in future we probably should * refuse to start up with incomplete numa mapping */ diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 25988f8..8d48468 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -168,7 +168,6 @@ static void spapr_cpu_core_realize(DeviceState *dev, Er= ror **errp) =20 sc->threads =3D g_malloc0(size * cc->nr_threads); for (i =3D 0; i < cc->nr_threads; i++) { - int node_id; char id[32]; CPUState *cs; =20 @@ -178,17 +177,8 @@ static void spapr_cpu_core_realize(DeviceState *dev, E= rror **errp) cs =3D CPU(obj); cs->cpu_index =3D cc->core_id + i; =20 - /* Set NUMA node for the added CPUs */ - node_id =3D numa_get_node_for_cpu(cs->cpu_index); - if (node_id !=3D sc->node_id) { - error_setg(&local_err, "Invalid node-id=3D%d of thread[cpu-ind= ex: %d]" - " on CPU[core-id: %d, node-id: %d], node-id must be the sa= me", - node_id, cs->cpu_index, cc->core_id, sc->node_id); - goto err; - } - if (node_id < nb_numa_nodes) { - cs->numa_node =3D node_id; - } + /* Set NUMA node for the threads belonged to core */ + cs->numa_node =3D sc->node_id; =20 snprintf(id, sizeof(id), "thread[%d]", i); object_property_add_child(OBJECT(sc), id, obj, &local_err); --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190503578910.6423096718316; Wed, 22 Mar 2017 06:48:23 -0700 (PDT) Received: from localhost ([::1]:51222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgcg-0003G8-5r for importer@patchew.org; Wed, 22 Mar 2017 09:48:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPC-0008Cw-7I for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPB-000261-69 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgP7-00024Y-64; Wed, 22 Mar 2017 09:34:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2360161E4A; Wed, 22 Mar 2017 13:34:21 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2B4618B40; Wed, 22 Mar 2017 13:34:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2360161E4A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2360161E4A From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:39 +0100 Message-Id: <1490189568-167621-15-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 22 Mar 2017 13:34:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 14/23] virt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hw/arm/virt-acpi-build.c | 19 +++++++------------ hw/arm/virt.c | 13 +++++++------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 0835e59..ce7499c 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -486,30 +486,25 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vi= rtMachineState *vms) AcpiSystemResourceAffinityTable *srat; AcpiSratProcessorGiccAffinity *core; AcpiSratMemoryAffinity *numamem; - int i, j, srat_start; + int i, srat_start; uint64_t mem_base; - uint32_t *cpu_node =3D g_malloc0(vms->smp_cpus * sizeof(uint32_t)); - - for (i =3D 0; i < vms->smp_cpus; i++) { - j =3D numa_get_node_for_cpu(i); - if (j < nb_numa_nodes) { - cpu_node[i] =3D j; - } - } + MachineClass *mc =3D MACHINE_GET_CLASS(vms); + const CPUArchIdList *cpu_list =3D mc->possible_cpu_arch_ids(MACHINE(vm= s)); =20 srat_start =3D table_data->len; srat =3D acpi_data_push(table_data, sizeof(*srat)); srat->reserved1 =3D cpu_to_le32(1); =20 - for (i =3D 0; i < vms->smp_cpus; ++i) { + for (i =3D 0; i < cpu_list->len; ++i) { + int node_id =3D cpu_list->cpus[i].props.has_node_id ? + cpu_list->cpus[i].props.node_id : 0; core =3D acpi_data_push(table_data, sizeof(*core)); core->type =3D ACPI_SRAT_PROCESSOR_GICC; core->length =3D sizeof(*core); - core->proximity =3D cpu_to_le32(cpu_node[i]); + core->proximity =3D cpu_to_le32(node_id); core->acpi_processor_uid =3D cpu_to_le32(i); core->flags =3D cpu_to_le32(1); } - g_free(cpu_node); =20 mem_base =3D vms->memmap[VIRT_MEM].base; for (i =3D 0; i < nb_numa_nodes; ++i) { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 68d44f3..0a75df5 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -338,7 +338,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) { int cpu; int addr_cells =3D 1; - unsigned int i; + const MachineState *ms =3D MACHINE(vms); =20 /* * From Documentation/devicetree/bindings/arm/cpus.txt @@ -369,6 +369,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) for (cpu =3D vms->smp_cpus - 1; cpu >=3D 0; cpu--) { char *nodename =3D g_strdup_printf("/cpus/cpu@%d", cpu); ARMCPU *armcpu =3D ARM_CPU(qemu_get_cpu(cpu)); + CPUState *cs =3D CPU(armcpu); =20 qemu_fdt_add_subnode(vms->fdt, nodename); qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "cpu"); @@ -389,9 +390,9 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) armcpu->mp_affinity); } =20 - i =3D numa_get_node_for_cpu(cpu); - if (i < nb_numa_nodes) { - qemu_fdt_setprop_cell(vms->fdt, nodename, "numa-node-id", i); + if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) { + qemu_fdt_setprop_cell(vms->fdt, nodename, "numa-node-id", + ms->possible_cpus->cpus[cs->cpu_index].props.node_id); } =20 g_free(nodename); @@ -1378,8 +1379,8 @@ static void machvirt_init(MachineState *machine) cs =3D CPU(cpuobj); cs->cpu_index =3D n; =20 - node_id =3D numa_get_node_for_cpu(cs->cpu_index); - if (node_id =3D=3D nb_numa_nodes) { + node_id =3D machine->possible_cpus->cpus[cs->cpu_index].props.node= _id; + if (!machine->possible_cpus->cpus[cs->cpu_index].props.has_node_id= ) { /* by default CPUState::numa_node was 0 if it's not set via CLI * keep it this way for now but in future we probably should * refuse to start up with incomplete numa mapping */ --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190415271160.2758488939976; Wed, 22 Mar 2017 06:46:55 -0700 (PDT) Received: from localhost ([::1]:51213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgbG-00026F-33 for importer@patchew.org; Wed, 22 Mar 2017 09:46:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPI-0008JO-Og for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPH-00027X-OL for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50882) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPF-00026u-EK; Wed, 22 Mar 2017 09:34:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DA6183F43; Wed, 22 Mar 2017 13:34:29 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 661D118A50; Wed, 22 Mar 2017 13:34:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5DA6183F43 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5DA6183F43 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:40 +0100 Message-Id: <1490189568-167621-16-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 22 Mar 2017 13:34:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 15/23] QMP: include CpuInstanceProperties into query_cpus output output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" if board supports CpuInstanceProperties, report them for each CPU thread listed. Main motivation for this is to provide these properties introspection via QMP interface for using in test cases to verify numa node to cpu mapping, which includes not only boards that support cpu hotplug and have this info in query-hotpluggable-cpus (pc/spapr) but also for boards that don't not support hotpluggable-cpus but support numa mapping (virt-arm). Signed-off-by: Igor Mammedov Reviewed-by: Eric Blake --- cpus.c | 9 +++++++++ qapi-schema.json | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 167d961..03aa12c 100644 --- a/cpus.c +++ b/cpus.c @@ -50,6 +50,7 @@ #include "qapi-event.h" #include "hw/nmi.h" #include "sysemu/replay.h" +#include "hw/boards.h" =20 #ifdef CONFIG_LINUX =20 @@ -1810,6 +1811,8 @@ void list_cpus(FILE *f, fprintf_function cpu_fprintf,= const char *optarg) =20 CpuInfoList *qmp_query_cpus(Error **errp) { + MachineState *ms =3D MACHINE(qdev_get_machine()); + MachineClass *mc =3D MACHINE_GET_CLASS(ms); CpuInfoList *head =3D NULL, *cur_item =3D NULL; CPUState *cpu; =20 @@ -1860,6 +1863,12 @@ CpuInfoList *qmp_query_cpus(Error **errp) #else info->value->arch =3D CPU_INFO_ARCH_OTHER; #endif + if ((info->value->has_props =3D !!mc->cpu_index_to_instance_props)= ) { + CpuInstanceProperties *props; + props =3D g_malloc0(sizeof(*props)); + *props =3D mc->cpu_index_to_instance_props(ms, cpu->cpu_index); + info->value->props =3D props; + } =20 /* XXX: waiting for the qapi to support GSList */ if (!cur_item) { diff --git a/qapi-schema.json b/qapi-schema.json index 68a4327..a6b5955 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1322,6 +1322,9 @@ # # @thread_id: ID of the underlying host thread # +# @props: properties describing to which node/socket/core/thread +# virtual CPU belongs to, provided if supported by board (since 2.= 10) +# # @arch: architecture of the cpu, which determines which additional fields # will be listed (since 2.6) # @@ -1332,7 +1335,8 @@ ## { 'union': 'CpuInfo', 'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool', - 'qom_path': 'str', 'thread_id': 'int', 'arch': 'CpuInfoArch' }, + 'qom_path': 'str', 'thread_id': 'int', + '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' }, 'discriminator': 'arch', 'data': { 'x86': 'CpuInfoX86', 'sparc': 'CpuInfoSPARC', --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190613332576.9383876652951; Wed, 22 Mar 2017 06:50:13 -0700 (PDT) Received: from localhost ([::1]:51229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgeS-0004eG-34 for importer@patchew.org; Wed, 22 Mar 2017 09:50:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPQ-0008RC-Ri for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPM-0002A9-Rc for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44247) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPK-000289-I3; Wed, 22 Mar 2017 09:34:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76D289FDEA; Wed, 22 Mar 2017 13:34:34 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2670A5662; Wed, 22 Mar 2017 13:34:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 76D289FDEA Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 76D289FDEA From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:41 +0100 Message-Id: <1490189568-167621-17-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 22 Mar 2017 13:34:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 16/23] tests: numa: add case for QMP command query-cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- tests/numa-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/numa-test.c b/tests/numa-test.c index f5da0c8..8326321 100644 --- a/tests/numa-test.c +++ b/tests/numa-test.c @@ -87,6 +87,49 @@ static void test_mon_partial(const void *data) g_free(cli); } =20 +static QList* get_cpus(QDict **resp) { + *resp =3D qmp("{ 'execute': 'query-cpus' }"); + g_assert(*resp); + g_assert(qdict_haskey(*resp, "return")); + return qdict_get_qlist(*resp, "return"); +} + +static void test_query_cpus(const void *data) +{ + char *cli; + QDict *resp; + QList *cpus; + const QObject *e; + + cli =3D make_cli(data, "-smp 8 -numa node,cpus=3D0-3 -numa node,cpus= =3D4-7"); + qtest_start(cli); + cpus =3D get_cpus(&resp); + g_assert(cpus); + + while ((e =3D qlist_pop(cpus))) { + QDict *cpu, *props; + int64_t cpu_idx, node; + + cpu =3D qobject_to_qdict(e); + g_assert(qdict_haskey(cpu, "CPU")); + g_assert(qdict_haskey(cpu, "props")); + + cpu_idx =3D qdict_get_int(cpu, "CPU"); + props =3D qdict_get_qdict(cpu, "props"); + g_assert(qdict_haskey(props, "node-id")); + node =3D qdict_get_int(props, "node-id"); + if (cpu_idx >=3D 0 && cpu_idx < 4) { + g_assert_cmpint(node, =3D=3D, 0); + } else { + g_assert_cmpint(node, =3D=3D, 1); + } + } + + QDECREF(resp); + qtest_end(); + g_free(cli); +} + int main(int argc, char **argv) { const char *args =3D NULL; @@ -101,6 +144,7 @@ int main(int argc, char **argv) qtest_add_data_func("/numa/mon/default", args, test_mon_default); qtest_add_data_func("/numa/mon/cpus/explicit", args, test_mon_explicit= ); qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial); + qtest_add_data_func("/numa/qmp/cpus/query-cpus", args, test_query_cpus= ); =20 return g_test_run(); } --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190558607380.303499829427; Wed, 22 Mar 2017 06:49:18 -0700 (PDT) Received: from localhost ([::1]:51227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgdY-00044E-V0 for importer@patchew.org; Wed, 22 Mar 2017 09:49:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPV-0008W2-Sa for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPV-0002CF-1K for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40944) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPQ-0002AQ-2W; Wed, 22 Mar 2017 09:34:40 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDFF2915BE; Wed, 22 Mar 2017 13:34:39 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC170A5662; Wed, 22 Mar 2017 13:34:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CDFF2915BE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CDFF2915BE From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:42 +0100 Message-Id: <1490189568-167621-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 22 Mar 2017 13:34:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 17/23] numa: remove no longer used numa_get_node_for_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it's been replaced by fetching mapping info from possible_cpus Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- include/sysemu/numa.h | 4 ---- numa.c | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 46ea6c7..c67763a 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -31,8 +31,4 @@ extern QemuOptsList qemu_numa_opts; 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 ab41776..187c93f 100644 --- a/numa.c +++ b/numa.c @@ -583,20 +583,6 @@ MemdevList *qmp_query_memdev(Error **errp) return list; } =20 -int numa_get_node_for_cpu(int idx) -{ - int i; - - assert(idx < max_cpus); - - for (i =3D 0; i < nb_numa_nodes; i++) { - if (test_bit(idx, numa_info[i].node_cpu)) { - break; - } - } - return i; -} - void ram_block_notifier_add(RAMBlockNotifier *n) { QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next); --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190736288530.1400230748752; Wed, 22 Mar 2017 06:52:16 -0700 (PDT) Received: from localhost ([::1]:51247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqggQ-0006H4-1U for importer@patchew.org; Wed, 22 Mar 2017 09:52:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPc-0000Aa-2m for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPb-0002Dj-9L for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPW-0002CW-Kn; Wed, 22 Mar 2017 09:34:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92D90C012844; Wed, 22 Mar 2017 13:34:46 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1EA0518A49; Wed, 22 Mar 2017 13:34:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 92D90C012844 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 92D90C012844 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:43 +0100 Message-Id: <1490189568-167621-19-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 22 Mar 2017 13:34:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 18/23] numa: remove no longer need numa_post_machine_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" CPUState::numa_node is still in use but now it's set by board when it creates CPU objects. So there isn't any need to set it again after all CPU's are created, since it's been already set. Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- include/sysemu/numa.h | 1 - numa.c | 15 --------------- vl.c | 2 -- 3 files changed, 18 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index c67763a..345bb94 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -25,7 +25,6 @@ typedef struct node_info { =20 extern NodeInfo numa_info[MAX_NODES]; void parse_numa_opts(MachineState *ms); -void numa_post_machine_init(void); void query_numa_node_mem(uint64_t node_mem[]); extern QemuOptsList qemu_numa_opts; void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); diff --git a/numa.c b/numa.c index 187c93f..8461c96 100644 --- a/numa.c +++ b/numa.c @@ -418,21 +418,6 @@ void parse_numa_opts(MachineState *ms) } } =20 -void numa_post_machine_init(void) -{ - CPUState *cpu; - int i; - - CPU_FOREACH(cpu) { - for (i =3D 0; i < nb_numa_nodes; i++) { - assert(cpu->cpu_index < max_cpus); - if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) { - cpu->numa_node =3D i; - } - } - } -} - static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner, const char *name, uint64_t ram_size) diff --git a/vl.c b/vl.c index 5ffb9c3..e5c1620 100644 --- a/vl.c +++ b/vl.c @@ -4587,8 +4587,6 @@ int main(int argc, char **argv, char **envp) =20 cpu_synchronize_all_post_init(); =20 - numa_post_machine_init(); - rom_reset_order_override(); =20 /* --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190824826980.7505524277359; Wed, 22 Mar 2017 06:53:44 -0700 (PDT) Received: from localhost ([::1]:51252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqghr-0007Sg-MR for importer@patchew.org; Wed, 22 Mar 2017 09:53:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPj-0000G4-3T for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPf-0002F3-2v for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41420) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPZ-0002D4-Ol; Wed, 22 Mar 2017 09:34:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A486E7AE93; Wed, 22 Mar 2017 13:34:49 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1F256046C; Wed, 22 Mar 2017 13:34:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A486E7AE93 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A486E7AE93 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:44 +0100 Message-Id: <1490189568-167621-20-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 22 Mar 2017 13:34:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 19/23] machine: call machine init from wrapper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" add machine_run_board_init() wrapper that calls machine init for now but in follow up patches it will be used to run generic machine code that should run before machine init. Signed-off-by: Igor Mammedov --- include/hw/boards.h | 1 + hw/core/machine.c | 6 ++++++ vl.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 40f30f1..42742d0 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -32,6 +32,7 @@ void memory_region_allocate_system_memory(MemoryRegion *m= r, Object *owner, MachineClass *find_default_machine(void); extern MachineState *current_machine; =20 +void machine_run_board_init(MachineState *machine); bool machine_usb(MachineState *machine); bool machine_kernel_irqchip_allowed(MachineState *machine); bool machine_kernel_irqchip_required(MachineState *machine); diff --git a/hw/core/machine.c b/hw/core/machine.c index 6ff0b45..d284a63 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -643,6 +643,12 @@ bool machine_mem_merge(MachineState *machine) return machine->mem_merge; } =20 +void machine_run_board_init(MachineState *machine) +{ + MachineClass *machine_class =3D MACHINE_GET_CLASS(machine); + machine_class->init(machine); +} + static void machine_class_finalize(ObjectClass *klass, void *data) { MachineClass *mc =3D MACHINE_CLASS(klass); diff --git a/vl.c b/vl.c index e5c1620..2b0aed3 100644 --- a/vl.c +++ b/vl.c @@ -4554,7 +4554,7 @@ int main(int argc, char **argv, char **envp) current_machine->boot_order =3D boot_order; current_machine->cpu_model =3D cpu_model; =20 - machine_class->init(current_machine); + machine_run_board_init(current_machine); =20 realtime_init(); =20 --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190894494183.84485420454143; Wed, 22 Mar 2017 06:54:54 -0700 (PDT) Received: from localhost ([::1]:51258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgiz-0008Er-1r for importer@patchew.org; Wed, 22 Mar 2017 09:54:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPg-0000Da-DZ for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPf-0002F8-41 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:34:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52408) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPc-0002Dv-F1; Wed, 22 Mar 2017 09:34:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60A4D8FD03; Wed, 22 Mar 2017 13:34:52 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E901A189FB; Wed, 22 Mar 2017 13:34:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 60A4D8FD03 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 60A4D8FD03 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:45 +0100 Message-Id: <1490189568-167621-21-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Mar 2017 13:34:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 20/23] numa: use possible_cpus for not mapped CPUs check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" and remove corresponding part in numa.c that uses node_cpu bitmaps. Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- It's one more less user of node_cpu bitmpas, following commit will remove the last user along with node_cpu itself. --- hw/core/machine.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ numa.c | 10 ---------- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index d284a63..ab51d2c 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -19,6 +19,7 @@ #include "sysemu/sysemu.h" #include "qemu/error-report.h" #include "qemu/cutils.h" +#include "sysemu/numa.h" =20 static char *machine_get_accel(Object *obj, Error **errp) { @@ -643,9 +644,66 @@ bool machine_mem_merge(MachineState *machine) return machine->mem_merge; } =20 +static char *cpu_slot_to_string(const CPUArchId *cpu) +{ + GString *s =3D g_string_new(NULL); + if (cpu->props.has_socket_id) { + g_string_append_printf(s, "socket-id: %"PRId64, cpu->props.socket_= id); + } + if (cpu->props.has_core_id) { + if (s->len) { + g_string_append_printf(s, ", "); + } + g_string_append_printf(s, "core-id: %"PRId64, cpu->props.core_id); + } + if (cpu->props.has_thread_id) { + if (s->len) { + g_string_append_printf(s, ", "); + } + g_string_append_printf(s, "thread-id: %"PRId64, cpu->props.thread_= id); + } + return g_string_free(s, false); +} + +static void machine_numa_validate(MachineState *machine) +{ + int i; + GString *s =3D g_string_new(NULL); + MachineClass *mc =3D MACHINE_GET_CLASS(machine); + const CPUArchIdList *possible_cpus =3D mc->possible_cpu_arch_ids(machi= ne); + + assert(nb_numa_nodes); + for (i =3D 0; i < possible_cpus->len; i++) { + const CPUArchId *cpu_slot =3D &possible_cpus->cpus[i]; + + /* at this point numa mappings are initilized by CLI options + * or with default mappings so it's sufficient to list + * all not yet mapped CPUs here */ + /* TODO: make it hard error in future */ + if (!cpu_slot->props.has_node_id) { + char *cpu_str =3D cpu_slot_to_string(cpu_slot); + g_string_append_printf(s, "%sCPU %d [%s]", s->len ? ", " : "",= i, + cpu_str); + g_free(cpu_str); + } + } + if (s->len) { + error_report("warning: CPU(s) not present in any NUMA nodes: %s", + s->str); + error_report("warning: All CPU(s) up to maxcpus should be describe= d " + "in NUMA config, ability to start up with partial NUM= A " + "mappings is obsoleted and will be removed in future"= ); + } + g_string_free(s, true); +} + void machine_run_board_init(MachineState *machine) { MachineClass *machine_class =3D MACHINE_GET_CLASS(machine); + + if (nb_numa_nodes) { + machine_numa_validate(machine); + } machine_class->init(machine); } =20 diff --git a/numa.c b/numa.c index 8461c96..523558f 100644 --- a/numa.c +++ b/numa.c @@ -293,16 +293,6 @@ static void validate_numa_cpus(void) bitmap_or(seen_cpus, seen_cpus, numa_info[i].node_cpu, max_cpus); } - - if (!bitmap_full(seen_cpus, max_cpus)) { - char *msg; - bitmap_complement(seen_cpus, seen_cpus, max_cpus); - msg =3D enumerate_cpus(seen_cpus, max_cpus); - error_report("warning: CPU(s) not present in any NUMA nodes: %s", = msg); - error_report("warning: All CPU(s) up to maxcpus should be describe= d " - "in NUMA config"); - g_free(msg); - } g_free(seen_cpus); } =20 --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190975081703.8475145576313; Wed, 22 Mar 2017 06:56:15 -0700 (PDT) Received: from localhost ([::1]:51267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgkI-0000il-0W for importer@patchew.org; Wed, 22 Mar 2017 09:56:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPn-0000Ld-Pq for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPm-0002IT-TT for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPf-0002Ez-D4; Wed, 22 Mar 2017 09:34:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C58D804FA; Wed, 22 Mar 2017 13:34:55 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A65916046C; Wed, 22 Mar 2017 13:34:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5C58D804FA Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5C58D804FA From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:46 +0100 Message-Id: <1490189568-167621-22-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 22 Mar 2017 13:34:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 21/23] numa: remove node_cpu bitmaps as they are no longer used X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Postfactum "CPU(s) present in multiple NUMA nodes" check was the last user of node_cpu bitmaps, but it's not need as machine_set_cpu_numa_node() does the similar check at the time mapping is set for cpus (i.e. when -numa cpus=3D is parsed) and ensures that cpu can be mapped only to one node. Remove duplicate check based on node_cpu bitmaps and since the last user is gone remove node_cpu as well, which completes internal transition from legacy bitmap based mapping storage to possible_cpus storage. Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- include/sysemu/numa.h | 1 - numa.c | 42 ------------------------------------------ 2 files changed, 43 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 345bb94..796ee94 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -17,7 +17,6 @@ struct numa_addr_range { =20 typedef struct node_info { uint64_t node_mem; - unsigned long *node_cpu; struct HostMemoryBackend *node_memdev; bool present; QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */ diff --git a/numa.c b/numa.c index 523558f..088fae3 100644 --- a/numa.c +++ b/numa.c @@ -177,7 +177,6 @@ static void numa_node_parse(MachineState *ms, NumaNodeO= ptions *node, cpus->value, max_cpus); return; } - bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1); props =3D mc->cpu_index_to_instance_props(ms, cpus->value); props.node_id =3D nodenr; props.has_node_id =3D true; @@ -261,51 +260,12 @@ end: return 0; } =20 -static char *enumerate_cpus(unsigned long *cpus, int max_cpus) -{ - int cpu; - bool first =3D true; - GString *s =3D g_string_new(NULL); - - for (cpu =3D find_first_bit(cpus, max_cpus); - cpu < max_cpus; - cpu =3D find_next_bit(cpus, max_cpus, cpu + 1)) { - g_string_append_printf(s, "%s%d", first ? "" : " ", cpu); - first =3D false; - } - return g_string_free(s, FALSE); -} - -static void validate_numa_cpus(void) -{ - int i; - unsigned long *seen_cpus =3D bitmap_new(max_cpus); - - for (i =3D 0; i < nb_numa_nodes; i++) { - if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus))= { - bitmap_and(seen_cpus, seen_cpus, - numa_info[i].node_cpu, max_cpus); - error_report("CPU(s) present in multiple NUMA nodes: %s", - enumerate_cpus(seen_cpus, max_cpus)); - g_free(seen_cpus); - exit(EXIT_FAILURE); - } - bitmap_or(seen_cpus, seen_cpus, - numa_info[i].node_cpu, max_cpus); - } - g_free(seen_cpus); -} - void parse_numa_opts(MachineState *ms) { int i; const CPUArchIdList *possible_cpus; MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 - for (i =3D 0; i < MAX_NODES; i++) { - numa_info[i].node_cpu =3D bitmap_new(max_cpus); - } - if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) { exit(1); } @@ -397,12 +357,10 @@ void parse_numa_opts(MachineState *ms) props =3D mc->cpu_index_to_instance_props(ms, i); props.has_node_id =3D true; =20 - set_bit(i, numa_info[props.node_id].node_cpu); machine_set_cpu_numa_node(ms, &props, &error_fatal); } } =20 - validate_numa_cpus(); } else { numa_set_mem_node_id(0, ram_size, 0); } --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190803943416.1941611974096; Wed, 22 Mar 2017 06:53:23 -0700 (PDT) Received: from localhost ([::1]:51251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqghW-00079C-Lj for importer@patchew.org; Wed, 22 Mar 2017 09:53:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPu-0000VK-9f for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPq-0002Jz-Cy for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34824) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPj-0002G6-8F; Wed, 22 Mar 2017 09:34:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23500C054924; Wed, 22 Mar 2017 13:34:59 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A56C319CB7; Wed, 22 Mar 2017 13:34:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 23500C054924 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 23500C054924 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:47 +0100 Message-Id: <1490189568-167621-23-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 22 Mar 2017 13:34:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 22/23] numa: add '-numa cpu, ...' option for property based node mapping X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" legacy cpu to node mapping is using cpu index values to map VCPU to node with help of '-numa node,nodeid=3Dnode,cpus=3Dx[-y]' option. However cpu index is internal concept and QEMU users have to guess /reimplement qemu's logic/ to map it to a concrete cpu socket/core/thread to make sane CPUs placement across numa nodes. This patch allows to map cpu objects to numa nodes using the same properties as used for cpus with -device/device_add (socket-id/core-id/thread-id/node-id). At present valid properties/values to address CPUs could be fetched using hotpluggable-cpus monitor/qmp command, it will require user to start qemu twice when creating domain to fetch possible CPUs for a machine type/-smp layout first and then the second time with numa explicit mapping for actual usage. The first step results could be saved and reused to set/change mapping later as far as machine type/-smp stays the same. Proposed impl. supports exact and wildcard matching to simplify CLI and allow to set mapping for a specific cpu or group of cpu objects specified by matched properties. For example: # exact mapping x86 -numa cpu,node-id=3Dx,socket-id=3Dy,core-id=3Dz,thread-id=3Dn # exact mapping SPAPR -numa cpu,node-id=3Dx,core-id=3Dy # wildcard mapping, all cpu objects that match socket-id=3Dy # are mapped to node-id=3Dx -numa cpu,node-id=3Dx,socket-id=3Dy Signed-off-by: Igor Mammedov --- numa.c | 13 +++++++++++++ qapi-schema.json | 7 +++++-- qemu-options.hx | 23 ++++++++++++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/numa.c b/numa.c index 088fae3..588586b 100644 --- a/numa.c +++ b/numa.c @@ -246,6 +246,19 @@ static int parse_numa(void *opaque, QemuOpts *opts, Er= ror **errp) } nb_numa_nodes++; break; + case NUMA_OPTIONS_TYPE_CPU: + if (!object->u.cpu.has_node_id) { + error_setg(&err, "Missing mandatory node-id property"); + goto end; + } + if (!numa_info[object->u.cpu.node_id].present) { + error_setg(&err, "Invalid node-id=3D%" PRId64 ", NUMA node mus= t be " + "defined with -numa node,nodeid=3DID before it's used with= " + "-numa cpu,node-id=3DID", object->u.cpu.node_id); + goto end; + } + machine_set_cpu_numa_node(ms, &object->u.cpu, &err); + break; default: abort(); } diff --git a/qapi-schema.json b/qapi-schema.json index a6b5955..a9a1d5e 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -5673,10 +5673,12 @@ ## # @NumaOptionsType: # +# @cpu: property based CPU(s) to node mapping (Since: 2.10) +# # Since: 2.1 ## { 'enum': 'NumaOptionsType', - 'data': [ 'node' ] } + 'data': [ 'node', 'cpu' ] } =20 ## # @NumaOptions: @@ -5689,7 +5691,8 @@ 'base': { 'type': 'NumaOptionsType' }, 'discriminator': 'type', 'data': { - 'node': 'NumaNodeOptions' }} + 'node': 'NumaNodeOptions', + 'cpu': 'CpuInstanceProperties' }} =20 ## # @NumaNodeOptions: diff --git a/qemu-options.hx b/qemu-options.hx index 99af8ed..2185c34 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -139,13 +139,16 @@ ETEXI =20 DEF("numa", HAS_ARG, QEMU_OPTION_numa, "-numa node[,mem=3Dsize][,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\n" - "-numa node[,memdev=3Did][,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\= n", QEMU_ARCH_ALL) + "-numa node[,memdev=3Did][,cpus=3Dfirstcpu[-lastcpu]][,nodeid=3Dnode]\= n" + "-numa cpu,node-id=3Dnode[,socket-id=3Dx][,core-id=3Dy][,thread-id=3Dz= ]\n", QEMU_ARCH_ALL) STEXI @item -numa node[,mem=3D@var{size}][,cpus=3D@var{firstcpu}[-@var{lastcpu}]= ][,nodeid=3D@var{node}] @itemx -numa node[,memdev=3D@var{id}][,cpus=3D@var{firstcpu}[-@var{lastcpu= }]][,nodeid=3D@var{node}] +@itemx -numa cpu,node-id=3D@var{node}[,socket-id=3D@var{x}][,core-id=3D@va= r{y}][,thread-id=3D@var{z}] @findex -numa Define a NUMA node and assign RAM and VCPUs to it. =20 +Legacy VCPU assignment uses @samp{cpus} option where @var{firstcpu} and @var{lastcpu} are CPU indexes. Each @samp{cpus} option represent a contiguous range of CPU indexes (or a single VCPU if @var{lastcpu} is omitted). A non-contiguous @@ -159,6 +162,24 @@ a NUMA node: -numa node,cpus=3D0-2,cpus=3D5 @end example =20 +@samp{cpu} option is new alternative to @samp{cpus} option +uses @samp{socket-id|core-id|thread-id} properties to assign +CPU objects to a @var{node} using topology layout properties of CPU. +Set of properties is machine specific, and depends on used machine +type/@samp{smp} options. It could be queried with @samp{hotpluggable-cpus} +monitor command. +@samp{node-id} property specifies @var{node} to which CPU object +will be assigned, it's required for @var{node} to be declared +with @samp{node} option before it's used with @samp{cpu} option. + +For example: +@example +-M pc \ +-smp 1,sockets=3D2,maxcpus=3D2 \ +-numa node,nodeid=3D0 -numa node,nodeid=3D1 \ +-numa cpu,node-id=3D0,socket-id=3D0 -numa cpu,node-id=3D1,socket-id=3D1 +@end example + @samp{mem} assigns a given RAM amount to a node. @samp{memdev} assigns RAM from a given memory backend device to a node. If @samp{mem} and @samp{memdev} are omitted in all nodes, RAM is --=20 2.7.4 From nobody Sun May 5 09:35:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490190290764748.5571549953355; Wed, 22 Mar 2017 06:44:50 -0700 (PDT) Received: from localhost ([::1]:51195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgZF-0000Iv-8v for importer@patchew.org; Wed, 22 Mar 2017 09:44:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqgPu-0000VJ-9X for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqgPq-0002K5-GG for qemu-devel@nongnu.org; Wed, 22 Mar 2017 09:35:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqgPm-0002HC-G4; Wed, 22 Mar 2017 09:35:02 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2498AC054C5E; Wed, 22 Mar 2017 13:35:02 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69DDBA5660; Wed, 22 Mar 2017 13:34:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2498AC054C5E Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2498AC054C5E From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 22 Mar 2017 14:32:48 +0100 Message-Id: <1490189568-167621-24-git-send-email-imammedo@redhat.com> In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com> References: <1490189568-167621-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 22 Mar 2017 13:35:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 23/23] tests: check -numa node, cpu=props_list usecase X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- tests/numa-test.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 151 insertions(+) diff --git a/tests/numa-test.c b/tests/numa-test.c index 8326321..d371923 100644 --- a/tests/numa-test.c +++ b/tests/numa-test.c @@ -130,6 +130,144 @@ static void test_query_cpus(const void *data) g_free(cli); } =20 +static void pc_numa_cpu(const void *data) +{ + char *cli; + QDict *resp; + QList *cpus; + const QObject *e; + + cli =3D make_cli(data, "-cpu pentium -smp 8,sockets=3D2,cores=3D2,thre= ads=3D2 " + "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " + "-numa cpu,node-id=3D1,socket-id=3D0 " + "-numa cpu,node-id=3D0,socket-id=3D1,core-id=3D0 " + "-numa cpu,node-id=3D0,socket-id=3D1,core-id=3D1,thread-id=3D0 " + "-numa cpu,node-id=3D1,socket-id=3D1,core-id=3D1,thread-id=3D1"); + qtest_start(cli); + cpus =3D get_cpus(&resp); + g_assert(cpus); + + while ((e =3D qlist_pop(cpus))) { + QDict *cpu, *props; + int64_t socket, core, thread, node; + + cpu =3D qobject_to_qdict(e); + g_assert(qdict_haskey(cpu, "props")); + props =3D qdict_get_qdict(cpu, "props"); + + g_assert(qdict_haskey(props, "node-id")); + node =3D qdict_get_int(props, "node-id"); + g_assert(qdict_haskey(props, "socket-id")); + socket =3D qdict_get_int(props, "socket-id"); + g_assert(qdict_haskey(props, "core-id")); + core =3D qdict_get_int(props, "core-id"); + g_assert(qdict_haskey(props, "thread-id")); + thread =3D qdict_get_int(props, "thread-id"); + + if (socket =3D=3D 0) { + g_assert_cmpint(node, =3D=3D, 1); + } else if (socket =3D=3D 1 && core =3D=3D 0) { + g_assert_cmpint(node, =3D=3D, 0); + } else if (socket =3D=3D 1 && core =3D=3D 1 && thread =3D=3D 0) { + g_assert_cmpint(node, =3D=3D, 0); + } else if (socket =3D=3D 1 && core =3D=3D 1 && thread =3D=3D 1) { + g_assert_cmpint(node, =3D=3D, 1); + } else { + g_assert(false); + } + } + + QDECREF(resp); + qtest_end(); + g_free(cli); +} + +static void spapr_numa_cpu(const void *data) +{ + char *cli; + QDict *resp; + QList *cpus; + const QObject *e; + + cli =3D make_cli(data, "-smp 4,cores=3D4 " + "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " + "-numa cpu,node-id=3D0,core-id=3D0 " + "-numa cpu,node-id=3D0,core-id=3D1 " + "-numa cpu,node-id=3D0,core-id=3D2 " + "-numa cpu,node-id=3D1,core-id=3D3"); + qtest_start(cli); + cpus =3D get_cpus(&resp); + g_assert(cpus); + + while ((e =3D qlist_pop(cpus))) { + QDict *cpu, *props; + int64_t core, node; + + cpu =3D qobject_to_qdict(e); + g_assert(qdict_haskey(cpu, "props")); + props =3D qdict_get_qdict(cpu, "props"); + + g_assert(qdict_haskey(props, "node-id")); + node =3D qdict_get_int(props, "node-id"); + g_assert(qdict_haskey(props, "core-id")); + core =3D qdict_get_int(props, "core-id"); + + if (core >=3D 0 && core < 3) { + g_assert_cmpint(node, =3D=3D, 0); + } else if (core =3D=3D 3) { + g_assert_cmpint(node, =3D=3D, 1); + } else { + g_assert(false); + } + } + + QDECREF(resp); + qtest_end(); + g_free(cli); +} + +static void aarch64_numa_cpu(const void *data) +{ + char *cli; + QDict *resp; + QList *cpus; + const QObject *e; + + cli =3D make_cli(data, "-smp 2 " + "-numa node,nodeid=3D0 -numa node,nodeid=3D1 " + "-numa cpu,node-id=3D1,thread-id=3D0 " + "-numa cpu,node-id=3D0,thread-id=3D1"); + qtest_start(cli); + cpus =3D get_cpus(&resp); + g_assert(cpus); + + while ((e =3D qlist_pop(cpus))) { + QDict *cpu, *props; + int64_t thread, node; + + cpu =3D qobject_to_qdict(e); + g_assert(qdict_haskey(cpu, "props")); + props =3D qdict_get_qdict(cpu, "props"); + + g_assert(qdict_haskey(props, "node-id")); + node =3D qdict_get_int(props, "node-id"); + g_assert(qdict_haskey(props, "thread-id")); + thread =3D qdict_get_int(props, "thread-id"); + + if (thread =3D=3D 0) { + g_assert_cmpint(node, =3D=3D, 1); + } else if (thread =3D=3D 1) { + g_assert_cmpint(node, =3D=3D, 0); + } else { + g_assert(false); + } + } + + QDECREF(resp); + qtest_end(); + g_free(cli); +} + int main(int argc, char **argv) { const char *args =3D NULL; @@ -146,5 +284,18 @@ int main(int argc, char **argv) qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial); qtest_add_data_func("/numa/qmp/cpus/query-cpus", args, test_query_cpus= ); =20 + if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64")) { + qtest_add_data_func("/numa/pc/cpu/explicit", args, pc_numa_cpu); + } + + if (!strcmp(arch, "ppc64")) { + qtest_add_data_func("/numa/spapr/cpu/explicit", args, spapr_numa_c= pu); + } + + if (!strcmp(arch, "aarch64")) { + qtest_add_data_func("/numa/aarch64/cpu/explicit", args, + aarch64_numa_cpu); + } + return g_test_run(); } --=20 2.7.4