From nobody Thu May 2 04:45:45 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 1500545490083531.3603692107355; Thu, 20 Jul 2017 03:11:30 -0700 (PDT) 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 94D7D67AD4; Thu, 20 Jul 2017 10:11:26 +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 199318271D; Thu, 20 Jul 2017 10:11:26 +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 A5C3F4A491; Thu, 20 Jul 2017 10:11:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6KA5Pnx013980 for ; Thu, 20 Jul 2017 06:05:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2236181B73; Thu, 20 Jul 2017 10:05:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2EBA181B68; Thu, 20 Jul 2017 10:05:23 +0000 (UTC) Received: from userp1050.oracle.com (userp1050.oracle.com [156.151.31.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 86EDDC0567A2; Thu, 20 Jul 2017 10:05:19 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) by userp1050.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6K9TseU026522 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Jul 2017 09:29:54 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6K9TmSX008454 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Jul 2017 09:29:48 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v6K9Tm2j002065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Jul 2017 09:29:48 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v6K9TlY2021417; Thu, 20 Jul 2017 09:29:48 GMT Received: from nina.dynamic.ziggo.nl (/10.175.251.145) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 20 Jul 2017 02:29:47 -0700 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 94D7D67AD4 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 94D7D67AD4 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 86EDDC0567A2 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=wim.ten.have@oracle.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 86EDDC0567A2 From: Wim Ten Have To: Libvirt Development List Date: Thu, 20 Jul 2017 11:29:26 +0200 Message-Id: <20170720092926.15951-2-wim.ten.have@oracle.com> In-Reply-To: <20170720092926.15951-1-wim.ten.have@oracle.com> References: <20170720092926.15951-1-wim.ten.have@oracle.com> X-Source-IP: userp1040.oracle.com [156.151.31.81] X-Greylist: Delayed for 00:35:30 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 20 Jul 2017 10:05:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 20 Jul 2017 10:05:22 +0000 (UTC) for IP:'156.151.31.82' DOMAIN:'userp1050.oracle.com' HELO:'userp1050.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -102.301 (RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.82 userp1050.oracle.com 156.151.31.82 userp1050.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [PATCH v1] numa: compute and set matching vcpus for numa domains 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.27]); Thu, 20 Jul 2017 10:11:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Wim ten Have The QEMU driver can erroneously allocate more vpus to a domain than there are cpus in the domain if the element is used to describe element topology. Fix this by calculating the number of cpus described in the element of a element and comparing it to the number of vcpus. If the number of vcpus is greater than the number of cpus, cap the number of vcpus to the number of cpus. This patch also adds a small libvirt documentation update under the "CPU Allocation" section. Signed-off-by: Wim ten Have --- docs/formatdomain.html.in | 9 ++++++++- src/conf/domain_conf.c | 14 +++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 07208ee..3c85307 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -501,7 +501,14 @@
vcpu
The content of this element defines the maximum number of virtual CPUs allocated for the guest OS, which must be between 1 and - the maximum supported by the hypervisor. + the maximum supported by the hypervisor. If a numa + element is contained within the cpu element, the + number of virtual CPUs to be allocated is compared with the sum + of the cpus attributes across the cell + elements within the numa element. If the number of + virtual CPUs is greater than the sum of the cpus + attributes, the number of virtual CPUs is capped at sum of the + cpus attributes.
cpuset
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 958a5b7..73d7f4f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3844,12 +3844,20 @@ virDomainDefPostParseMemory(virDomainDefPtr def, unsigned long long numaMemory =3D 0; unsigned long long hotplugMemory =3D 0; =20 - /* Attempt to infer the initial memory size from the sum NUMA memory s= izes - * in case ABI updates are allowed or the element wasn't spec= ified */ + /* Attempt to infer the initial memory size from the sum NUMA memory + * sizes in case ABI updates are allowed or the element + * wasn't specified. Also cap the vcpu count to the sum of NUMA cpus + * allocated for all nodes. */ if (def->mem.total_memory =3D=3D 0 || parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE || - parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION) + parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION) { + unsigned int numaVcpus =3D 0; + + if ((numaVcpus =3D virDomainNumaGetCPUCountTotal(def->numa))) + virDomainDefSetVcpus(def, numaVcpus); + numaMemory =3D virDomainNumaGetMemorySize(def->numa); + } =20 /* calculate the sizes of hotplug memory */ for (i =3D 0; i < def->nmems; i++) --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list