From nobody Mon Feb 9 21:19:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545297307511509.3846359992857; Thu, 20 Dec 2018 01:15:07 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id CB86076524; Thu, 20 Dec 2018 09:15:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F35118223; Thu, 20 Dec 2018 09:15:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D7AABC584; Thu, 20 Dec 2018 09:15:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBK9EsNT030365 for ; Thu, 20 Dec 2018 04:14:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8841C604DD; Thu, 20 Dec 2018 09:14:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D97B60559 for ; Thu, 20 Dec 2018 09:14:52 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 60376C070E39 for ; Thu, 20 Dec 2018 09:14:51 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2018 01:14:50 -0800 Received: from zly-optiplex-9020.bj.intel.com ([10.238.135.151]) by fmsmga001.fm.intel.com with ESMTP; 20 Dec 2018 01:14:49 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,376,1539673200"; d="scan'208";a="131518402" From: Luyao Zhong To: libvir-list@redhat.com Date: Thu, 20 Dec 2018 17:14:42 +0800 Message-Id: <1545297290-25463-4-git-send-email-luyao.zhong@intel.com> In-Reply-To: <1545297290-25463-1-git-send-email-luyao.zhong@intel.com> References: <1545297290-25463-1-git-send-email-luyao.zhong@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 20 Dec 2018 09:14:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 20 Dec 2018 09:14:51 +0000 (UTC) for IP:'134.134.136.24' DOMAIN:'mga09.intel.com' HELO:'mga09.intel.com' FROM:'luyao.zhong@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 134.134.136.24 mga09.intel.com 134.134.136.24 mga09.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 03/11] nvdimm: introduce 'readonly' element into xml for NVDIMM memory X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 20 Dec 2018 09:15:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The 'readonly' option allows users to mark vNVDIMM read-only: ... /dev/dax0.0 4094 0 ... Signed-off-by: Luyao Zhong Reviewed-by: John Ferlan --- docs/formatdomain.html.in | 45 ++++++++++++----- docs/schemas/domaincommon.rng | 5 ++ src/conf/domain_conf.c | 12 +++++ src/conf/domain_conf.h | 1 + .../memory-hotplug-nvdimm-readonly.xml | 58 ++++++++++++++++++= ++++ .../memory-hotplug-nvdimm-readonly.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x= ml create mode 120000 tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly= .xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0781f24..2ca7a46 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8331,6 +8331,7 @@ qemu-kvm -net nic,model=3D? /dev/null <label> <size unit=3D'KiB'>128</size> </label> + <readonly/> </target> </memory> </devices> @@ -8454,19 +8455,39 @@ qemu-kvm -net nic,model=3D? /dev/null NUMA nodes configured.

- For NVDIMM type devices one can optionally use - label and its subelement size - to configure the size of namespaces label storage - within the NVDIMM module. The size element - has usual meaning described - here. - For QEMU domains the following restrictions apply: + Besides, the following optional elements can be provided as well= for + NVDIMM type devices:

-
    -
  1. the minimum label size is 128KiB,
  2. -
  3. the remaining size (total-size - label-size) has to be align= ed to - 4KiB
  4. -
+ +
+
label
+
+

+ For NVDIMM type devices one can optionally use + label and its subelement size + to configure the size of namespaces label storage + within the NVDIMM module. The size element + has usual meaning described + here. + For QEMU domains the following restrictions apply: +

+
    +
  1. the minimum label size is 128KiB,
  2. +
  3. the remaining size (total-size - label-size) will be ali= gned to + 4KiB as default.
  4. +
+
+ +
readonly
+
+

+ The readonly element can be used to mark vNVDIM= M read-only. + Currently, only real NVDIMM device backend can guarantee the= guest write + persistence, so please set readonly when using = other types + of backends. Since 5.0.0 +

+
+
=20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a7b7164..6518aff 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5422,6 +5422,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9edaf6d..222bb8c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15844,6 +15844,9 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node, _("label size must be smaller than NVDIMM size"= )); goto cleanup; } + + if (virXPathBoolean("boolean(./readonly)", ctxt)) + def->readonly =3D true; } =20 ret =3D 0; @@ -22766,6 +22769,13 @@ virDomainMemoryDefCheckABIStability(virDomainMemor= yDefPtr src, "source NVDIMM pmem flag")); return false; } + + if (src->readonly !=3D dst->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target NVDIMM readonly flag doesn't match " + "source NVDIMM readonly flag")); + return false; + } } =20 return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info); @@ -26344,6 +26354,8 @@ virDomainMemoryTargetDefFormat(virBufferPtr buf, virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } + if (def->readonly) + virBufferAddLit(buf, "\n"); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a63afdc..fae1306 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2155,6 +2155,7 @@ struct _virDomainMemoryDef { int targetNode; unsigned long long size; /* kibibytes */ unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */ + bool readonly; /* valid only for NVDIMM */ =20 virDomainDeviceInfo info; }; diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml b/te= sts/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml new file mode 100644 index 0000000..170992c --- /dev/null +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml @@ -0,0 +1,58 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1267710 + 1267710 + 2 + + hvm + + + + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + +
+ + +
+ + + + + +
+ + + + /tmp/nvdimm + + + 523264 + 0 + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml b/= tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml new file mode 120000 index 0000000..10be844 --- /dev/null +++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ef3ece8..82e2c0e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1118,6 +1118,7 @@ mymain(void) DO_TEST("memory-hotplug-nvdimm-label", NONE); DO_TEST("memory-hotplug-nvdimm-align", NONE); DO_TEST("memory-hotplug-nvdimm-pmem", NONE); + DO_TEST("memory-hotplug-nvdimm-readonly", NONE); DO_TEST("net-udp", NONE); =20 DO_TEST("video-virtio-gpu-device", NONE); --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list