-objectdescribes the location, size, and id of the memory-backend and
-objectto the guest. A simple way to create a single vNVDIMM device at startup time is done via the following command line options:
nvdimmmachine option enables vNVDIMM feature.
slots=$Nshould be equal to or larger than the total amount of normal RAM devices and vNVDIMM devices, e.g. $N should be >= 2 here.
maxmem=$MAX_SIZEshould be equal to or larger than the total size
object memory-backend-file,id=mem1,share=on,mem-path=$PATH,size=$NVDIMM_SIZEcreates a backend storage of size
$NVDIMM_SIZEon a file
share=on/offcontrols the visibility of guest writes. If
share=on, then guest writes will be applied to the backend
share=on, then above writes will be visible to it as well. If
share=off, then guest writes won't be applied to the backend
device nvdimm,id=nvdimm1,memdev=mem1creates a virtual NVDIMM
-deviceare provided. See Example 1 below.
-vnc :0which equates to port 5900.
-vnc :0, connect to the guest using a VNC Viewer and access the monitor using
Ctrl-Alt-1to get back to the VM display). Alternatives include:
-qmp tcp:localhost:4444,server --monitor stdio. To connect, use
telnet localhost 4444.
-qmp unix:./qmp-sock,server --monitor stdioand connect using
nc -U ./qmp-sock.
(qemu)monitor prompt is accessed via a vnc connection to the host using the guest vnc port, then pressing Ctrl-Alt-2, as described above.
/dev/dax0.0as the backend of vNVDIMM:
mmapsystem call (available since Linux 4.15 and on certain distro kernels) and additionally both 'pmem' and 'share' flags are set to 'on' on the backend.
mmap(2)man page: http://man7.org/linux/man-pages/man2/mmap.2.html.
clflush. As any modern machine (starting with Skylake and Pinnacle Ridge) has
clwb(Cannon Lake), you can significantly improve performance by passing a
-cpuflag to qemu. Unless you require live migrating,
-cpu hostis a good choice.