[PATCH v2] qemu: Don't prealloc mem for real NVDIMMs

Daniel P. Berrangé berrange at redhat.com
Tue Jan 5 12:13:59 UTC 2021


On Tue, Jan 05, 2021 at 12:39:00PM +0100, Michal Privoznik wrote:
> 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 at redhat.com>
> ---
> 
> v2 of:
> 
> https://www.redhat.com/archives/libvir-list/2020-November/msg01568.html
> 
> diff to v1:
> - I've dropped the first hunk of v1 which forbade prealloc even if user
>   requested it explicitly.
> 
>  src/qemu/qemu_command.c                                      | 5 ++++-
>  .../memory-hotplug-nvdimm-pmem.x86_64-latest.args            | 2 +-
>  2 files changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list