From nobody Thu May 2 18:35:02 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 1511372159109892.4600409674716; Wed, 22 Nov 2017 09:35:59 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F175356F0; Wed, 22 Nov 2017 17:35:57 +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 64E385D960; Wed, 22 Nov 2017 17:35:57 +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 EBED64BB79; Wed, 22 Nov 2017 17:35:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMHZsta009589 for ; Wed, 22 Nov 2017 12:35:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id A8A095C88F; Wed, 22 Nov 2017 17:35:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FD7E5C552 for ; Wed, 22 Nov 2017 17:35:54 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 18:35:45 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 22 Nov 2017 17:35:58 +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 (@cellid) caller passed falls within boundaries. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/conf/numa_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 7bba4120b..c2f0d1ca8 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1153,8 +1153,8 @@ virDomainNumaGetNodeDistance(virDomainNumaPtr numa, * defined default for local and remote nodes. */ if (!distances || - !distances[cellid].value || - !numa->mem_nodes[node].ndistances) + cellid >=3D numa->nmem_nodes || + !distances[cellid].value) 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 18:35:02 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 1511372159537875.5425657901604; Wed, 22 Nov 2017 09:35:59 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A9B94A706; Wed, 22 Nov 2017 17:35:58 +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 40D5E60FB8; Wed, 22 Nov 2017 17:35:58 +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 E5F951800BDC; Wed, 22 Nov 2017 17:35:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMHZtU4009599 for ; Wed, 22 Nov 2017 12:35:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7C2415C552; Wed, 22 Nov 2017 17:35:55 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02F355C88F for ; Wed, 22 Nov 2017 17:35:54 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 18:35:46 +0100 Message-Id: <2ce5dc765874e1d2bc940e7b0acf3bddd580f15e.1511372096.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/5] numa: Introduce virDomainNumaNodeDistanceIsUsingDefaults 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Nov 2017 17:35:58 +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 Reviewed-by: John Ferlan --- src/conf/numa_conf.c | 21 +++++++++++++++++++++ src/conf/numa_conf.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 26 insertions(+) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index c2f0d1ca8..8fc3b0a19 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1137,6 +1137,27 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, siz= e_t nmem_nodes) return numa->nmem_nodes; } =20 + +bool +virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa, + size_t node, + size_t sibling) +{ + if (node >=3D numa->nmem_nodes || + sibling >=3D numa->nmem_nodes) + return false; + + if (!numa->mem_nodes[node].distances) + return true; + + if (numa->mem_nodes[node].distances[sibling].value =3D=3D LOCAL_DISTAN= CE || + numa->mem_nodes[node].distances[sibling].value =3D=3D REMOTE_DISTA= NCE) + return true; + + return false; +} + + size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, size_t node, diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index 4655de3aa..7947fdb21 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 virDomainNumaNodeDistanceIsUsingDefaults(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 d3ca6b2ec..2fcf0e731 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -726,6 +726,7 @@ virDomainNumaGetNodeDistance; virDomainNumaGetNodeMemoryAccessMode; virDomainNumaGetNodeMemorySize; virDomainNumaNew; +virDomainNumaNodeDistanceIsUsingDefaults; 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 18:35:02 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 1511372172625362.3868666059411; Wed, 22 Nov 2017 09:36:12 -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 9ADAA8553E; Wed, 22 Nov 2017 17:36:11 +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 6CA6E60015; Wed, 22 Nov 2017 17:36:11 +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 2D9973FCFC; Wed, 22 Nov 2017 17:36:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMHZuL3009604 for ; Wed, 22 Nov 2017 12:35:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F5875C88F; Wed, 22 Nov 2017 17:35:56 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA1FA5C552 for ; Wed, 22 Nov 2017 17:35:55 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 18:35:47 +0100 Message-Id: <633ae88d8b2d36a628ef215ff7f464234896a9ce.1511372096.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 22 Nov 2017 17:36:12 +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 9c1eeacad..1c133d761 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -449,6 +449,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, =20 /* 275 */ "sclplmconsole", + "numa.dist", ); =20 =20 @@ -4792,6 +4793,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); } =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 241764824..cb7cdd7f5 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -435,6 +435,7 @@ typedef enum { =20 /* 275 */ QEMU_CAPS_DEVICE_SCLPLMCONSOLE, /* -device sclplmconsole */ + 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 b7b80799c..9e71bd525 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -179,6 +179,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 dee468252..6d9024455 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -142,6 +142,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 18:35:02 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 1511372175582712.4239238586359; Wed, 22 Nov 2017 09:36:15 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 612ECFC7C3; Wed, 22 Nov 2017 17:36:14 +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 329105D976; Wed, 22 Nov 2017 17:36:14 +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 E99CB3FADE; Wed, 22 Nov 2017 17:36:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMHZvJH009614 for ; Wed, 22 Nov 2017 12:35:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23FBA5C552; Wed, 22 Nov 2017 17:35:57 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D4D15C88F for ; Wed, 22 Nov 2017 17:35:56 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 18:35:48 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Nov 2017 17:36:14 +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 Reviewed-by: John Ferlan --- docs/formatdomain.html.in | 2 +- src/qemu/qemu_command.c | 39 ++++++++++++- .../qemuxml2argv-numatune-distances.args | 63 ++++++++++++++++++= +++ .../qemuxml2argv-numatune-distances.xml | 65 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 2 + 5 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-distances.= xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4bc88cfc5..505676354 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1589,7 +1589,7 @@ =20

Describing distances between NUMA cells is currently only supported - by Xen. If no distances are given to describe + by Xen and QEMU. If no distances are given to describe the SLIT data between different cells, it will default to a scheme using 10 for local and 20 for remote distances.

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 216a4bdfe..f505d8cba 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7718,7 +7718,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; @@ -7728,6 +7728,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) || @@ -7836,6 +7837,42 @@ 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 (virDomainNumaNodeDistanceIsUsingDefaults(def->numa, i, j)) + continue; + + numa_distances =3D true; + break; + } + if (numa_distances) + break; + } + + if (numa_distances) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA_DIST)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting NUMA distances is not " + "supported with this qemu")); + goto cleanup; + } + + 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 781c649bf..66af2d328 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 18:35:02 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 1511372172820499.68572903564007; Wed, 22 Nov 2017 09:36:12 -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 8FD6F5F7B5; Wed, 22 Nov 2017 17:36:11 +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 6ECD518989; Wed, 22 Nov 2017 17:36:11 +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 2F57D1800FC5; Wed, 22 Nov 2017 17:36:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAMHZvno009620 for ; Wed, 22 Nov 2017 12:35:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id EBEFE60011; Wed, 22 Nov 2017 17:35:57 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 716275C552 for ; Wed, 22 Nov 2017 17:35:57 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 22 Nov 2017 18:35:49 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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.39]); Wed, 22 Nov 2017 17:36:12 +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 5eb0b79d6..81b7b68f9 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