NVDIMM was introduced to qemu in v2.6.0-rc0~248^2~25. So it's
been a while since then.
It's not the next big thing, but it is very interesting feature
enabling higher performance as reading/writing to the module (and
subsequently to the file on the host) does not require a VMEXIT.
It can be used to access host files directly bypassing page cache
whilst doing so.
How to test the feature?
1) you need PMEM enabled kernel:
CONFIG_LIBNVDIMM=y
CONFIG_BLK_DEV_PMEM=m
CONFIG_ACPI_NFIT=m
2) Create a file in the host:
truncate -s 512M /tmp/nvdimm
3) Add the following to the domain XML:
<memory model='nvdimm' memAccess='shared'>
<source>
<path>/tmp/nvdimm</path>
</source>
<target>
<size unit='KiB'>523264</size>
<node>0</node>
</target>
</memory>
4) Start the domain and write something into the NVDIMM module:
(guest) $ echo 'Hello world' > /dev/pmem0
5) From the host, check the file has changed:
(host) $ hexdump -C /tmp/nvdimm
Want to watch very interesting video while reviewing?
https://youtu.be/Vit3-PjbN9M
Michal Privoznik (5):
Introduce NVDIMM memory model
qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
qemu: Implement NVDIMM
conf: Introduce memAccess to <memory/>
qemu: Implement memAccess for <memory/> banks
docs/formatdomain.html.in | 41 ++++++--
docs/schemas/domaincommon.rng | 51 ++++++----
src/conf/domain_conf.c | 112 ++++++++++++++++-----
src/conf/domain_conf.h | 4 +
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 12 ++-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 87 +++++++++++-----
src/qemu/qemu_command.h | 2 +
src/qemu/qemu_domain.c | 29 ++++--
src/qemu/qemu_hotplug.c | 3 +-
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
.../qemuxml2argv-hugepages-numa.args | 5 +-
.../qemuxml2argv-hugepages-pages.args | 24 ++---
.../qemuxml2argv-hugepages-pages2.args | 8 +-
.../qemuxml2argv-hugepages-pages3.args | 4 +-
.../qemuxml2argv-hugepages-shared.args | 22 ++--
.../qemuxml2argv-memory-hotplug-dimm-addr.args | 5 +-
.../qemuxml2argv-memory-hotplug-dimm.args | 5 +-
...muxml2argv-memory-hotplug-nvdimm-memAccess.args | 26 +++++
...emuxml2argv-memory-hotplug-nvdimm-memAccess.xml | 49 +++++++++
.../qemuxml2argv-memory-hotplug-nvdimm.args | 25 +++++
.../qemuxml2argv-memory-hotplug-nvdimm.xml | 49 +++++++++
tests/qemuxml2argvtest.c | 6 +-
25 files changed, 452 insertions(+), 123 deletions(-)
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.xml
--
2.8.4