On Mon, 11 Jan 2021 15:33:32 -0500
Igor Mammedov <imamm...@redhat.com> wrote:

> It is not safe to pretend that emulated NVDIMM supports
> persistence while backend actually failed to enable it
> and used non-persistent mapping as fall back.
> Instead of falling-back, QEMU should be more strict and
> error out with clear message that it's not supported.
> So if user asks for persistence (pmem=on), they should
> store backing file on NVDIMM.
> 
> Signed-off-by: Igor Mammedov <imamm...@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com>
> ---
> v2:
>   rephrase deprecation comment andwarning message
>   (Philippe Mathieu-Daudé <phi...@redhat.com>)

I've posted as v1 though it's v2 and it looks like it fell through cracks,

can someone pick it up if it looks fine, please?

> ---
>  docs/system/deprecated.rst | 17 +++++++++++++++++
>  util/mmap-alloc.c          |  3 +++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index bacd76d7a5..e79fb02b3a 100644
> --- a/docs/system/deprecated.rst
> +++ b/docs/system/deprecated.rst
> @@ -327,6 +327,23 @@ The Raspberry Pi machines come in various models (A, A+, 
> B, B+). To be able
>  to distinguish which model QEMU is implementing, the ``raspi2`` and 
> ``raspi3``
>  machines have been renamed ``raspi2b`` and ``raspi3b``.
>  
> +Backend options
> +---------------
> +
> +Using non-persistent backing file with pmem=on (since 6.0)
> +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> +
> +This option is used when ``memory-backend-file`` is consumed by emulated 
> NVDIMM
> +device. However enabling ``memory-backend-file.pmem`` option, when backing 
> file
> +is (a) not DAX capable or (b) not on a filesystem that support direct mapping
> +of persistent memory, is not safe and may lead to data loss or corruption in 
> case
> +of host crash.
> +Options are:
> +    - modify VM configuration to set ``pmem=off`` to continue using fake 
> NVDIMM
> +      (without persistence guaranties) with backing file on non DAX storage
> +    - move backing file to NVDIMM storage and keep ``pmem=on``
> +      (to have NVDIMM with persistence guaranties).
> +
>  Device options
>  --------------
>  
> diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
> index 27dcccd8ec..0388cc3be2 100644
> --- a/util/mmap-alloc.c
> +++ b/util/mmap-alloc.c
> @@ -20,6 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/mmap-alloc.h"
>  #include "qemu/host-utils.h"
> +#include "qemu/error-report.h"
>  
>  #define HUGETLBFS_MAGIC       0x958458f6
>  
> @@ -166,6 +167,8 @@ void *qemu_ram_mmap(int fd,
>                      "crash.\n", file_name);
>              g_free(proc_link);
>              g_free(file_name);
> +            warn_report("Using non DAX backing file with 'pmem=on' option"
> +                        " is deprecated");
>          }
>          /*
>           * if map failed with MAP_SHARED_VALIDATE | MAP_SYNC,


Reply via email to