]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Don't prealloc mem for real NVDIMMs
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 30 Nov 2020 10:06:14 +0000 (11:06 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Jan 2021 12:19:22 +0000 (13:19 +0100)
commitbf14a9be1e171af0ba065fa5a7f3607fb013e8a3
treea11bc49a39106d9aabd025c2f391c6d657a99220
parentb304207f5865f00d99392b39afc0b9eb61d98dcd
qemu: Don't prealloc mem for real NVDIMMs

Currently, we configure QEMU to prealloc memory almost by
default. Well, by default for NVDIMMs, hugepages and if user
asked us to (via memoryBacking <allocation mode="immediate"/>).

However, when guest's NVDIMM is backed by real life NVDIMM this
approach is not the best. In this case users should put <pmem/>
into the <memory/> device <source/>, like this:

  <memory model='nvdimm' access='shared'>
    <source>
      <path>/dev/pmem0</path>
      <pmem/>
    </source>
  </memory>

Instructing QEMU to do prealloc in this case means that each
page of the NVDIMM is "touched" (the first byte is read and
written back - see QEMU commit v2.9.0-rc1~26^2) which cripples
device wear.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1894053
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args