[RFC 1/3] xml: introduce more config elements for NVDIMM memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to align with QEMU ,four more parameters about NVDIMM will
be introduced into Libvirt xml.

1.alignsize
The 'alignsize' option allows users to specify the proper alignment. When
mmap(2) the backend files, QEMU uses the host page size by default as
the alignment of mapping address. However, some backends may require
alignments different from the pagesize. For example, mmap a device DAX
on NVDIMM maybe 2M-aligned.

2.pmem
The 'pmem' option allows users to specify whether the backend storage of
memory-backend-file is a real persistent memory that can be accessed in
SNIA NVM Programming Model. If the vNVDIMM backend is in host persistent
memory , and 'pmem' is 'on' and QEMU is built with libpmem, qemu will
guarantee the persistence of its own writes to the vNVDIMM backend.

3.persistence
The 'persistence' option allows users to set platform-supported features
about NVDIMM data persistence of a guest. It has two values, 'mem-ctrl'
means the platform supports flushing dirty data from the memory controller
to the NVDIMMs in the event of power loss, 'cpu' means The platform supports
flushing dirty data from the CPU cache to the NVDIMMs in the event of power
loss, which contains what 'mem-ctrl' means.

4.unarmed
The 'unarmed' option allows users to mark vNVDIMM read-only. Only one type
of vNVDIMM backends can guarantee the guest write persistence, which is the
device DAX on the real NVDIMM device (e.g., /dev/dax0.0). When using other
types of backends, it's suggested to set 'unarmed' option to 'on', so the
guest Linux NVDIMM driver will mark such vNVDIMM device as read-only.

For more details, see
https://github.com/qemu/qemu/blob/master/docs/nvdimm.txt

Signed-off-by: Zhong,Luyao <luyao.zhong@xxxxxxxxx>
---
 docs/formatdomain.html.in     | 98 ++++++++++++++++++++++++++++++++++++-------
 docs/schemas/domaincommon.rng | 31 ++++++++++++--
 2 files changed, 111 insertions(+), 18 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 8189959..9dec984 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8258,6 +8258,8 @@ qemu-kvm -net nic,model=? /dev/null
   &lt;memory model='nvdimm'&gt;
     &lt;source&gt;
       &lt;path&gt;/tmp/nvdimm&lt;/path&gt;
+      &lt;alignsize unit='KiB'&gt;2048&lt;/alignsize&gt;
+      &lt;pmem&gt;on&lt;/pmem&gt;
     &lt;/source&gt;
     &lt;target&gt;
       &lt;size unit='KiB'&gt;524288&lt;/size&gt;
@@ -8265,6 +8267,8 @@ qemu-kvm -net nic,model=? /dev/null
       &lt;label&gt;
         &lt;size unit='KiB'&gt;128&lt;/size&gt;
       &lt;/label&gt;
+      &lt;persistence&gt;cpu&lt;/persistence&gt;
+      &lt;unarmed&gt;on&lt;/unarmed&gt;
     &lt;/target&gt;
   &lt;/memory&gt;
 &lt;/devices&gt;
@@ -8339,10 +8343,38 @@ qemu-kvm -net nic,model=? /dev/null
         </dl>
 
         <p>
-          For model <code>nvdimm</code> this element is mandatory and has a
-          single child element <code>path</code> that represents a path
-          in the host that backs the nvdimm module in the guest.
+          For model <code>nvdimm</code> this element is mandatory. The
+          mandatory child element <code>path</code> represents a path in
+          the host that backs the nvdimm module in the guest. If
+          <code>nvdimm</code> is provided, then the following optional
+          elements can be provided as well:
         </p>
+
+        <dl>
+          <dt><code>alignsize</code></dt>
+          <dd>
+            <p>
+              This element can be used to specify a proper alignment.
+              When mmap(2) the backend files, QEMU uses the host page
+              size by default as the alignment of mapping address. However,
+              some backends may require alignments different from the page.
+              For example, mmap a device DAX on NVDIMM maybe 2M-aligned.
+            </p>
+          </dd>
+
+          <dt><code>pmem</code></dt>
+          <dd>
+            <p>
+              This element can be used to specify whether the backend storage
+              of memory-backend-file is a real persistent memory that can be
+              accessed in SNIA NVM Programming Model. If the backend  is a real
+              persistence memory and <code>pmem</code> is set to 'on', QEMU will
+              guarantee the persistence of its own writes to the vNVDIMM backend,
+              but which can work well with libpmem support (QEMU configured with
+              --enable-libpmem).
+            </p>
+          </dd>
+        </dl>
       </dd>
 
       <dt><code>target</code></dt>
@@ -8361,19 +8393,55 @@ qemu-kvm -net nic,model=? /dev/null
           NUMA nodes configured.
         </p>
         <p>
-          For NVDIMM type devices one can optionally use
-          <code>label</code> and its subelement <code>size</code>
-          to configure the size of namespaces label storage
-          within the NVDIMM module. The <code>size</code> element
-          has usual meaning described
-          <a href="#elementsMemoryAllocation">here</a>.
-          For QEMU domains the following restrictions apply:
+          Besides, the following optional elements can be provided as well for
+          NVDIMM type devices:
         </p>
-        <ol>
-          <li>the minimum label size is 128KiB,</li>
-          <li>the remaining size (total-size - label-size) has to be aligned to
-            4KiB</li>
-        </ol>
+
+        <dl>
+          <dt><code>label</code></dt>
+          <dd>
+            <p>
+              For NVDIMM type devices one can optionally use
+              <code>label</code> and its subelement <code>size</code>
+              to configure the size of namespaces label storage
+              within the NVDIMM module. The <code>size</code> element
+              has usual meaning described
+              <a href="#elementsMemoryAllocation">here</a>.
+              For QEMU domains the following restrictions apply:
+            </p>
+            <ol>
+              <li>the minimum label size is 128KiB,</li>
+              <li>the remaining size (total-size - label-size) will be aligned to
+                4KiB as default.</li>
+            </ol>
+          </dd>
+
+          <dt><code>persistence</code></dt>
+          <dd>
+            <p>
+              The <code>persistence</code> element can be set to "mem-ctl" or "cpu",
+              which indicate platform-supported features about NVDIMM data persistence.
+              'mem-ctrl' means the platform supports flushing dirty data from the memory
+              controller to the NVDIMMs in the event of power loss, 'cpu' means The platform
+              supports flushing dirty data from the CPU cache to the NVDIMMs in the event
+              of power loss, which contains what 'mem-ctrl' means.
+              ACPI 6.2 Errata A added support for a new Platform Capabilities Structure
+              in NFIT, so the guest ACPI NFIT will be filled in according to the persistence
+              option.
+            </p>
+          </dd>
+
+          <dt><code>unarmed</code></dt>
+          <dd>
+            <p>
+              The <code>unarmed</code> element can be used to mark vNVDIMM read-only
+              through setting unarmed flag in guest NFIT.Currently the only vNVDIMM backend
+              can guarantee the guest write persistence is device DAX on Linux, so it's
+              suggested to set <code>unarmed</code> to 'on' when using other types of
+              backends.
+            </p>
+          </dd>
+        </dl>
       </dd>
     </dl>
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 099a949..cca7869 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5353,9 +5353,21 @@
           </interleave>
         </group>
         <group>
-          <element name="path">
-            <ref name="absFilePath"/>
-          </element>
+          <interleave>
+            <element name="path">
+              <ref name="absFilePath"/>
+            </element>
+            <optional>
+              <element name="alignsize">
+                <ref name="scaledInteger"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="pmem">
+                <ref name="virOnOff"/>
+              </element>
+            </optional>
+          </interleave>
         </group>
       </choice>
     </element>
@@ -5379,6 +5391,19 @@
             </element>
           </element>
         </optional>
+        <optional>
+          <element name="persistence">
+            <choice>
+              <value>mem-ctrl</value>
+              <value>cpu</value>
+            </choice>
+          </element>
+        </optional>
+        <optional>
+          <element name="unarmed">
+            <ref name="virOnOff"/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux