From nobody Tue Nov 26 13:35:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1571737067; cv=none; d=zoho.com; s=zohoarc; b=Ko/eo5VuB691yOqcyjARAuzIvaeHNgvCiD/dbhAJedfOCd+eyUpNieAPVI/QMAz15eft/APV1TX/hwoETNFnlPCfEhVcPuT8/yKNzBZeOIKu3PBBGjzxdsRioeJ4ylm0IAN5TX4vyTQnMKOrChATTqq57E5SksqyMBStOHn64lU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571737067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1iRhX+HgyUoWkgYW3eUJZkghiyy5MYEA9Jcj8kWdhNY=; b=HoCPsv2dDwqSmUj6deot7gd95868f54l2xpV9d+bSjqsYYZ2LeBG4rNM8wyjKiZVbQOF3X1FXqX33ZYQ+oeLcjq7e1vQln/9qwECAsHaEYXjtgIiKGZFyQUTGrNWPRzC7ST5Z6k6dtzvcWD/rF0cLWmPxBE+FT08T08ZXLRz3gc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571737067563834.4907533728649; Tue, 22 Oct 2019 02:37:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-yenm5TVEO5K6rf3dmwqeIQ-1; Tue, 22 Oct 2019 05:37:44 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD112801E5C; Tue, 22 Oct 2019 09:37:39 +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 9229A5D6B0; Tue, 22 Oct 2019 09:37:39 +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 55E131819906; Tue, 22 Oct 2019 09:37:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9LJNcB2004330 for ; Mon, 21 Oct 2019 15:23:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id DD07E1001B35; Mon, 21 Oct 2019 19:23:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx27.extmail.prod.ext.phx2.redhat.com [10.5.110.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6DD71001B33 for ; Mon, 21 Oct 2019 19:23:36 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (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 784D089F2B6 for ; Mon, 21 Oct 2019 19:23:26 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJEOJk125268 for ; Mon, 21 Oct 2019 19:23:25 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2vqswta0vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:23:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJHXt1093186 for ; Mon, 21 Oct 2019 19:21:24 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2vrcnasv7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:24 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9LJLOgm022111 for ; Mon, 21 Oct 2019 19:21:24 GMT Received: from waters.dynamic.ziggo.nl (/10.175.22.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Oct 2019 12:21:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571737066; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1iRhX+HgyUoWkgYW3eUJZkghiyy5MYEA9Jcj8kWdhNY=; b=dWaBLgBbDpriLqnGeeEH/VfiqlfFlw/j/3nMpQS/zDARgf+lLwDv1X/Bi3DZOnBl2gazrL fhIKL3T1qkpMHuJHpFQqwJ6zSW5OVF/JBz6rqejJIz1z9VIsegXQYYBFCm8i3R7KCNsT/s i8DoEUC31Q2tit3h0TiH7QBOOSgN86o= From: Wim Ten Have To: Libvirt Development List Date: Mon, 21 Oct 2019 21:21:05 +0200 Message-Id: <20191021192108.25974-2-wim.ten.have@oracle.com> In-Reply-To: <20191021192108.25974-1-wim.ten.have@oracle.com> References: <20191021192108.25974-1-wim.ten.have@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=29 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=29 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Mon, 21 Oct 2019 19:23:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Mon, 21 Oct 2019 19:23:31 +0000 (UTC) for IP:'156.151.31.86' DOMAIN:'userp2130.oracle.com' HELO:'userp2130.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -102.4 (DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED, SPF_HELO_PASS, SPF_NONE, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.86 userp2130.oracle.com 156.151.31.86 userp2130.oracle.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.68 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [RFC PATCH v1 1/4] XML definitions for guest vNUMA and parsing routines 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: , 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-MC-Unique: yenm5TVEO5K6rf3dmwqeIQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Wim ten Have This patch adds XML definitions to a guest with a vNUMA layout and contains routines to parse the same. The guest vNUMA specification looks like: size With mode=3D'host' the guest XML is rendered to match the host's NUMA topology. With mode=3D'node' the guest XML is rendered according to the "nodes" and "cells" attributes of the element. Signed-off-by: Wim ten Have --- docs/formatdomain.html.in | 94 +++++++ docs/schemas/domaincommon.rng | 65 +++++ src/conf/domain_conf.c | 482 +++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 2 + src/conf/numa_conf.c | 241 ++++++++++++++++- src/conf/numa_conf.h | 58 +++- src/libvirt_private.syms | 8 + 7 files changed, 932 insertions(+), 18 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 962766b792d3..80165f9bd896 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1294,6 +1294,98 @@ =20 =20 +

NUMA Host or Node Partitioning=

+ +

+ With the help of the vnuma element, libvirt can + dynamically partition a guest domain for vNUMA by rendering its XML + into a 'host' or 'node' NUMA + topology matching model. +

+ +
+<domain>
+  ...
+  <vnuma mode=3D'host|node' distribution=3D'contiguous|siblings|round-r=
obin|interleave'>
+    <memory unit=3D'KiB'>524288</memory>
+    <partition nodeset=3D"1-4,^3" cells=3D"8"/>
+  </vnuma>
+  ...
+</domain>
+
+ +
+
vnuma
+
+ The attribute mode selects a specific rendering + method. Its value is either "host" or "node." If mode + is set to "host" the guest domain is automatically partitioned + to match the host NUMA topology. If mode + is "node," the guest domain is partitioned according to the + nodeset and cells under the + vnuma partition subelement. + Since 5.9 + + The optional attribute distribution selects the + guest numa + cell cpus distribution. It allows + Since 5.9 for: +
+
contiguous
+
The cpus are enumerate sequentially over the + numa defined + cells. +
+
siblings
+
The cpus are distributed over the + numa + cells matching the host CPU SMT model. +
+
round-robin
+
The cpus are distributed over the + numa + cells matching the host CPU topology. +
+
interleave
+
The cpus are interleaved one at a time over the + numa cells. +
+
+
+ +
memory
+
+ The optional subelement memory specifies the + memory size reserved for the guest assigned + numa cells. + Since 1.2.11, one can use an addition= al + unit + attribute to define units in which this memory + size is quantified. If no memory is specified, the + memory setting is + acquired to set this subelement documented + vnuma valu= e. + Since 5.9 +
+ +
partition
+
+ The optional attribute partition is only active when + vnuma + mode "node" is selected and allows for defining the + active "nodeset" and "cells" to target for under the "guest" domai= n. + For example; the specified nodeset can limit the + numatune assigned + host NUMA nodes in effect under the "guest". Alternatively, + the provided cells attribute can define the number + of numa cells + to render. + + Since 5.9 +
+
+ +

NUMA Node Tuning

=20
@@ -1755,6 +1847,8 @@
       
     
=20
+    

NUMA topology

+

Guest NUMA topology can be specified using the numa ele= ment. Since 0.9.8 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e06f892da393..227c856a362c 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -786,6 +786,10 @@ =20 + + + + @@ -1062,6 +1066,67 @@ =20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + host + node + + + + + + + + contiguous + siblings + round-robin + interleave + + + + + + + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 317e7846ceb0..32b29740bffd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1824,6 +1824,18 @@ virDomainDefSetVcpusMax(virDomainDefPtr def, if (def->maxvcpus =3D=3D maxvcpus) return 0; =20 + if (virDomainVnumaIsEnabled(def->numa)) { + size_t nnumaCell =3D virDomainNumaGetNodeCount(def->numa); + + if (maxvcpus % nnumaCell) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("vNUMA: the maximum vCPU count %d is not a " + "multiple of the configured vNUMA node count = %ld"), + maxvcpus, nnumaCell); + return -1; + } + } + if (def->maxvcpus < maxvcpus) { if (VIR_EXPAND_N(def->vcpus, def->maxvcpus, maxvcpus - def->maxvcp= us) < 0) return -1; @@ -2067,6 +2079,394 @@ virDomainDefGetVcpusTopology(const virDomainDef *de= f, } =20 =20 +void +virDomainDefSetVcpusVnuma(virDomainDefPtr def, + size_t nvcpus) +{ + int vcpuscnt =3D nvcpus; + size_t cell, i; + size_t vcpu_node; + size_t nnumaCell =3D virDomainNumaGetNodeCount(def->numa); + + if (!nnumaCell) + return; + + /* vcpu_node represents the maximum vcpus per vNUMA + * node that theoretically could be within a set. + */ + vcpu_node =3D (def->maxvcpus / nnumaCell) + ((def->maxvcpus % nnumaCel= l) ? 1 : 0); + + for (i =3D 0; i < vcpu_node; i++) { + for (cell =3D 0; cell < nnumaCell; cell++) { + virDomainVcpuDefPtr vcpu; + size_t cid =3D cell * vcpu_node + i; + + if (cid >=3D def->maxvcpus) + break; + + vcpu =3D def->vcpus[cid]; + + if (vcpuscnt-- > 0) + vcpu->online =3D true; + else + vcpu->online =3D false; + + /* vCPU0 cannot be hotplugged */ + if (cid) + vcpu->hotpluggable =3D true; + } + } + def->individualvcpus =3D true; + + return; +} + + +/** + * virDomainNumaAutoconfig: vNUMA automatic host partition processing + * @def: domain definition + * @caps: host capabilities + * + * vNUMA automatic host partitioning is requested by adding the element to the guest XML. See virDomainVnumaParseXML() for + * parsing the related XML and filling the virDomainAutoPartition structur= e. + * + * If the virDomainAutoPartition structure is valid, libvirt takes into + * account the host hardware configuration (including maxvcpus, online + * vcpus, and memory) and creates the guest such that vcpus and memory + * are spread evenly across the host. + * + * Returns 0 on success and -1 on error. + */ +static int +virDomainNumaAutoconfig(virDomainDefPtr def, + virCapsPtr caps) +{ + int ret =3D -1; + virBitmapPtr nodeset =3D NULL; + virDomainNumaPtr numa =3D def->numa; + virDomainAutoPartitionPtr avnuma; + + if (!numa) + goto error; + + if (caps && + (avnuma =3D virDomainVnumaParseXML(numa, NULL))) { + + size_t i, j, cell; + size_t nvcpus =3D 0; + size_t nnumaCell =3D 0; + size_t vcpu_node; + unsigned long long memsizeCell =3D 0; + virCapsHostPtr host =3D &caps->host; + unsigned int threads =3D host->cpu->threads; + + if (!def->cpu) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("vNUMA: unable to render partitioning= for " + "domain %s because of undefined t= opology."), + def->name); + goto error; + } + + if (!avnuma->nodeset) { + if (!(avnuma->nodeset =3D virBitmapNew(host->nnumaCell))) + goto cleanup; + + for (i =3D 0; i < host->nnumaCell; i++) + if (virBitmapSetBit(avnuma->nodeset, i) < 0) + goto cleanup; + } + + /* Set the vNUMA cell count */ + nnumaCell =3D avnuma->vcell ? avnuma->vcell : virBitmapCountBits(a= vnuma->nodeset); + + if (!nnumaCell) + goto cleanup; + + /* Compute the online vcpus */ + for (i =3D 0; i < def->maxvcpus; i++) + if (def->vcpus[i]->online) + nvcpus++; + + /* vcpu_node represents the maximum vcpus per numanode that + * theoretically could be within a set. + */ + vcpu_node =3D (def->maxvcpus / nnumaCell) + ((def->maxvcpus % nnum= aCell) ? 1 : 0); + + /* Do the host provided "CPU topology" threads fit */ + threads =3D (nnumaCell % threads) ? 1 : threads; + + /* Is it possible to render the guest for vNUMA auto partition? */ + if ((def->maxvcpus % nnumaCell) || + (def->maxvcpus < (nnumaCell * threads))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("vNUMA: %ld vcpus is insufficient to " + "arrange a vNUMA topology for %ld nodes."), + def->maxvcpus, nnumaCell); + goto error; + } + + /* Compute the memory size (memsizeCell) per arranged nnumaCell. + * If no memory for vNUMA auto partitioning was specified then + * compute its value from the total_memory configuration. + */ + if ((memsizeCell =3D avnuma->mem / nnumaCell) =3D=3D 0) { + unsigned long long hotplugMemory =3D 0; + + /* Calculate the size of hotplug memory */ + for (i =3D 0; i < def->nmems; i++) + hotplugMemory +=3D def->mems[i]->size; + + memsizeCell =3D (def->mem.total_memory - hotplugMemory) / nnum= aCell; + } + + /* Under vNUMA automatic host partitioning the 'memballoon' contro= lled + * cur_balloon value should reflect the guest's total_memory setti= ng. + */ + def->mem.cur_balloon =3D def->mem.total_memory; + + /* Correct vNUMA can only be accomplished if the number of maxvcpus + * is a multiple of the number of physical nodes. If this is not + * possible we set sockets, cores and threads to 0 so libvirt crea= tes + * a default topology where all vcpus appear as sockets and cores = and + * threads are set to 1. + */ + if (def->maxvcpus % (nnumaCell * threads)) { + VIR_WARN("Disabling guest %s auto vNUMA topology because confi= gured " + "%ld vCPUs do not match the host's %ld NUMA nodes to = produce " + "an evenly balanced CPU topology.", + def->name, def->maxvcpus, nnumaCell); + def->cpu->sockets =3D def->cpu->cores =3D def->cpu->threads = =3D 0; + } else { + /* Below computed topology aims to align the guest's sockets, + * cores and threads with the host's topology. + */ + def->cpu->cores =3D def->maxvcpus / (nnumaCell * threads); + def->cpu->threads =3D threads; + def->cpu->sockets =3D nnumaCell; + } + + /* Build the vNUMA topology. The previous configuration may + * have changed entirely, so free the current NUMA allocation + * and start over from scratch. + */ + virDomainNumaFree(numa); + if (!(numa =3D virDomainNumaNew())) + goto error; + + /* We're clean and good to rebuild the entire guest domain + * respecting the requested vNUMA topoplogy provided by + * avnuma stored objects. + */ + avnuma->mem =3D memsizeCell * nnumaCell; + + if (!virDomainNumaSetNodeCount(numa, nnumaCell)) + goto error; + + if (!(nodeset =3D virBitmapNewCopy(avnuma->nodeset))) + goto error; + + for (cell =3D 0; cell < nnumaCell; cell++) { + size_t ndistances; + size_t vcell =3D cell % host->nnumaCell; + size_t vcpu_strt, vcpu_last, vcpu_left; + ssize_t node =3D 0; + unsigned int cores =3D def->cpu->cores; + virBitmapPtr cpumask =3D NULL; + virBitmapPtr vnumask =3D NULL; + virCapsHostNUMACell *numaCell =3D NULL; + + /* per NUMA cell memory size */ + virDomainNumaSetNodeMemorySize(numa, cell, memsizeCell); + + /* per NUMA cell bind memory (mode=3D'strict') */ + if ((node =3D virBitmapNextSetBit(nodeset, (vcell-1))) < 0) + node =3D vcell - 1; + + if (node >=3D host->nnumaCell) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("vNUMA: domain %s defined nodeset node %l= d " + "is out of range. Valid range is 0-%ld"), + def->name, node, (host->nnumaCell-1)); + goto error; + } + + if (virDomainNumatuneSetmemset(numa, cell, node, + VIR_DOMAIN_NUMATUNE_MEM_STRICT)= < 0) + goto error; + + /* per NUMA cell vcpu range to mask */ + if (!(cpumask =3D virBitmapNew(def->maxvcpus))) + goto error; + + switch (avnuma->distribution) { + case VIR_DOMAIN_VNUMA_DISTRIBUTION_CONTIGUOUS: + /* vcpus are equally balanced from 0 to highest vcpu id + * available, keeping ranges contiguous where the maximum = vcpu + * sets run from lowest vNUMA cells to highest available. + */ + vcpu_strt =3D cell * vcpu_node; + vcpu_last =3D MIN(vcpu_strt + vcpu_node, def->maxvcpus); + + for (i =3D vcpu_strt; i < vcpu_last; i++) { + if (virBitmapSetBitExpand(cpumask, i) < 0) { + virBitmapFree(cpumask); + goto error; + } + } + break; + + case VIR_DOMAIN_VNUMA_DISTRIBUTION_SIBLINGS: + /* Create vNUMA node vcpu ranges that represent a clean + * processor sockets/core/threads model, placing one + * socket per NUMA node. + */ + vcpu_strt =3D cell * cores; + vcpu_last =3D def->maxvcpus; + vcpu_left =3D def->maxvcpus / threads; + + for (i =3D vcpu_strt; i < vcpu_last; i +=3D vcpu_left) { + for (j =3D 0; j < cores; j++) { + unsigned int id =3D i + j; + + if (id < def->maxvcpus && + virBitmapSetBitExpand(cpumask, id) < 0) { + virBitmapFree(cpumask); + goto error; + } + } + } + break; + + case VIR_DOMAIN_VNUMA_DISTRIBUTION_ROUNDROBIN: + /* Create vNUMA node vcpu ranges that round-robin + * interleave one core per node over the available nodes. + */ + vcpu_strt =3D cell * threads; + vcpu_last =3D def->maxvcpus; + vcpu_left =3D threads * nnumaCell; + + for (i =3D vcpu_strt; i < vcpu_last; i +=3D vcpu_left) { + for (j =3D 0; j < threads; j++) { + unsigned int id =3D i + j; + + if (id < def->maxvcpus && + virBitmapSetBitExpand(cpumask, id) < 0) { + virBitmapFree(cpumask); + goto error; + } + } + } + break; + + case VIR_DOMAIN_VNUMA_DISTRIBUTION_INTERLEAVE: + /* Distribute vCPUs over the NUMA nodes in a round-robin, + * interleaved fashion, with one vCPU (thread) per node. + */ + def->cpu->sockets =3D def->cpu->cores =3D def->cpu->thread= s =3D 0; + for (i =3D cell; i < def->maxvcpus; i +=3D nnumaCell) { + if (virBitmapSetBitExpand(cpumask, i) < 0) { + virBitmapFree(cpumask); + goto error; + } + } + break; + + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vNUMA: domain %s non-existent vCPU distr= ibution requested.")); + goto error; + break; + } + + if (virDomainNumaSetNodeCpumask(numa, cell, cpumask) =3D=3D NU= LL) + goto error; + + /* per NUMA cpus sibling vNUMA pinning */ + numaCell =3D host->numaCell[node]; + if (!(vnumask =3D virBitmapNew(nnumaCell * numaCell->ncpus))) + goto error; + + for (i =3D 0; i < numaCell->ncpus; i++) { + unsigned int id =3D numaCell->cpus[i].id; + + if (virBitmapSetBitExpand(vnumask, id) < 0) { + virBitmapFree(vnumask); + goto error; + } + } + + for (i =3D 0; i < def->maxvcpus; i++) { + if (virBitmapIsBitSet(cpumask, i)) { + if (!(def->vcpus[i]->cpumask =3D virBitmapNewCopy(vnum= ask))) + goto error; + } + } + virBitmapFree(vnumask); + + /* per NUMA cell sibling distances */ + numaCell =3D host->numaCell[node]; + switch (avnuma->mode) { + case VIR_DOMAIN_VNUMA_MODE_HOST: + ndistances =3D numaCell->nsiblings; + break; + + case VIR_DOMAIN_VNUMA_MODE_NODE: + ndistances =3D 1; + if (avnuma->vcell) + vcell =3D cell; + else + if (virBitmapClearBit(nodeset, node) < 0) + goto error; + + break; + + default: + goto error; + } + + /* Set vNUMA distances */ + if (ndistances > 1) { + if (virDomainNumaSetNodeDistanceCount(numa, + vcell, + ndistances) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("vNUMA: domain %s failed to render a " + "matching vNUMA node distances set, d= efined " + "vNUMA nodes %ld build on %ld host no= des."), + def->name, nnumaCell, ndistances); + goto error; + } + + for (i =3D 0; i < ndistances; i++) { + unsigned int distance =3D numaCell->siblings[i].distan= ce; + + if (virDomainNumaSetNodeDistance(numa, cell, i, distan= ce) !=3D distance) + goto error; + } + } + } + + /* We're done - enable the vNUMA marker */ + virDomainVnumaSetEnabled(numa, avnuma); + + /* Adjust the new created vNUMA description */ + def->numa =3D numa; + + /* per NUMA cpus sibling vNUMA hotplugging directives */ + virDomainDefSetVcpusVnuma(def, virDomainDefGetVcpus(def)); + } + cleanup: + + ret =3D 0; + + error: + virBitmapFree(nodeset); + return ret; +} + + virDomainDiskDefPtr virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt) { @@ -10510,6 +10910,38 @@ virDomainDefSetMemoryTotal(virDomainDefPtr def, } =20 =20 +/** + * virDomainDefSetNUMAMemoryTotal: + * @def: domain definition + * @size: size to set + * @caps: host capabilities + * + * A frontend to set the total memory size in @def. If the guest's + * configured "total_memory" setting and the requested "size" differ, + * call virDomainNumaAutoconfig() to evenly distribute the additional + * memory across all vNUMA nodes. + */ +int +virDomainDefSetNUMAMemoryTotal(virDomainDefPtr def, + unsigned long long size, + virCapsPtr caps) +{ + bool DoNumaAutoConfig =3D (def->mem.total_memory !=3D size); + + if (DoNumaAutoConfig) { + if (virDomainVnumaSetMemory(def->numa, size) < 0) + return -1; + + if (virDomainNumaAutoconfig(def, caps)) + return -1; + + if (virDomainDefPostParseMemory(def, VIR_DOMAIN_DEF_PARSE_ABI_UPDA= TE) < 0) + return -1; + } + return 0; +} + + /** * virDomainDefGetMemoryTotal: * @def: domain definition @@ -18809,7 +19241,8 @@ virDomainIOThreadSchedParse(xmlNodePtr node, static int virDomainVcpuParse(virDomainDefPtr def, xmlXPathContextPtr ctxt, - virDomainXMLOptionPtr xmlopt) + virDomainXMLOptionPtr xmlopt, + bool IsAvNUMA) { int n; xmlNodePtr vcpuNode; @@ -18876,6 +19309,15 @@ virDomainVcpuParse(virDomainDefPtr def, if (virDomainDefSetVcpusMax(def, maxvcpus, xmlopt) < 0) return -1; =20 + /* If vNUMA applies def->numa is reinitialized later */ + if (IsAvNUMA) { + + if (virDomainDefSetVcpus(def, vcpus) < 0) + return -1; + + return 0; + } + if ((n =3D virXPathNodeSet("./vcpus/vcpu", ctxt, &nodes)) < 0) return -1; =20 @@ -19746,6 +20188,7 @@ virDomainDefParseXML(xmlDocPtr xml, char *netprefix =3D NULL; g_autofree xmlNodePtr *nodes =3D NULL; g_autofree char *tmp =3D NULL; + bool IsAvNUMA; =20 if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) { g_autofree char *schema =3D NULL; @@ -19871,6 +20314,8 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(tmp); =20 + IsAvNUMA =3D virDomainVnumaParseXML(def->numa, ctxt) ? true : false; + tmp =3D virXPathString("string(./memoryBacking/source/@type)", ctxt); if (tmp) { if ((def->mem.source =3D virDomainMemorySourceTypeFromString(tmp))= <=3D 0) { @@ -19986,7 +20431,7 @@ virDomainDefParseXML(xmlDocPtr xml, &def->mem.swap_hard_limit) < 0) goto error; =20 - if (virDomainVcpuParse(def, ctxt, xmlopt) < 0) + if (virDomainVcpuParse(def, ctxt, xmlopt, IsAvNUMA) < 0) goto error; =20 if (virDomainDefParseIOThreads(def, ctxt) < 0) @@ -20059,14 +20504,16 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } =20 - if ((n =3D virXPathNodeSet("./cputune/vcpupin", ctxt, &nodes)) < 0) - goto error; - - for (i =3D 0; i < n; i++) { - if (virDomainVcpuPinDefParseXML(def, nodes[i])) + if (!IsAvNUMA) { + if ((n =3D virXPathNodeSet("./cputune/vcpupin", ctxt, &nodes)) < 0) goto error; + + for (i =3D 0; i < n; i++) { + if (virDomainVcpuPinDefParseXML(def, nodes[i])) + goto error; + } + VIR_FREE(nodes); } - VIR_FREE(nodes); =20 if ((n =3D virXPathNodeSet("./cputune/emulatorpin", ctxt, &nodes)) < 0= ) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -20173,6 +20620,10 @@ virDomainDefParseXML(xmlDocPtr xml, if (virDomainNumaDefCPUParseXML(def->numa, ctxt) < 0) goto error; =20 + /* Check and update the guest's XML vNUMA topology if needed */ + if (virDomainNumaAutoconfig(def, caps)) + goto error; + if (virDomainNumaGetCPUCountTotal(def->numa) > virDomainDefGetVcpusMax= (def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Number of CPUs in exceeds the" @@ -20186,10 +20637,11 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } =20 - if (virDomainNumatuneParseXML(def->numa, - def->placement_mode =3D=3D - VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC, - ctxt) < 0) + if (!virDomainVnumaIsEnabled(def->numa) && + (virDomainNumatuneParseXML(def->numa, + def->placement_mode =3D=3D + VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC, + ctxt) < 0)) goto error; =20 if (virDomainNumatuneHasPlacementAuto(def->numa) && @@ -28496,6 +28948,9 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, if (virDomainMemtuneFormat(buf, &def->mem) < 0) goto error; =20 + if (virDomainVnumaFormatXML(buf, def->numa) < 0) + goto error; + if (virDomainCpuDefFormat(buf, def) < 0) goto error; =20 @@ -29148,6 +29603,9 @@ virDomainSaveConfig(const char *configDir, { g_autofree char *xml =3D NULL; =20 + if (virDomainNumaAutoconfig(def, caps) < 0) + return -1; + if (!(xml =3D virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECU= RE))) return -1; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5a17acedf299..0db77d9247a1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2535,6 +2535,7 @@ struct _virDomainDef { =20 unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def); void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long si= ze); +int virDomainDefSetNUMAMemoryTotal(virDomainDefPtr def, unsigned long long= size, virCapsPtr caps); unsigned long long virDomainDefGetMemoryTotal(const virDomainDef *def); bool virDomainDefHasMemoryHotplug(const virDomainDef *def); =20 @@ -2816,6 +2817,7 @@ int virDomainDefSetVcpusMax(virDomainDefPtr def, bool virDomainDefHasVcpusOffline(const virDomainDef *def); unsigned int virDomainDefGetVcpusMax(const virDomainDef *def); int virDomainDefSetVcpus(virDomainDefPtr def, unsigned int vcpus); +void virDomainDefSetVcpusVnuma(virDomainDefPtr def, size_t vcpus); unsigned int virDomainDefGetVcpus(const virDomainDef *def); virBitmapPtr virDomainDefGetOnlineVcpumap(const virDomainDef *def); virDomainVcpuDefPtr virDomainDefGetVcpu(virDomainDefPtr def, unsigned int = vcpu) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 6720d5620d1d..8e6ef4008b8d 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -45,6 +45,20 @@ VIR_ENUM_IMPL(virDomainNumatuneMemMode, "interleave", ); =20 +VIR_ENUM_IMPL(virDomainVnumaMode, + VIR_DOMAIN_VNUMA_MODE_LAST, + "host", + "node", +); + +VIR_ENUM_IMPL(virDomainVnumaDistribution, + VIR_DOMAIN_VNUMA_DISTRIBUTION_LAST, + "contiguous", + "siblings", + "round-robin", + "interleave", +); + VIR_ENUM_IMPL(virDomainNumatunePlacement, VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST, "default", @@ -90,6 +104,7 @@ struct _virDomainNuma { size_t nmem_nodes; =20 /* Future NUMA tuning related stuff should go here. */ + virDomainAutoPartitionPtr avnuma; }; =20 =20 @@ -353,6 +368,156 @@ virDomainNumatuneFormatXML(virBufferPtr buf, return 0; } =20 +int +virDomainVnumaFormatXML(virBufferPtr buf, + virDomainNumaPtr numa) +{ + char *nodeset =3D NULL; + if (numa && virDomainVnumaIsEnabled(numa)) { + + virBufferAddLit(buf, "avnuma->mod= e)); + virBufferAsprintf(buf, " distribution=3D'%s'", + virDomainVnumaDistributionTypeToString(numa->avn= uma->distribution)); + virBufferAddLit(buf, ">\n"); + + virBufferAdjustIndent(buf, 2); + virBufferAsprintf(buf, "%llu\n", + numa->avnuma->mem); + + + if (numa->avnuma->mode =3D=3D VIR_DOMAIN_VNUMA_MODE_NODE) { + if ((nodeset =3D virBitmapFormat(numa->avnuma->nodeset))) { + virBufferAsprintf(buf, "avnuma->vcell) + virBufferAsprintf(buf, " cells=3D'%u'", numa->avnuma->= vcell); + virBufferAddLit(buf, "/>\n"); + } + virBufferAdjustIndent(buf, -2); + + virBufferAddLit(buf, "\n"); + } + + return 0; +} + +virDomainAutoPartitionPtr +virDomainVnumaParseXML(virDomainNumaPtr numa, + xmlXPathContextPtr ctxt) +{ + int ret =3D -1; + char *tmp =3D NULL; + xmlNodePtr node, oldnode; + virDomainAutoPartitionPtr avnuma =3D NULL; + + if (!numa) + return NULL; + + if (!ctxt) + return avnuma =3D numa->avnuma; + + oldnode =3D ctxt->node; + node =3D virXPathNode("./vnuma[1]", ctxt); + if (node) { + int mode =3D -1; + int distribution =3D VIR_DOMAIN_VNUMA_DISTRIBUTION_CONTIGUOUS; + unsigned int maxvcell =3D 0; + unsigned long long mem =3D 0L; + virBitmapPtr nodeset =3D NULL; + + if (!virXMLNodeNameEqual(node, "vnuma")) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("domain definition does not contain expected = 'vnuma' element")); + goto cleanup; + } + + if (VIR_ALLOC(avnuma) < 0) + goto cleanup; + + /* There has to be a valid vnuma mode setting */ + if (!(tmp =3D virXMLPropString(node, "mode"))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No vNUMA 'mode' specified for automatic host= partitioning")); + goto cleanup; + } + + if ((mode =3D virDomainVnumaModeTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported automatic vNUMA partitioning mod= e '%s'"), tmp); + goto cleanup; + } + VIR_FREE(tmp); + + /* If specified get the vcpu 'distribution' type */ + if ((tmp =3D virXMLPropString(node, "distribution")) && + (distribution =3D virDomainVnumaDistributionTypeFromString(tmp= )) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported automatic vNUMA partitioning dis= tribution '%s'"), tmp); + goto cleanup; + } + VIR_FREE(tmp); + + /* Obtain the designated node =3D node; + switch (mode) { + case VIR_DOMAIN_VNUMA_MODE_NODE: + if ((node =3D virXPathNode("./partition[1]", ctxt))) { + + /* Get the host nodeset=3D'#nodeset' for <= numatune> */ + if ((tmp =3D virXMLPropString(node, "nodeset"))) { + if (virBitmapParse(tmp, &nodeset, VIR_DOMAIN_CPUMA= SK_LEN) < 0) + goto cleanup; + VIR_FREE(tmp); + } + + /* Get the fictitious cells=3D'#count' att= ribute */ + if ((tmp =3D virXMLPropString(node, "cells"))) { + if (virStrToLong_ui(tmp, NULL, 10, &maxvcell) < 0)= { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("maximum vcpus count must be an inte= ger")); + goto cleanup; + } + VIR_FREE(tmp); + } + } + break; + + case VIR_DOMAIN_VNUMA_MODE_HOST: + default: + break; + } + + /* Get the size to render the nodes with */ + if (virDomainParseMemory("./memory[1]", NULL, ctxt, + &mem, false, true) < 0) + goto cleanup; + + /* We're set and good to go */ + avnuma->mode =3D mode; + avnuma->distribution =3D distribution; + avnuma->nodeset =3D nodeset; + avnuma->mem =3D mem; + avnuma->vcell =3D maxvcell; + + numa->avnuma =3D avnuma; + } + ret =3D 0; + + cleanup: + if (ret) { + VIR_FREE(tmp); + VIR_FREE(avnuma); + avnuma =3D NULL; + } + ctxt->node =3D oldnode; + + return avnuma; +} + void virDomainNumaFree(virDomainNumaPtr numa) { @@ -572,6 +737,76 @@ virDomainNumatuneSet(virDomainNumaPtr numa, return ret; } =20 +int +virDomainNumatuneSetmemset(virDomainNumaPtr numa, + size_t cell, + size_t node, + int mode) +{ + int ret =3D -1; + virDomainNumaNodePtr mem_node =3D &numa->mem_nodes[cell]; + + /* Get out if this is under control of numad! */ + if (numa->memory.specified) + goto cleanup; + + /* Get out if numa does not apply */ + if (cell > numa->nmem_nodes) + goto cleanup; + + /* Get out if mode is out of range */ + if (mode < 0 || mode >=3D VIR_DOMAIN_NUMATUNE_MEM_LAST) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported numatune mode '%d'"), + mode); + goto cleanup; + } + + /* Force the numatune/memset setting */ + if (!(mem_node->nodeset =3D virBitmapNew(numa->nmem_nodes)) || + virBitmapSetBitExpand(mem_node->nodeset, node) < 0) { + virBitmapFree(mem_node->nodeset); + goto cleanup; + } + mem_node->mode =3D mode; + + ret =3D 0; + + cleanup: + return ret; +} + +bool +virDomainVnumaIsEnabled(virDomainNumaPtr numa) +{ + if (numa && numa->avnuma) + return numa->avnuma->specified; + + return false; +} + +void +virDomainVnumaSetEnabled(virDomainNumaPtr numa, + virDomainAutoPartitionPtr avnuma) +{ + if (numa && avnuma) { + numa->avnuma =3D avnuma; + numa->avnuma->specified =3D true; + } +} + +int +virDomainVnumaSetMemory(virDomainNumaPtr numa, + unsigned long long size) +{ + if (!numa) + return -1; + + numa->avnuma->mem =3D size; + + return 0; +} + static bool virDomainNumaNodesEqual(virDomainNumaPtr n1, virDomainNumaPtr n2) @@ -1273,7 +1508,7 @@ virDomainNumaSetNodeDistance(virDomainNumaPtr numa, } =20 =20 -size_t +int virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa, size_t node, size_t ndistances) @@ -1285,11 +1520,11 @@ virDomainNumaSetNodeDistanceCount(virDomainNumaPtr = numa, virReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot alter an existing nmem_nodes distances se= t for node: %zu"), node); - return 0; + return -1; } =20 if (VIR_ALLOC_N(distances, ndistances) < 0) - return 0; + return -1; =20 numa->mem_nodes[node].distances =3D distances; numa->mem_nodes[node].ndistances =3D ndistances; diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index e76a09c20cdc..bdc1deb6e143 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -32,6 +32,9 @@ typedef struct _virDomainNuma virDomainNuma; typedef virDomainNuma *virDomainNumaPtr; =20 +typedef struct _virDomainAutoPartition virDomainAutoPartition; +typedef virDomainAutoPartition *virDomainAutoPartitionPtr; + typedef enum { VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT =3D 0, VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC, @@ -43,6 +46,24 @@ typedef enum { VIR_ENUM_DECL(virDomainNumatunePlacement); VIR_ENUM_DECL(virDomainNumatuneMemMode); =20 +typedef enum { + VIR_DOMAIN_VNUMA_MODE_HOST =3D 0, + VIR_DOMAIN_VNUMA_MODE_NODE, + + VIR_DOMAIN_VNUMA_MODE_LAST +} virDomainVnumaMode; +VIR_ENUM_DECL(virDomainVnumaMode); + +typedef enum { + VIR_DOMAIN_VNUMA_DISTRIBUTION_CONTIGUOUS =3D 0, + VIR_DOMAIN_VNUMA_DISTRIBUTION_SIBLINGS, + VIR_DOMAIN_VNUMA_DISTRIBUTION_ROUNDROBIN, + VIR_DOMAIN_VNUMA_DISTRIBUTION_INTERLEAVE, + + VIR_DOMAIN_VNUMA_DISTRIBUTION_LAST +} virDomainVnumaDistribution; +VIR_ENUM_DECL(virDomainVnumaDistribution); + typedef enum { VIR_DOMAIN_MEMORY_ACCESS_DEFAULT =3D 0, /* No memory access defined = */ VIR_DOMAIN_MEMORY_ACCESS_SHARED, /* Memory access is set as shared = */ @@ -52,6 +73,14 @@ typedef enum { } virDomainMemoryAccess; VIR_ENUM_DECL(virDomainMemoryAccess); =20 +struct _virDomainAutoPartition { + bool specified; /* Auto vNUMA active */ + int mode; /* Auto vNUMA mode */ + int distribution; /* Auto vNUMA distribution */ + unsigned long long mem; /* Auto vNUMA total memory */ + unsigned int vcell; /* Auto vNUMA node Cell */ + virBitmapPtr nodeset; /* Auto vNUMA host nodes where this guest node= resides */ +}; =20 virDomainNumaPtr virDomainNumaNew(void); void virDomainNumaFree(virDomainNumaPtr numa); @@ -67,9 +96,19 @@ int virDomainNumatuneParseXML(virDomainNumaPtr numa, int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune) ATTRIBUTE_NONNULL(1); =20 +virDomainAutoPartitionPtr virDomainVnumaParseXML(virDomainNumaPtr numa, + xmlXPathContextPtr ctxt) + ATTRIBUTE_NONNULL(1); + +int virDomainVnumaFormatXML(virBufferPtr buf, virDomainNumaPtr numa) + ATTRIBUTE_NONNULL(1); + /* * Getters */ +bool virDomainVnumaIsEnabled(virDomainNumaPtr numa) + ATTRIBUTE_NONNULL(1); + int virDomainNumatuneGetMode(virDomainNumaPtr numatune, int cellid, virDomainNumatuneMemMode *mode); @@ -134,6 +173,19 @@ int virDomainNumatuneSet(virDomainNumaPtr numa, virBitmapPtr nodeset) ATTRIBUTE_NONNULL(1); =20 +void virDomainVnumaSetEnabled(virDomainNumaPtr numa, + virDomainAutoPartitionPtr avnuma) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +int virDomainVnumaSetMemory(virDomainNumaPtr numa, + unsigned long long size) + ATTRIBUTE_NONNULL(1); + +int virDomainNumatuneSetmemset(virDomainNumaPtr numa, + size_t cell, + size_t node, + int mode) + ATTRIBUTE_NONNULL(1); + size_t virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t nmem_nodes) ATTRIBUTE_NONNULL(1); @@ -149,9 +201,9 @@ int virDomainNumaSetNodeDistance(virDomainNumaPtr numa, unsigned int value) ATTRIBUTE_NONNULL(1); =20 -size_t virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa, - size_t node, - size_t ndistances) +int virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa, + size_t node, + size_t ndistances) ATTRIBUTE_NONNULL(1); =20 virBitmapPtr virDomainNumaSetNodeCpumask(virDomainNumaPtr numa, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 17977229d18f..7f7c3fdeafaa 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -311,8 +311,10 @@ virDomainDefParseNode; virDomainDefParseString; virDomainDefPostParse; virDomainDefSetMemoryTotal; +virDomainDefSetNUMAMemoryTotal; virDomainDefSetVcpus; virDomainDefSetVcpusMax; +virDomainDefSetVcpusVnuma; virDomainDefValidate; virDomainDefVcpuOrderClear; virDomainDeleteConfig; @@ -828,7 +830,13 @@ virDomainNumatuneParseXML; virDomainNumatunePlacementTypeFromString; virDomainNumatunePlacementTypeToString; virDomainNumatuneSet; +virDomainNumatuneSetmemset; virDomainNumatuneSpecifiedMaxNode; +virDomainVnumaFormatXML; +virDomainVnumaIsEnabled; +virDomainVnumaParseXML; +virDomainVnumaSetEnabled; +virDomainVnumaSetMemory; =20 =20 # conf/nwfilter_conf.h --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 13:35:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1571737239; cv=none; d=zoho.com; s=zohoarc; b=kO9oAmY87b5nMUKPX5vlK5bPGw8lvnNQl9KoyGu8Ie21hy7eZzpJYZYUvtizHeRtYW6196lLlTaYDHaRktP4kMGciMazcv36jZDc5FTGXJi6LxFvuWY7k2zKtPQCITeqQHpi13FXEZHEBAU9D9aXP8WqnD2UdL2Yv8znj32mMTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571737239; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tO6hk3Q/lyAOuJD6WzsrbDhiziup8PrIF5yxZWAcw44=; b=Ctkbl/uqroWS8BP0obF3kH0oiX/jxN5qwWxmiPImWv1FlI/W1ypw4Frq506/doncP62xuBERTT8HnGIJiDoiy8Fqie+Tyt0f1jnWKUAz1wiWQDG551rhsyxFhbE12iaW6NtSFDnpHSG5rDl00tZfmKFgCtUXl2Vx1/DJCMXyMYs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571737239819796.7038373555786; Tue, 22 Oct 2019 02:40:39 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338-_W1p6BsANeqN7Hyy4pae6A-1; Tue, 22 Oct 2019 05:40:36 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E2C661800D79; Tue, 22 Oct 2019 09:40:31 +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 B79DC5DD61; Tue, 22 Oct 2019 09:40:31 +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 5AAD31803B4F; Tue, 22 Oct 2019 09:40:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9LJLbcM004236 for ; Mon, 21 Oct 2019 15:21:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92F0F100164D; Mon, 21 Oct 2019 19:21:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CFC01001DD7 for ; Mon, 21 Oct 2019 19:21:35 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (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 1ECCB3086268 for ; Mon, 21 Oct 2019 19:21:28 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJELGa125243 for ; Mon, 21 Oct 2019 19:21:27 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2vqswta0hs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:27 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJIU9v055270 for ; Mon, 21 Oct 2019 19:21:26 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2vrc0096m2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:26 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9LJLPSC001043 for ; Mon, 21 Oct 2019 19:21:25 GMT Received: from waters.dynamic.ziggo.nl (/10.175.22.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Oct 2019 12:21:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571737238; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tO6hk3Q/lyAOuJD6WzsrbDhiziup8PrIF5yxZWAcw44=; b=DQKyYuObYuE/gKj2L02AMKVyhBifjXi6aUtknRJIiD7Bfb9/J9EGfFlJWmX/iSUOY6U4gl 9UlGnSKe38gzo6fpb+HshaFPA4Y/kGYSjNWM4WtNX0Cs7C6FnC7T41ggSXf/v2ZakBIngu 5Od/C5bwHPGQmuquZfnATyiF2Qh4uIw= From: Wim Ten Have To: Libvirt Development List Date: Mon, 21 Oct 2019 21:21:06 +0200 Message-Id: <20191021192108.25974-3-wim.ten.have@oracle.com> In-Reply-To: <20191021192108.25974-1-wim.ten.have@oracle.com> References: <20191021192108.25974-1-wim.ten.have@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 21 Oct 2019 19:21:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 21 Oct 2019 19:21:33 +0000 (UTC) for IP:'156.151.31.86' DOMAIN:'userp2130.oracle.com' HELO:'userp2130.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -102.402 (DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED, SPF_HELO_PASS, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.86 userp2130.oracle.com 156.151.31.86 userp2130.oracle.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Menno Lageman , Wim ten Have Subject: [libvirt] [RFC PATCH v1 2/4] qemu: driver changes adding vNUMA vCPU hotplug support 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: , 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-MC-Unique: _W1p6BsANeqN7Hyy4pae6A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Wim ten Have Add support for hot plugging/unplugging vCPUs in vNUMA partitioned KVM guests. Signed-off-by: Wim ten Have Signed-off-by: Menno Lageman --- src/qemu/qemu_driver.c | 6 ++- src/qemu/qemu_hotplug.c | 95 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 94 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 71947efa4e50..e64afcb8efc9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4965,14 +4965,16 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver, return -1; } =20 - if (virDomainNumaGetCPUCountTotal(persistentDef->numa) > nvcpus) { + if (!virDomainVnumaIsEnabled(persistentDef->numa) && + virDomainNumaGetCPUCountTotal(persistentDef->numa) > nvcpus) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Number of CPUs in exceeds the desired " "maximum vcpu count")); return -1; } =20 - if (virDomainDefGetVcpusTopology(persistentDef, &topologycpus) =3D=3D = 0 && + if (!virDomainVnumaIsEnabled(persistentDef->numa) && + virDomainDefGetVcpusTopology(persistentDef, &topologycpus) =3D=3D = 0 && nvcpus !=3D topologycpus) { /* allow setting a valid vcpu count for the topology so an invalid * setting may be corrected via this API */ diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2d47f7461f93..2d48c5bba762 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6081,6 +6081,60 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver, } =20 =20 +/** + * qemuDomainGetNumaMappedVcpuEntry: + * + * In case of vNUMA guest description we need the node + * mapped vcpu to ensure that guest vcpus are hot-plugged + * or hot-unplugged in a round-robin fashion with whole + * cores on the same NUMA node so they get sibling host + * CPUs. + * + * 2 NUMA node system, 2 threads/core: + * +---+---+---+---+---+---+---+---+---+---+--// + * vcpu | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |... + * +---+---+---+---+---+---+---+---+---+---+--// + * NUMA \------/ \-----/ \-----/ \-----/ \-----/ \-// + * node 0 1 0 1 0 ... + * + * bit 0 1 0 1 2 3 2 3 4 5 ... + * + * 4 NUMA node system, 2 threads/core: + * +---+---+---+---+---+---+---+---+---+---+--// + * vcpu | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |... + * +---+---+---+---+---+---+---+---+---+---+--// + * NUMA \------/ \-----/ \-----/ \-----/ \-----/ \-// + * node 0 1 2 3 0 ... + * + * bit 0 1 0 1 0 1 0 1 2 3 ... + * + */ +static ssize_t +qemuDomainGetNumaMappedVcpuEntry(virDomainDefPtr def, + ssize_t vcpu) +{ + virBitmapPtr nodecpumask =3D NULL; + size_t ncells =3D virDomainNumaGetNodeCount(def->numa); + size_t threads =3D def->cpu->threads ? def->cpu->threads : 1; + ssize_t node, bit, pcpu =3D -1; + + if (!ncells) + return vcpu; + + node =3D (vcpu / threads) % ncells; + nodecpumask =3D virDomainNumaGetNodeCpumask(def->numa, node); + + bit =3D ((vcpu / (threads * ncells)) * threads) + (vcpu % threads); + + while (((pcpu =3D virBitmapNextSetBit(nodecpumask, pcpu)) >=3D 0) && b= it--); + + /* GIGO: Garbage In? Garbage Out! */ + pcpu =3D (pcpu < 0) ? vcpu : pcpu; + + return pcpu; +} + + /** * qemuDomainSelectHotplugVcpuEntities: * @@ -6104,7 +6158,27 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr = def, qemuDomainVcpuPrivatePtr vcpupriv; unsigned int maxvcpus =3D virDomainDefGetVcpusMax(def); unsigned int curvcpus =3D virDomainDefGetVcpus(def); - ssize_t i; + ssize_t i, target; + size_t threads =3D def->cpu->threads; + size_t nnumaCell =3D virDomainNumaGetNodeCount(def->numa); + size_t minvcpus =3D nnumaCell * threads; + bool HasAutonuma =3D virDomainVnumaIsEnabled(def->numa); + + /* If SMT topology is in place, check that the number of vcpus meets + * the following constraints: + * - at least one fully used core is assigned on each NUMA node + * - cores must be used fully, i.e. all threads of a core are assigned= to + * the same guest + */ + if (HasAutonuma && threads && + (nvcpus < minvcpus || (nvcpus - minvcpus) % threads)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("vNUMA: guest %s configured %d vcpus setting " + "does not fit the vNUMA topology for at " + "least one whole core per vNUMA node."), + def->name, nvcpus); + goto error; + } =20 if (!(ret =3D virBitmapNew(maxvcpus))) return NULL; @@ -6113,7 +6187,9 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr d= ef, *enable =3D true; =20 for (i =3D 0; i < maxvcpus && curvcpus < nvcpus; i++) { - vcpu =3D virDomainDefGetVcpu(def, i); + + target =3D qemuDomainGetNumaMappedVcpuEntry(def, i); + vcpu =3D virDomainDefGetVcpu(def, target); vcpupriv =3D QEMU_DOMAIN_VCPU_PRIVATE(vcpu); =20 if (vcpu->online) @@ -6130,14 +6206,17 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr= def, "desired vcpu count")); goto error; } + VIR_DEBUG("guest %s hotplug target vcpu =3D %zd\n", def->name,= target); =20 - ignore_value(virBitmapSetBit(ret, i)); + ignore_value(virBitmapSetBit(ret, target)); } } else { *enable =3D false; =20 for (i =3D maxvcpus - 1; i >=3D 0 && curvcpus > nvcpus; i--) { - vcpu =3D virDomainDefGetVcpu(def, i); + + target =3D qemuDomainGetNumaMappedVcpuEntry(def, i); + vcpu =3D virDomainDefGetVcpu(def, target); vcpupriv =3D QEMU_DOMAIN_VCPU_PRIVATE(vcpu); =20 if (!vcpu->online) @@ -6157,8 +6236,9 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr d= ef, "desired vcpu count")); goto error; } + VIR_DEBUG("guest %s hotunplug target vcpu =3D %zd\n", def->nam= e, target); =20 - ignore_value(virBitmapSetBit(ret, i)); + ignore_value(virBitmapSetBit(ret, target)); } } =20 @@ -6241,6 +6321,11 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def, if (curvcpus =3D=3D nvcpus) return; =20 + if (virDomainVnumaIsEnabled(def->numa)) { + virDomainDefSetVcpusVnuma(def, nvcpus); + return; + } + if (curvcpus < nvcpus) { for (i =3D 0; i < maxvcpus; i++) { vcpu =3D virDomainDefGetVcpu(def, i); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 13:35:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1571737251; cv=none; d=zoho.com; s=zohoarc; b=RFIAJ/JdhshqfEw2MwjWdPiaJoB6D8mCtHuQ4Adgx3zq98AYFmIWXrpYPRvKlId9+PTWFv7c2H8Fq5JGff39gFJijSVD/wIiiLA5OXecqKbymM+iKFtXyUpxFpUepTtrDgUyhNQ/XzmsWxUDGW82NwZiyzxXE4J3oHG9pzaINVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571737251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fjEAUN/wQJGcled5tkI6irGoXQgDo3bAPtn8LOdt4xE=; b=RZC6TMjVPix6D9KXmjAJE2uNLVbH5Jv7kEj+PlG+sgyfeW/VgzPMbxVuwV8vBjJ8ujPOXWSlVa6NqE7cxaXNa7wiekQXcel1OFu2og88rejuaXmlMWoTGhpGwlrlHXFC6auHo2CqYh6qO4iU0rnn9O1ZyOOkG30K3cazOOXvdk8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1571737251943142.03850004461333; Tue, 22 Oct 2019 02:40:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-u_gtbZUkNLWxKBhoS1dKvg-1; Tue, 22 Oct 2019 05:40:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91E815F3; Tue, 22 Oct 2019 09:40:44 +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 656175F7C0; Tue, 22 Oct 2019 09:40:44 +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 27FF6180BAAA; Tue, 22 Oct 2019 09:40:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9LJNbRf004322 for ; Mon, 21 Oct 2019 15:23:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0990A5D6B0; Mon, 21 Oct 2019 19:23:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04CB55D6A5 for ; Mon, 21 Oct 2019 19:23:37 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (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 27EFC3086246 for ; Mon, 21 Oct 2019 19:23:28 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJEK0e104969 for ; Mon, 21 Oct 2019 19:23:27 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2vqu4qhqha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:23:27 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJITtZ055213 for ; Mon, 21 Oct 2019 19:21:26 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2vrc0096mg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:26 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9LJLQhQ013102 for ; Mon, 21 Oct 2019 19:21:26 GMT Received: from waters.dynamic.ziggo.nl (/10.175.22.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Oct 2019 12:21:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571737251; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fjEAUN/wQJGcled5tkI6irGoXQgDo3bAPtn8LOdt4xE=; b=Cd4jTlAC4j/t1VuF6Y2F5QfbgtpEq10Su74SEcMHR7zYmuzz1R2g5pr8xU5C/HLdkTS4+U ix5Y/GsMvmhlZhnbM1gXIfM3XI4OXnL73RQziB/V/mz+UwVtNCgS1Az3luq1vgbcFJdRNI H6pQqr3KHIICB5GOl5uP9YRrpNTvM2E= From: Wim Ten Have To: Libvirt Development List Date: Mon, 21 Oct 2019 21:21:07 +0200 Message-Id: <20191021192108.25974-4-wim.ten.have@oracle.com> In-Reply-To: <20191021192108.25974-1-wim.ten.have@oracle.com> References: <20191021192108.25974-1-wim.ten.have@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 21 Oct 2019 19:23:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 21 Oct 2019 19:23:33 +0000 (UTC) for IP:'156.151.31.85' DOMAIN:'userp2120.oracle.com' HELO:'userp2120.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -102.4 (DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED, SPF_HELO_PASS, SPF_NONE, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.85 userp2120.oracle.com 156.151.31.85 userp2120.oracle.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [RFC PATCH v1 3/4] qemu: driver changes adding vNUMA memory hotplug support 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: u_gtbZUkNLWxKBhoS1dKvg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Wim ten Have Add support for hot plugging memory into vNUMA partitioned KVM guests. Hot plugging memory without a target node with result in evenly balancing the added memory along all vNUMA nodes. Signed-off-by: Wim ten Have --- src/qemu/qemu_driver.c | 59 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e64afcb8efc9..8d1f0bf13cb7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2348,9 +2348,12 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom= , unsigned long newmem, } =20 if (persistentDef) { - /* resizing memory with NUMA nodes specified doesn't work as t= here - * is no way to change the individual node sizes with this API= */ - if (virDomainNumaGetNodeCount(persistentDef->numa) > 0) { + /* Resizing memory with NUMA nodes specified doesn't work, as = there + * is no way to change the individual node sizes with this API= , but + * when vNUMA automatic partitioning is in effect resizing is = possible. + */ + if (!virDomainVnumaIsEnabled(persistentDef->numa) && + virDomainNumaGetNodeCount(persistentDef->numa) > 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("initial memory size of a domain with NUM= A " "nodes cannot be modified with this API")= ); @@ -2365,7 +2368,12 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom= , unsigned long newmem, goto endjob; } =20 - virDomainDefSetMemoryTotal(persistentDef, newmem); + if (virDomainDefSetNUMAMemoryTotal(persistentDef, newmem, driv= er->caps) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to distribute newly configured " + "memory across NUMA nodes")); + goto endjob; + } =20 if (persistentDef->mem.cur_balloon > newmem) persistentDef->mem.cur_balloon =3D newmem; @@ -2378,6 +2386,18 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom= , unsigned long newmem, /* resize the current memory */ unsigned long oldmax =3D 0; =20 + if ((def && + virDomainVnumaIsEnabled(def->numa) && + virDomainNumaGetNodeCount(def->numa)) || + (persistentDef && + virDomainVnumaIsEnabled(persistentDef->numa) && + virDomainNumaGetNodeCount(persistentDef->numa)) > 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("the current memory size of a domain with NUM= A " + "nodes cannot be modified with this API")); + goto endjob; + } + if (def) oldmax =3D virDomainDefGetMemoryTotal(def); if (persistentDef) { @@ -7820,6 +7840,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, { int ret =3D -1; const char *alias =3D NULL; + virDomainMemoryDefPtr mem; =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: @@ -7895,8 +7916,34 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, case VIR_DOMAIN_DEVICE_MEMORY: /* note that qemuDomainAttachMemory always consumes dev->data.memo= ry * and dispatches DeviceAdded event on success */ - ret =3D qemuDomainAttachMemory(driver, vm, - dev->data.memory); + + mem =3D dev->data.memory; + if (mem->targetNode >=3D 0) { + ret =3D qemuDomainAttachMemory(driver, vm, + dev->data.memory); + } else { + size_t i, ncells =3D virDomainNumaGetNodeCount(vm->def->numa); + unsigned long long memsizeCell =3D dev->data.memory->size / nc= ells; + + for (i =3D 0; i < ncells; i++) { + + if (VIR_ALLOC(mem) < 0) { + ret =3D -1; + break; + } + + memcpy(mem, dev->data.memory, sizeof(virDomainMemoryDef)); + + if (dev->data.memory->sourceNodes) + virBitmapCopy(mem->sourceNodes, dev->data.memory->sour= ceNodes); + + mem->size =3D memsizeCell; + mem->targetNode =3D i; + + ret =3D qemuDomainAttachMemory(driver, vm, mem); + } + virDomainMemoryDefFree(dev->data.memory); + } dev->data.memory =3D NULL; break; =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 13:35:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1571737243; cv=none; d=zoho.com; s=zohoarc; b=dZvbotwVBvLnUrs0c6F6SzE7F6x2OVeRfQ0agL8zrrn2jDzl3JDqxgcab5QsLtr1JNoDGDozkNVWYYf1nFRQMNBdfhYo4dbwkm/tMGjAGGPv3eL35xxNvEfEGIPB+M9dTjmXOwVpEjb1fN5sDaaze0cJMnBR7JyTZqLOn/P/Lz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571737243; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ptcdKigFT4LPWr9nEoHvASjOXIOOJRl9iOyX0C4cL+A=; b=EgiLJV5YL5O09xxCvTnkPk4s/aQ3MsnA/jWBGRJPCzxa2XwvE/bwDbQZupdVaQKyzWr/dX3gxWr0txgbLilT1+2SrqH8k6T/4jTQrYXlnS0iXBfeK7RII0aaXd+ms2NHuW3F3ZKWFdRxmsyg++rwEORbpYQGeex6/ronzawoeQg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1571737243903982.6404239450933; Tue, 22 Oct 2019 02:40:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-155-bQs4x_Q5MrGTTD3KG3w8ZA-1; Tue, 22 Oct 2019 05:40:40 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 13C8B107AD31; Tue, 22 Oct 2019 09:40:36 +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 E1BFD5DE5B; Tue, 22 Oct 2019 09:40:35 +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 A74D71803B57; Tue, 22 Oct 2019 09:40:35 +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 x9LJLiOA004251 for ; Mon, 21 Oct 2019 15:21:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42C1D60C4E; Mon, 21 Oct 2019 19:21:44 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C37D60BE2 for ; Mon, 21 Oct 2019 19:21:41 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (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 7FEF483F4C for ; Mon, 21 Oct 2019 19:21:30 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJEKsJ125240 for ; Mon, 21 Oct 2019 19:21:30 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2vqswta0hw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:29 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJHXNI093168 for ; Mon, 21 Oct 2019 19:21:28 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2vrcnasvam-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:28 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9LJLRkO001061 for ; Mon, 21 Oct 2019 19:21:27 GMT Received: from waters.dynamic.ziggo.nl (/10.175.22.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Oct 2019 12:21:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571737242; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ptcdKigFT4LPWr9nEoHvASjOXIOOJRl9iOyX0C4cL+A=; b=LmMQi79lT6uoCMojEWmiwbphXI48AbwaIwKvfUlmlpgF1IhkyN8e4OWJCjSbbByHgFyQkj 2rxKRQRQkogQIBkjECSHRx59jAxMvsZQMVRx0jRKTiTNKxN2vHxMPt/WXW+nYfTBfS93mA yFXVViALi/5xNxrwK5kCbUervTskrzU= From: Wim Ten Have To: Libvirt Development List Date: Mon, 21 Oct 2019 21:21:08 +0200 Message-Id: <20191021192108.25974-5-wim.ten.have@oracle.com> In-Reply-To: <20191021192108.25974-1-wim.ten.have@oracle.com> References: <20191021192108.25974-1-wim.ten.have@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 21 Oct 2019 19:21:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 21 Oct 2019 19:21:35 +0000 (UTC) for IP:'156.151.31.86' DOMAIN:'userp2130.oracle.com' HELO:'userp2130.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -102.4 (DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED, SPF_HELO_PASS, SPF_NONE, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.86 userp2130.oracle.com 156.151.31.86 userp2130.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [RFC PATCH v1 4/4] tests: add various tests to exercise vNUMA host partitioning 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: , 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-MC-Unique: bQs4x_Q5MrGTTD3KG3w8ZA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Wim ten Have Tests for the new element and its variations. Signed-off-by: Wim ten Have --- .../cpu-host-passthrough-nonuma.args | 29 ++++ .../cpu-host-passthrough-nonuma.xml | 19 +++ .../cpu-host-passthrough-numa-contiguous.args | 37 ++++++ .../cpu-host-passthrough-numa-contiguous.xml | 20 +++ .../cpu-host-passthrough-numa-interleave.args | 41 ++++++ .../cpu-host-passthrough-numa-interleave.xml | 19 +++ ...host-passthrough-numa-node-contiguous.args | 53 ++++++++ ...-host-passthrough-numa-node-contiguous.xml | 21 +++ ...host-passthrough-numa-node-interleave.args | 41 ++++++ ...-host-passthrough-numa-node-interleave.xml | 22 +++ ...ost-passthrough-numa-node-round-robin.args | 125 ++++++++++++++++++ ...host-passthrough-numa-node-round-robin.xml | 21 +++ ...u-host-passthrough-numa-node-siblings.args | 32 +++++ ...pu-host-passthrough-numa-node-siblings.xml | 23 ++++ ...cpu-host-passthrough-numa-round-robin.args | 37 ++++++ .../cpu-host-passthrough-numa-round-robin.xml | 22 +++ .../cpu-host-passthrough-numa-siblings.args | 37 ++++++ .../cpu-host-passthrough-numa-siblings.xml | 20 +++ .../cpu-host-passthrough-numa.args | 37 ++++++ .../cpu-host-passthrough-numa.xml | 20 +++ tests/qemuxml2argvtest.c | 10 ++ 21 files changed, 686 insertions(+) create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-nonuma.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-nonuma.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-contig= uous.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-contig= uous.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-interl= eave.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-interl= eave.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-c= ontiguous.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-c= ontiguous.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-i= nterleave.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-i= nterleave.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-r= ound-robin.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-r= ound-robin.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-s= iblings.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-s= iblings.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-= robin.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-= robin.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblin= gs.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblin= gs.xml create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa.args create mode 100644 tests/qemuxml2argvdata/cpu-host-passthrough-numa.xml diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-nonuma.args b/test= s/qemuxml2argvdata/cpu-host-passthrough-nonuma.args new file mode 100644 index 000000000000..197bda882a01 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-nonuma.args @@ -0,0 +1,29 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 214 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-nonuma.xml b/tests= /qemuxml2argvdata/cpu-host-passthrough-nonuma.xml new file mode 100644 index 000000000000..c7838aed8e12 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-nonuma.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-contiguous.ar= gs b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-contiguous.args new file mode 100644 index 000000000000..6a59cf7b44e6 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-contiguous.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 216 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D16,sockets=3D4,cores=3D4,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D56623104,host-nodes=3D0,p= olicy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0-3,memdev=3Dram-node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D56623104,host-nodes=3D1,p= olicy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D4-7,memdev=3Dram-node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D56623104,host-nodes=3D2,p= olicy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D8-11,memdev=3Dram-node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D56623104,host-nodes=3D3,p= olicy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D12-15,memdev=3Dram-node3 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-contiguous.xm= l b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-contiguous.xml new file mode 100644 index 000000000000..7fcb0e8997d9 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-contiguous.xml @@ -0,0 +1,20 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 16 + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-interleave.ar= gs b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-interleave.args new file mode 100644 index 000000000000..58bb366062f5 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-interleave.args @@ -0,0 +1,41 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 216 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D24,sockets=3D24,cores=3D1,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D56623104,host-nodes=3D0,p= olicy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0,cpus=3D4,cpus=3D8,cpus=3D12,cpus=3D16,cpus= =3D20,\ +memdev=3Dram-node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D56623104,host-nodes=3D1,p= olicy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D1,cpus=3D5,cpus=3D9,cpus=3D13,cpus=3D17,cpus= =3D21,\ +memdev=3Dram-node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D56623104,host-nodes=3D2,p= olicy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D2,cpus=3D6,cpus=3D10,cpus=3D14,cpus=3D18,cpus= =3D22,\ +memdev=3Dram-node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D56623104,host-nodes=3D3,p= olicy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D3,cpus=3D7,cpus=3D11,cpus=3D15,cpus=3D19,cpus= =3D23,\ +memdev=3Dram-node3 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-interleave.xm= l b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-interleave.xml new file mode 100644 index 000000000000..86e385808511 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-interleave.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 24 + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-contiguo= us.args b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-contiguous.= args new file mode 100644 index 000000000000..bd360976e553 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-contiguous.args @@ -0,0 +1,53 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 32768 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D16,sockets=3D8,cores=3D2,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D4294967296,host-nodes=3D1= ,\ +policy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D4294967296,host-nodes=3D1= ,\ +policy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D2-3,memdev=3Dram-node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D4294967296,host-nodes=3D2= ,\ +policy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D4-5,memdev=3Dram-node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D4294967296,host-nodes=3D2= ,\ +policy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D6-7,memdev=3Dram-node3 \ +-object memory-backend-ram,id=3Dram-node4,size=3D4294967296,host-nodes=3D1= ,\ +policy=3Dbind \ +-numa node,nodeid=3D4,cpus=3D8-9,memdev=3Dram-node4 \ +-object memory-backend-ram,id=3Dram-node5,size=3D4294967296,host-nodes=3D1= ,\ +policy=3Dbind \ +-numa node,nodeid=3D5,cpus=3D10-11,memdev=3Dram-node5 \ +-object memory-backend-ram,id=3Dram-node6,size=3D4294967296,host-nodes=3D2= ,\ +policy=3Dbind \ +-numa node,nodeid=3D6,cpus=3D12-13,memdev=3Dram-node6 \ +-object memory-backend-ram,id=3Dram-node7,size=3D4294967296,host-nodes=3D2= ,\ +policy=3Dbind \ +-numa node,nodeid=3D7,cpus=3D14-15,memdev=3Dram-node7 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-contiguo= us.xml b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-contiguous.x= ml new file mode 100644 index 000000000000..4c71ca30cc47 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-contiguous.xml @@ -0,0 +1,21 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 32 + 16 + + + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-interlea= ve.args b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-interleave.= args new file mode 100644 index 000000000000..c7e591ebf48b --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-interleave.args @@ -0,0 +1,41 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 18 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D24,sockets=3D24,cores=3D1,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D3145728,host-nodes=3D0,po= licy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0,cpus=3D6,cpus=3D12,cpus=3D18,memdev=3Dram-n= ode0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D3145728,host-nodes=3D1,po= licy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D1,cpus=3D7,cpus=3D13,cpus=3D19,memdev=3Dram-n= ode1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D3145728,host-nodes=3D2,po= licy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D2,cpus=3D8,cpus=3D14,cpus=3D20,memdev=3Dram-n= ode2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D3145728,host-nodes=3D3,po= licy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D3,cpus=3D9,cpus=3D15,cpus=3D21,memdev=3Dram-n= ode3 \ +-object memory-backend-ram,id=3Dram-node4,size=3D3145728,host-nodes=3D0,po= licy=3Dbind \ +-numa node,nodeid=3D4,cpus=3D4,cpus=3D10,cpus=3D16,cpus=3D22,memdev=3Dram-= node4 \ +-object memory-backend-ram,id=3Dram-node5,size=3D3145728,host-nodes=3D1,po= licy=3Dbind \ +-numa node,nodeid=3D5,cpus=3D5,cpus=3D11,cpus=3D17,cpus=3D23,memdev=3Dram-= node5 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-interlea= ve.xml b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-interleave.x= ml new file mode 100644 index 000000000000..ddfb8c06b4f2 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-interleave.xml @@ -0,0 +1,22 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 24 + + 12345 + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-round-ro= bin.args b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-round-robi= n.args new file mode 100644 index 000000000000..3758c10a2e18 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-round-robin.args @@ -0,0 +1,125 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 2097152 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D128,sockets=3D32,cores=3D4,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D68719476736,host-nodes=3D= 0,\ +policy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0,cpus=3D32,cpus=3D64,cpus=3D96,memdev=3Dram-= node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D68719476736,host-nodes=3D= 1,\ +policy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D1,cpus=3D33,cpus=3D65,cpus=3D97,memdev=3Dram-= node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D68719476736,host-nodes=3D= 2,\ +policy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D2,cpus=3D34,cpus=3D66,cpus=3D98,memdev=3Dram-= node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D68719476736,host-nodes=3D= 3,\ +policy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D3,cpus=3D35,cpus=3D67,cpus=3D99,memdev=3Dram-= node3 \ +-object memory-backend-ram,id=3Dram-node4,size=3D68719476736,host-nodes=3D= 0,\ +policy=3Dbind \ +-numa node,nodeid=3D4,cpus=3D4,cpus=3D36,cpus=3D68,cpus=3D100,memdev=3Dram= -node4 \ +-object memory-backend-ram,id=3Dram-node5,size=3D68719476736,host-nodes=3D= 1,\ +policy=3Dbind \ +-numa node,nodeid=3D5,cpus=3D5,cpus=3D37,cpus=3D69,cpus=3D101,memdev=3Dram= -node5 \ +-object memory-backend-ram,id=3Dram-node6,size=3D68719476736,host-nodes=3D= 2,\ +policy=3Dbind \ +-numa node,nodeid=3D6,cpus=3D6,cpus=3D38,cpus=3D70,cpus=3D102,memdev=3Dram= -node6 \ +-object memory-backend-ram,id=3Dram-node7,size=3D68719476736,host-nodes=3D= 3,\ +policy=3Dbind \ +-numa node,nodeid=3D7,cpus=3D7,cpus=3D39,cpus=3D71,cpus=3D103,memdev=3Dram= -node7 \ +-object memory-backend-ram,id=3Dram-node8,size=3D68719476736,host-nodes=3D= 0,\ +policy=3Dbind \ +-numa node,nodeid=3D8,cpus=3D8,cpus=3D40,cpus=3D72,cpus=3D104,memdev=3Dram= -node8 \ +-object memory-backend-ram,id=3Dram-node9,size=3D68719476736,host-nodes=3D= 1,\ +policy=3Dbind \ +-numa node,nodeid=3D9,cpus=3D9,cpus=3D41,cpus=3D73,cpus=3D105,memdev=3Dram= -node9 \ +-object memory-backend-ram,id=3Dram-node10,size=3D68719476736,host-nodes= =3D2,\ +policy=3Dbind \ +-numa node,nodeid=3D10,cpus=3D10,cpus=3D42,cpus=3D74,cpus=3D106,memdev=3Dr= am-node10 \ +-object memory-backend-ram,id=3Dram-node11,size=3D68719476736,host-nodes= =3D3,\ +policy=3Dbind \ +-numa node,nodeid=3D11,cpus=3D11,cpus=3D43,cpus=3D75,cpus=3D107,memdev=3Dr= am-node11 \ +-object memory-backend-ram,id=3Dram-node12,size=3D68719476736,host-nodes= =3D0,\ +policy=3Dbind \ +-numa node,nodeid=3D12,cpus=3D12,cpus=3D44,cpus=3D76,cpus=3D108,memdev=3Dr= am-node12 \ +-object memory-backend-ram,id=3Dram-node13,size=3D68719476736,host-nodes= =3D1,\ +policy=3Dbind \ +-numa node,nodeid=3D13,cpus=3D13,cpus=3D45,cpus=3D77,cpus=3D109,memdev=3Dr= am-node13 \ +-object memory-backend-ram,id=3Dram-node14,size=3D68719476736,host-nodes= =3D2,\ +policy=3Dbind \ +-numa node,nodeid=3D14,cpus=3D14,cpus=3D46,cpus=3D78,cpus=3D110,memdev=3Dr= am-node14 \ +-object memory-backend-ram,id=3Dram-node15,size=3D68719476736,host-nodes= =3D3,\ +policy=3Dbind \ +-numa node,nodeid=3D15,cpus=3D15,cpus=3D47,cpus=3D79,cpus=3D111,memdev=3Dr= am-node15 \ +-object memory-backend-ram,id=3Dram-node16,size=3D68719476736,host-nodes= =3D0,\ +policy=3Dbind \ +-numa node,nodeid=3D16,cpus=3D16,cpus=3D48,cpus=3D80,cpus=3D112,memdev=3Dr= am-node16 \ +-object memory-backend-ram,id=3Dram-node17,size=3D68719476736,host-nodes= =3D1,\ +policy=3Dbind \ +-numa node,nodeid=3D17,cpus=3D17,cpus=3D49,cpus=3D81,cpus=3D113,memdev=3Dr= am-node17 \ +-object memory-backend-ram,id=3Dram-node18,size=3D68719476736,host-nodes= =3D2,\ +policy=3Dbind \ +-numa node,nodeid=3D18,cpus=3D18,cpus=3D50,cpus=3D82,cpus=3D114,memdev=3Dr= am-node18 \ +-object memory-backend-ram,id=3Dram-node19,size=3D68719476736,host-nodes= =3D3,\ +policy=3Dbind \ +-numa node,nodeid=3D19,cpus=3D19,cpus=3D51,cpus=3D83,cpus=3D115,memdev=3Dr= am-node19 \ +-object memory-backend-ram,id=3Dram-node20,size=3D68719476736,host-nodes= =3D0,\ +policy=3Dbind \ +-numa node,nodeid=3D20,cpus=3D20,cpus=3D52,cpus=3D84,cpus=3D116,memdev=3Dr= am-node20 \ +-object memory-backend-ram,id=3Dram-node21,size=3D68719476736,host-nodes= =3D1,\ +policy=3Dbind \ +-numa node,nodeid=3D21,cpus=3D21,cpus=3D53,cpus=3D85,cpus=3D117,memdev=3Dr= am-node21 \ +-object memory-backend-ram,id=3Dram-node22,size=3D68719476736,host-nodes= =3D2,\ +policy=3Dbind \ +-numa node,nodeid=3D22,cpus=3D22,cpus=3D54,cpus=3D86,cpus=3D118,memdev=3Dr= am-node22 \ +-object memory-backend-ram,id=3Dram-node23,size=3D68719476736,host-nodes= =3D3,\ +policy=3Dbind \ +-numa node,nodeid=3D23,cpus=3D23,cpus=3D55,cpus=3D87,cpus=3D119,memdev=3Dr= am-node23 \ +-object memory-backend-ram,id=3Dram-node24,size=3D68719476736,host-nodes= =3D0,\ +policy=3Dbind \ +-numa node,nodeid=3D24,cpus=3D24,cpus=3D56,cpus=3D88,cpus=3D120,memdev=3Dr= am-node24 \ +-object memory-backend-ram,id=3Dram-node25,size=3D68719476736,host-nodes= =3D1,\ +policy=3Dbind \ +-numa node,nodeid=3D25,cpus=3D25,cpus=3D57,cpus=3D89,cpus=3D121,memdev=3Dr= am-node25 \ +-object memory-backend-ram,id=3Dram-node26,size=3D68719476736,host-nodes= =3D2,\ +policy=3Dbind \ +-numa node,nodeid=3D26,cpus=3D26,cpus=3D58,cpus=3D90,cpus=3D122,memdev=3Dr= am-node26 \ +-object memory-backend-ram,id=3Dram-node27,size=3D68719476736,host-nodes= =3D3,\ +policy=3Dbind \ +-numa node,nodeid=3D27,cpus=3D27,cpus=3D59,cpus=3D91,cpus=3D123,memdev=3Dr= am-node27 \ +-object memory-backend-ram,id=3Dram-node28,size=3D68719476736,host-nodes= =3D0,\ +policy=3Dbind \ +-numa node,nodeid=3D28,cpus=3D28,cpus=3D60,cpus=3D92,cpus=3D124,memdev=3Dr= am-node28 \ +-object memory-backend-ram,id=3Dram-node29,size=3D68719476736,host-nodes= =3D1,\ +policy=3Dbind \ +-numa node,nodeid=3D29,cpus=3D29,cpus=3D61,cpus=3D93,cpus=3D125,memdev=3Dr= am-node29 \ +-object memory-backend-ram,id=3Dram-node30,size=3D68719476736,host-nodes= =3D2,\ +policy=3Dbind \ +-numa node,nodeid=3D30,cpus=3D30,cpus=3D62,cpus=3D94,cpus=3D126,memdev=3Dr= am-node30 \ +-object memory-backend-ram,id=3Dram-node31,size=3D68719476736,host-nodes= =3D3,\ +policy=3Dbind \ +-numa node,nodeid=3D31,cpus=3D31,cpus=3D63,cpus=3D95,cpus=3D127,memdev=3Dr= am-node31 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-round-ro= bin.xml b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-round-robin= .xml new file mode 100644 index 000000000000..7d89a6d05303 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-round-robin.xml @@ -0,0 +1,21 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 2 + 128 + + + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-siblings= .args b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-siblings.args new file mode 100644 index 000000000000..7b7cb522073b --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-siblings.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 4096 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D16,sockets=3D1,cores=3D16,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D4294967296,host-nodes=3D0= ,\ +policy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0-15,memdev=3Dram-node0 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-siblings= .xml b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-siblings.xml new file mode 100644 index 000000000000..8fd65ac571c9 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-node-siblings.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 16 + + 4 + + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-robin.a= rgs b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-robin.args new file mode 100644 index 000000000000..8628e8be6c71 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-robin.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 216 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D16,sockets=3D4,cores=3D4,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D56623104,host-nodes=3D0,p= olicy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0,cpus=3D4,cpus=3D8,cpus=3D12,memdev=3Dram-no= de0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D56623104,host-nodes=3D1,p= olicy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D1,cpus=3D5,cpus=3D9,cpus=3D13,memdev=3Dram-no= de1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D56623104,host-nodes=3D2,p= olicy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D2,cpus=3D6,cpus=3D10,cpus=3D14,memdev=3Dram-n= ode2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D56623104,host-nodes=3D3,p= olicy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D3,cpus=3D7,cpus=3D11,cpus=3D15,memdev=3Dram-n= ode3 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-robin.x= ml b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-robin.xml new file mode 100644 index 000000000000..d4795c549f62 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-round-robin.xml @@ -0,0 +1,22 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 16 + + 219100 + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblings.args= b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblings.args new file mode 100644 index 000000000000..6a59cf7b44e6 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblings.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 216 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D16,sockets=3D4,cores=3D4,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D56623104,host-nodes=3D0,p= olicy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0-3,memdev=3Dram-node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D56623104,host-nodes=3D1,p= olicy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D4-7,memdev=3Dram-node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D56623104,host-nodes=3D2,p= olicy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D8-11,memdev=3Dram-node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D56623104,host-nodes=3D3,p= olicy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D12-15,memdev=3Dram-node3 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblings.xml = b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblings.xml new file mode 100644 index 000000000000..9cf3794a4c11 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa-siblings.xml @@ -0,0 +1,20 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 16 + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa.args b/tests/= qemuxml2argvdata/cpu-host-passthrough-numa.args new file mode 100644 index 000000000000..6a59cf7b44e6 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu host \ +-m 216 \ +-realtime mlock=3Doff \ +-smp 1,maxcpus=3D16,sockets=3D4,cores=3D4,threads=3D1 \ +-object memory-backend-ram,id=3Dram-node0,size=3D56623104,host-nodes=3D0,p= olicy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0-3,memdev=3Dram-node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D56623104,host-nodes=3D1,p= olicy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D4-7,memdev=3Dram-node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D56623104,host-nodes=3D2,p= olicy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D8-11,memdev=3Dram-node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D56623104,host-nodes=3D3,p= olicy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D12-15,memdev=3Dram-node3 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/cpu-host-passthrough-numa.xml b/tests/q= emuxml2argvdata/cpu-host-passthrough-numa.xml new file mode 100644 index 000000000000..eae23a5ea24f --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-host-passthrough-numa.xml @@ -0,0 +1,20 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 16 + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 122e14b07175..9554ac0c6fc3 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1732,6 +1732,16 @@ mymain(void) ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE, ARG_QEMU_CAPS, NONE); DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM); + DO_TEST("cpu-host-passthrough-numa", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_= MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-contiguous", QEMU_CAPS_NUMA, QEMU_C= APS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-node-contiguous", QEMU_CAPS_NUMA, Q= EMU_CAPS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-siblings", QEMU_CAPS_NUMA, QEMU_CAP= S_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-node-siblings", QEMU_CAPS_NUMA, QEM= U_CAPS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-round-robin", QEMU_CAPS_NUMA, QEMU_= CAPS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-node-round-robin", QEMU_CAPS_NUMA, = QEMU_CAPS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-interleave", QEMU_CAPS_NUMA, QEMU_C= APS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-numa-node-interleave", QEMU_CAPS_NUMA, Q= EMU_CAPS_OBJECT_MEMORY_RAM); + DO_TEST("cpu-host-passthrough-nonuma", QEMU_CAPS_NUMA); DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM); =20 qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list