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 <memory model='nvdimm'> <source> <path>/tmp/nvdimm</path> + <alignsize unit='KiB'>2048</alignsize> + <pmem>on</pmem> </source> <target> <size unit='KiB'>524288</size> @@ -8265,6 +8267,8 @@ qemu-kvm -net nic,model=? /dev/null <label> <size unit='KiB'>128</size> </label> + <persistence>cpu</persistence> + <unarmed>on</unarmed> </target> </memory> </devices> @@ -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