From nobody Sun Feb 8 22:22:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489075820383158.4422319494472; Thu, 9 Mar 2017 08:10:20 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29G6vgF058604; Thu, 9 Mar 2017 11:06:57 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v29G6bQQ032431 for ; Thu, 9 Mar 2017 11:06:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF5C42D655; Thu, 9 Mar 2017 16:06:37 +0000 (UTC) Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 479942D653 for ; Thu, 9 Mar 2017 16:06:37 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 9 Mar 2017 17:06:17 +0100 Message-Id: <1aebdf2f278a185611c85cbc4049b23522922357.1489075458.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 08/17] conf: Introduce @access to X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that NVDIMM has found its way into libvirt, users might want to fine tune some settings for each module separately. One such setting is 'share=3Don|off' for the memory-backend-file object. This setting - just like its name suggest already - enables sharing the nvdimm module with other applications. Under the hood it controls whether qemu mmaps() the file as MAP_PRIVATE or MAP_SHARED. Yet again, we have such config knob in domain XML, but it's just an attribute to numa . This does not give fine enough tuning on per-memdevice basis so we need to have the attribute for each device too. Signed-off-by: Michal Privoznik --- docs/formatdomain.html.in | 16 ++++++- docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 15 +++++- src/conf/domain_conf.h | 2 + .../qemuxml2argv-memory-hotplug-nvdimm-access.xml | 56 ++++++++++++++++++= ++++ ...qemuxml2xmlout-memory-hotplug-nvdimm-access.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdi= mm-access.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-= nvdimm-access.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6e89bfe3a..4bc3d92f9 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1417,7 +1417,7 @@ Since 1.2.9 the optional attribute memAccess can control whether the memory is to be mapped as "shared" or "private". This is valid only for - hugepages-backed memory. + hugepages-backed memory and nvdimm modules.

=20

@@ -7099,7 +7099,7 @@ qemu-kvm -net nic,model=3D? /dev/null

 ...
 <devices>
-  <memory model=3D'dimm'>
+  <memory model=3D'dimm' access=3D'private'>
     <target>
       <size unit=3D'KiB'>524287</size>
       <node>0</node>
@@ -7138,6 +7138,18 @@ qemu-kvm -net nic,model=3D? /dev/null
         

=20 +
access
+
+

+ An optional attribute access + (since 3.2.0) that provides + capability to fine tune mapping of the memory on per + module basis. Values are the same as + Memory Backing: + shared and private. +

+
+
source

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 07b3c52ad..5e7e75950 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4749,6 +4749,14 @@ nvdimm + + + + shared + private + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e23ce0015..bf3f2fb86 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13874,6 +13874,15 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, } VIR_FREE(tmp); =20 + tmp =3D virXMLPropString(memdevNode, "access"); + if (tmp && + (def->access =3D virDomainMemoryAccessTypeFromString(tmp)) <=3D 0)= { + virReportError(VIR_ERR_XML_ERROR, + _("invalid access mode '%s'"), tmp); + goto error; + } + VIR_FREE(tmp); + /* source */ if ((node =3D virXPathNode("./source", ctxt)) && virDomainMemorySourceDefParseXML(node, ctxt, def) < 0) @@ -22680,7 +22689,11 @@ virDomainMemoryDefFormat(virBufferPtr buf, { const char *model =3D virDomainMemoryModelTypeToString(def->model); =20 - virBufferAsprintf(buf, "\n", model); + virBufferAsprintf(buf, "access) + virBufferAsprintf(buf, " access=3D'%s'", + virDomainMemoryAccessTypeToString(def->access)); + virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); =20 if (virDomainMemorySourceDefFormat(buf, def) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 823582253..fa27708ce 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2002,6 +2002,8 @@ typedef enum { } virDomainMemoryModel; =20 struct _virDomainMemoryDef { + virDomainMemoryAccess access; + /* source */ virBitmapPtr sourceNodes; unsigned long long pagesize; /* kibibytes */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-acce= ss.xml b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.x= ml new file mode 100644 index 000000000..700e961a6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.xml @@ -0,0 +1,56 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1267710 + 1267710 + 2 + + hvm + + + + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +

+ + +
+ + +
+ + + + + +
+ + + + /tmp/nvdimm + + + 523264 + 0 + +
+ + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-= access.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-= access.xml new file mode 120000 index 000000000..4b0496ad5 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-access.= xml @@ -0,0 +1 @@ +/home/zippy/work/libvirt/libvirt.git/tests/qemuxml2argvdata/qemuxml2argv-m= emory-hotplug-nvdimm-access.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index e1c341dd5..ef49a79ca 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1079,6 +1079,7 @@ mymain(void) DO_TEST("memory-hotplug-nonuma", NONE); DO_TEST("memory-hotplug-dimm", NONE); DO_TEST("memory-hotplug-nvdimm", NONE); + DO_TEST("memory-hotplug-nvdimm-access", NONE); DO_TEST("net-udp", NONE); =20 DO_TEST("video-virtio-gpu-device", NONE); --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list