From nobody Thu May 2 20:10:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510670873721527.340692658765; Tue, 14 Nov 2017 06:47:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B3376A7E8; Tue, 14 Nov 2017 14:47:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 42A1789D2A; Tue, 14 Nov 2017 14:47:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C751A4A467; Tue, 14 Nov 2017 14:47:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAEElkeC012474 for ; Tue, 14 Nov 2017 09:47:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id A7C048B564; Tue, 14 Nov 2017 14:47:46 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D5668B555 for ; Tue, 14 Nov 2017 14:47:46 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 14 Nov 2017 15:47:36 +0100 Message-Id: <1a17a73e4060f5fbf4b88c455a30491d801691d5.1510670819.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] virDomainNumaGetNodeDistance: Fix input arguments validation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 14 Nov 2017 14:47:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" There's no point in checking if numa->mem_nodes[node].ndistances is set if we check for numa->mem_nodes[node].distances. However, it makes sense to check if the sibling node caller passed falls within boundaries. Signed-off-by: Michal Privoznik --- src/conf/numa_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 7bba4120b..5f0b3f9ed 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1154,7 +1154,7 @@ virDomainNumaGetNodeDistance(virDomainNumaPtr numa, */ if (!distances || !distances[cellid].value || - !numa->mem_nodes[node].ndistances) + node >=3D numa->nmem_nodes) return (node =3D=3D cellid) ? LOCAL_DISTANCE : REMOTE_DISTANCE; =20 return distances[cellid].value; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:10:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510670886301902.8049410765352; Tue, 14 Nov 2017 06:48:06 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ACE902C9708; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86E01953A9; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3B8091800BDE; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAEEllqb012483 for ; Tue, 14 Nov 2017 09:47:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7A5325C317; Tue, 14 Nov 2017 14:47:47 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 016ED8B561 for ; Tue, 14 Nov 2017 14:47:46 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 14 Nov 2017 15:47:37 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] numa: Introduce virDomainNumaNodeDistanceSpecified X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 14 Nov 2017 14:48:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function returns true/false depending on distance configuration being present in the domain XML. Signed-off-by: Michal Privoznik --- src/conf/numa_conf.c | 13 +++++++++++++ src/conf/numa_conf.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 18 insertions(+) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 5f0b3f9ed..6a42777e2 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1137,6 +1137,19 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, siz= e_t nmem_nodes) return numa->nmem_nodes; } =20 +bool +virDomainNumaNodeDistanceSpecified(virDomainNumaPtr numa, + size_t node, + size_t sibling) +{ + return node < numa->nmem_nodes && + sibling < numa->nmem_nodes && + numa->mem_nodes[node].distances && + numa->mem_nodes[node].distances[sibling].value !=3D LOCAL_DISTANCE= && + numa->mem_nodes[node].distances[sibling].value !=3D REMOTE_DISTANC= E; +} + + size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, size_t node, diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index 4655de3aa..1d2e605b6 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -87,6 +87,10 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr nu= matune, =20 size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa); =20 +bool virDomainNumaNodeDistanceSpecified(virDomainNumaPtr numa, + size_t node, + size_t sibling) + ATTRIBUTE_NONNULL(1); size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, size_t node, size_t sibling) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5a4d50471..779bab7a3 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -725,6 +725,7 @@ virDomainNumaGetNodeDistance; virDomainNumaGetNodeMemoryAccessMode; virDomainNumaGetNodeMemorySize; virDomainNumaNew; +virDomainNumaNodeDistanceSpecified; virDomainNumaSetNodeCount; virDomainNumaSetNodeCpumask; virDomainNumaSetNodeDistance; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:10:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510670886935848.2300935925529; Tue, 14 Nov 2017 06:48:06 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C59EBFC7D7; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F7BA94B5F; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 593611800FC4; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAEElmhD012490 for ; Tue, 14 Nov 2017 09:47:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4ED145C482; Tue, 14 Nov 2017 14:47:48 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9BBE5C317 for ; Tue, 14 Nov 2017 14:47:47 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 14 Nov 2017 15:47:38 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] qemu_capabilities: Introcude QEMU_CAPS_NUMA_DIST X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 14 Nov 2017 14:48:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This capability says if qemu is capable of specifying distances between NUMA nodes on the command line. Unfortunately, there's no real way to check this and thus we have to go with version check. QEMU introduced this in 0f203430dd8 (and friend) which was released in 2.10.0. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 5 +++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + 7 files changed, 11 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7cb091056..fea526432 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -443,6 +443,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 270 */ "vxhs", "virtio-blk.num-queues", + "numa.dist", ); =20 =20 @@ -4776,6 +4777,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (qemuCaps->version >=3D 2006000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT); =20 + /* no way to query for -numa dist */ + if (qemuCaps->version >=3D 2010000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST); + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cacc2b77e..e3aaf0fcc 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -429,6 +429,7 @@ typedef enum { /* 270 */ QEMU_CAPS_VXHS, /* -drive file.driver=3Dvxhs via query-qmp-schema */ QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */ + QEMU_CAPS_NUMA_DIST, /* -numa dist */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml index 9f9dceb68..06b90875d 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml @@ -180,6 +180,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml index 3c2d2eed6..389390fe4 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml @@ -180,6 +180,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.ppc64.xml index 0dfa20726..d40767801 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -177,6 +177,7 @@ + 2010000 0 (v2.10.0) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.s390x.xml index 7e44652fe..ed59925d8 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -141,6 +141,7 @@ + 2010000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.10.0.x86_64.xml index ddbd8c32f..50251edc0 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -224,6 +224,7 @@ + 2010000 0 (v2.10.0) --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:10:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510670872414424.8384441494171; Tue, 14 Nov 2017 06:47:52 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B85CC267E3; Tue, 14 Nov 2017 14:47:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E01094B51; Tue, 14 Nov 2017 14:47:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D5E4D4A468; Tue, 14 Nov 2017 14:47:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAEElnkW012503 for ; Tue, 14 Nov 2017 09:47:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 21EDA8B554; Tue, 14 Nov 2017 14:47:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D4E75C317 for ; Tue, 14 Nov 2017 14:47:48 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 14 Nov 2017 15:47:39 +0100 Message-Id: <4ac327ed3d1f6f70b7b10162159cd1e34c32f072.1510670819.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] qemu: Support setting NUMA distances X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 14 Nov 2017 14:47:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since we already have such support for libxl all we need is qemu driver adjustment. And a test case. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 36 +++++++++++- .../qemuxml2argv-numatune-distances.args | 63 ++++++++++++++++++= +++ .../qemuxml2argv-numatune-distances.xml | 65 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 2 + 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.= xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index eb72db33b..8b9daaea3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7675,7 +7675,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, virCommandPtr cmd, qemuDomainObjPrivatePtr priv) { - size_t i; + size_t i, j; virQEMUCapsPtr qemuCaps =3D priv->qemuCaps; virBuffer buf =3D VIR_BUFFER_INITIALIZER; char *cpumask =3D NULL, *tmpmask =3D NULL, *next =3D NULL; @@ -7685,6 +7685,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, int ret =3D -1; size_t ncells =3D virDomainNumaGetNodeCount(def->numa); const long system_page_size =3D virGetSystemPageSizeKB(); + bool numa_distances =3D false; =20 if (virDomainNumatuneHasPerNodeBinding(def->numa) && !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) || @@ -7793,6 +7794,39 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, =20 virCommandAddArgBuffer(cmd, &buf); } + + /* If NUMA node distance is specified for at least one pair + * of nodes, we have to specify all the distances. Even + * though they might be the default ones. */ + for (i =3D 0; i < ncells; i++) { + for (j =3D 0; j < ncells; j++) { + if (!virDomainNumaNodeDistanceSpecified(def->numa, i, j)) + continue; + + numa_distances =3D true; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA_DIST)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting NUMA distances is not " + "supported with this qemu")); + goto cleanup; + } + } + } + + if (numa_distances) { + for (i =3D 0; i < ncells; i++) { + for (j =3D 0; j < ncells; j++) { + size_t distance =3D virDomainNumaGetNodeDistance(def->numa= , i, j); + + virCommandAddArg(cmd, "-numa"); + virBufferAsprintf(&buf, "dist,src=3D%zu,dst=3D%zu,val=3D%z= u", i, j, distance); + + virCommandAddArgBuffer(cmd, &buf); + } + } + } + ret =3D 0; =20 cleanup: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.args b/= tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.args new file mode 100644 index 000000000..23b66246c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.args @@ -0,0 +1,63 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest \ +-S \ +-M xenfv \ +-m 12288 \ +-smp 12,sockets=3D12,cores=3D1,threads=3D1 \ +-numa node,nodeid=3D0,cpus=3D0,cpus=3D11,mem=3D2048 \ +-numa node,nodeid=3D1,cpus=3D1,cpus=3D10,mem=3D2048 \ +-numa node,nodeid=3D2,cpus=3D2,cpus=3D9,mem=3D2048 \ +-numa node,nodeid=3D3,cpus=3D3,cpus=3D8,mem=3D2048 \ +-numa node,nodeid=3D4,cpus=3D4,cpus=3D7,mem=3D2048 \ +-numa node,nodeid=3D5,cpus=3D5-6,mem=3D2048 \ +-numa dist,src=3D0,dst=3D0,val=3D10 \ +-numa dist,src=3D0,dst=3D1,val=3D21 \ +-numa dist,src=3D0,dst=3D2,val=3D31 \ +-numa dist,src=3D0,dst=3D3,val=3D41 \ +-numa dist,src=3D0,dst=3D4,val=3D51 \ +-numa dist,src=3D0,dst=3D5,val=3D61 \ +-numa dist,src=3D1,dst=3D0,val=3D21 \ +-numa dist,src=3D1,dst=3D1,val=3D10 \ +-numa dist,src=3D1,dst=3D2,val=3D21 \ +-numa dist,src=3D1,dst=3D3,val=3D31 \ +-numa dist,src=3D1,dst=3D4,val=3D41 \ +-numa dist,src=3D1,dst=3D5,val=3D51 \ +-numa dist,src=3D2,dst=3D0,val=3D31 \ +-numa dist,src=3D2,dst=3D1,val=3D21 \ +-numa dist,src=3D2,dst=3D2,val=3D10 \ +-numa dist,src=3D2,dst=3D3,val=3D21 \ +-numa dist,src=3D2,dst=3D4,val=3D31 \ +-numa dist,src=3D2,dst=3D5,val=3D41 \ +-numa dist,src=3D3,dst=3D0,val=3D41 \ +-numa dist,src=3D3,dst=3D1,val=3D31 \ +-numa dist,src=3D3,dst=3D2,val=3D21 \ +-numa dist,src=3D3,dst=3D3,val=3D10 \ +-numa dist,src=3D3,dst=3D4,val=3D21 \ +-numa dist,src=3D3,dst=3D5,val=3D31 \ +-numa dist,src=3D4,dst=3D0,val=3D51 \ +-numa dist,src=3D4,dst=3D1,val=3D41 \ +-numa dist,src=3D4,dst=3D2,val=3D31 \ +-numa dist,src=3D4,dst=3D3,val=3D21 \ +-numa dist,src=3D4,dst=3D4,val=3D10 \ +-numa dist,src=3D4,dst=3D5,val=3D21 \ +-numa dist,src=3D5,dst=3D0,val=3D61 \ +-numa dist,src=3D5,dst=3D1,val=3D51 \ +-numa dist,src=3D5,dst=3D2,val=3D41 \ +-numa dist,src=3D5,dst=3D3,val=3D31 \ +-numa dist,src=3D5,dst=3D4,val=3D21 \ +-numa dist,src=3D5,dst=3D5,val=3D10 \ +-uuid c7a5fdb2-cdaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest/monit= or.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-numatune-distances.xml new file mode 100644 index 000000000..0f33526b4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.xml @@ -0,0 +1,65 @@ + + QEMUGuest + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 8388608 + 8388608 + 12 + + hvm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2e07b85aa..160374793 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1700,6 +1700,8 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_FAILURE("numatune-memnode-no-memory", NONE); =20 + DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST); + DO_TEST("numatune-auto-nodeset-invalid", NONE); DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:10:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510670886082489.03547643457887; Tue, 14 Nov 2017 06:48:06 -0800 (PST) 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 9CB72C01BB39; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71B8C8B575; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 269D91800BDF; Tue, 14 Nov 2017 14:48:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAEElnTR012510 for ; Tue, 14 Nov 2017 09:47:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id EA2C35C317; Tue, 14 Nov 2017 14:47:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70B0F8B555 for ; Tue, 14 Nov 2017 14:47:49 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 14 Nov 2017 15:47:40 +0100 Message-Id: <8631a923f3ec4febbac0a1d1d69a6e2abf0a5412.1510670819.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] news: Document which drivers support NUMA distances X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@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]); Tue, 14 Nov 2017 14:48:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- docs/news.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/news.xml b/docs/news.xml index 3966710ee..502679917 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -43,7 +43,7 @@ A NUMA hardware architecture supports the notion of distances between NUMA cells. This can now be specified using the <distances> element within the NUMA cell - configuration. + configuration. Drivers which support this include Xen and QEMU. --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list