All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Deprecate pmem=on with non-DAX capable backend file
@ 2020-12-29 17:29 Igor Mammedov
  2020-12-29 18:04 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Igor Mammedov @ 2020-12-29 17:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, haozhong.zhang, pbonzini, yi.z.zhang

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 <imammedo@redhat.com>
---
 docs/system/deprecated.rst | 14 ++++++++++++++
 util/mmap-alloc.c          |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index bacd76d7a5..ba4f6ed2fe 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -327,6 +327,20 @@ 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 not DAX capable or 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.
+Using pmem=on option with such file will return error, instead of a warning.
+Options are to move backing file to NVDIMM storage or modify VM configuration
+to set ``pmem=off`` to continue using fake NVDIMM without persistence guaranties.
+
 Device options
 --------------
 
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 27dcccd8ec..d226273a98 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("Deprecated using non DAX backing file with"
+                        " pmem=on option");
         }
         /*
          * if map failed with MAP_SHARED_VALIDATE | MAP_SYNC,
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2020-12-29 17:29 [PATCH] Deprecate pmem=on with non-DAX capable backend file Igor Mammedov
@ 2020-12-29 18:04 ` Philippe Mathieu-Daudé
  2020-12-29 20:11   ` Igor Mammedov
  0 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-12-29 18:04 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel
  Cc: libvir-list, haozhong.zhang, yi.z.zhang, pbonzini

On 12/29/20 6:29 PM, Igor Mammedov 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 <imammedo@redhat.com>
> ---
>  docs/system/deprecated.rst | 14 ++++++++++++++
>  util/mmap-alloc.c          |  3 +++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index bacd76d7a5..ba4f6ed2fe 100644
> --- a/docs/system/deprecated.rst
> +++ b/docs/system/deprecated.rst
> @@ -327,6 +327,20 @@ 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 not DAX capable or not on a filesystem that support direct mapping of persistent

Maybe clearer enumerating? As:
"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.
> +Using pmem=on option with such file will return error, instead of a warning.

Not sure the difference between warn/err is important in the doc.

> +Options are to move backing file to NVDIMM storage or modify VM configuration
> +to set ``pmem=off`` to continue using fake NVDIMM without persistence guaranties.

Maybe:

The possibilities to continue using fake NVDIMM (without persistence
guaranties) are:
- move backing file to NVDIMM storage
- modify VM configuration to set ``pmem=off``

> +
>  Device options
>  --------------
>  
> diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
> index 27dcccd8ec..d226273a98 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("Deprecated using non DAX backing file with"
> +                        " pmem=on option");

Maybe "Using non DAX backing file with 'pmem=on' option is deprecated"?

Beside the nitpicking comments,
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>          }
>          /*
>           * if map failed with MAP_SHARED_VALIDATE | MAP_SYNC,
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2020-12-29 18:04 ` Philippe Mathieu-Daudé
@ 2020-12-29 20:11   ` Igor Mammedov
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Mammedov @ 2020-12-29 20:11 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: libvir-list, haozhong.zhang, yi.z.zhang, qemu-devel, pbonzini

On Tue, 29 Dec 2020 19:04:58 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On 12/29/20 6:29 PM, Igor Mammedov 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 <imammedo@redhat.com>
> > ---
> >  docs/system/deprecated.rst | 14 ++++++++++++++
> >  util/mmap-alloc.c          |  3 +++
> >  2 files changed, 17 insertions(+)
> > 
> > diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> > index bacd76d7a5..ba4f6ed2fe 100644
> > --- a/docs/system/deprecated.rst
> > +++ b/docs/system/deprecated.rst
> > @@ -327,6 +327,20 @@ 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 not DAX capable or not on a filesystem that support direct mapping of persistent  
> 
> Maybe clearer enumerating? As:
> "is a) not DAX capable or b) not on a filesystem that support direct
> mapping of persistent"

will change it to your variant in v2

> 
> > +memory, is not safe and may lead to data loss or corruption in case of host crash.
> > +Using pmem=on option with such file will return error, instead of a warning.  
> 
> Not sure the difference between warn/err is important in the doc.
not many care about warnings until QEMU starts fine,
I've mentioned error here so that whomever reading this would know what to expect

> 
> > +Options are to move backing file to NVDIMM storage or modify VM configuration
> > +to set ``pmem=off`` to continue using fake NVDIMM without persistence guaranties.  
> 
> Maybe:
> 
> The possibilities to continue using fake NVDIMM (without persistence
> guaranties) are:
> - move backing file to NVDIMM storage
> - modify VM configuration to set ``pmem=off``

only the later is faking nvdimm, the first is properly emulated one with persistence guaranties.
Maybe:
 Options are:
    - modify VM configuration to set ``pmem=off`` to continue using fake NVDIMM
      (without persistence guaranties) on 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..d226273a98 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("Deprecated using non DAX backing file with"
> > +                        " pmem=on option");  
> 
> Maybe "Using non DAX backing file with 'pmem=on' option is deprecated"?
ok

> 
> Beside the nitpicking comments,
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> >          }
> >          /*
> >           * if map failed with MAP_SHARED_VALIDATE | MAP_SYNC,
> >   
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2021-04-28 16:29   ` Eduardo Habkost
@ 2021-05-03 12:14     ` Igor Mammedov
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Mammedov @ 2021-05-03 12:14 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: thuth, Michael S. Tsirkin, libvir-list, qemu-devel, pbonzini, philmd

On Wed, 28 Apr 2021 12:29:30 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Tue, Apr 27, 2021 at 04:48:48PM -0400, Eduardo Habkost wrote:
> > On Mon, Jan 11, 2021 at 03:33:32PM -0500, Igor Mammedov 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 <imammedo@redhat.com>
> > > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>  
> > 
> > I'm queueing this for 6.1, after changing "since 6.0" to "since 6.1".
> > 
> > Sorry for letting it fall through the cracks.  
> 
> This caused build failures[1] and I had to apply the following
> fixup.
Thanks!

> 
> [1] https://gitlab.com/ehabkost/qemu/-/jobs/1216917482#L3444
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  docs/system/deprecated.rst | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index cc8d810be1a..c55c4bceb00 100644
> --- a/docs/system/deprecated.rst
> +++ b/docs/system/deprecated.rst
> @@ -257,6 +257,7 @@ 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``



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2021-04-27 20:48 ` Eduardo Habkost
@ 2021-04-28 16:29   ` Eduardo Habkost
  2021-05-03 12:14     ` Igor Mammedov
  0 siblings, 1 reply; 10+ messages in thread
From: Eduardo Habkost @ 2021-04-28 16:29 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: thuth, Michael S. Tsirkin, libvir-list, qemu-devel, pbonzini, philmd

On Tue, Apr 27, 2021 at 04:48:48PM -0400, Eduardo Habkost wrote:
> On Mon, Jan 11, 2021 at 03:33:32PM -0500, Igor Mammedov 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 <imammedo@redhat.com>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> I'm queueing this for 6.1, after changing "since 6.0" to "since 6.1".
> 
> Sorry for letting it fall through the cracks.

This caused build failures[1] and I had to apply the following
fixup.

[1] https://gitlab.com/ehabkost/qemu/-/jobs/1216917482#L3444

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 docs/system/deprecated.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index cc8d810be1a..c55c4bceb00 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -257,6 +257,7 @@ 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``
-- 
2.30.2

-- 
Eduardo



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2021-01-11 20:33 Igor Mammedov
  2021-01-20 19:31 ` Igor Mammedov
  2021-02-09 16:09 ` Igor Mammedov
@ 2021-04-27 20:48 ` Eduardo Habkost
  2021-04-28 16:29   ` Eduardo Habkost
  2 siblings, 1 reply; 10+ messages in thread
From: Eduardo Habkost @ 2021-04-27 20:48 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: thuth, Michael S. Tsirkin, libvir-list, qemu-devel, pbonzini, philmd

On Mon, Jan 11, 2021 at 03:33:32PM -0500, Igor Mammedov 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 <imammedo@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

I'm queueing this for 6.1, after changing "since 6.0" to "since 6.1".

Sorry for letting it fall through the cracks.

-- 
Eduardo



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2021-01-11 20:33 Igor Mammedov
  2021-01-20 19:31 ` Igor Mammedov
@ 2021-02-09 16:09 ` Igor Mammedov
  2021-04-27 20:48 ` Eduardo Habkost
  2 siblings, 0 replies; 10+ messages in thread
From: Igor Mammedov @ 2021-02-09 16:09 UTC (permalink / raw)
  To: qemu-devel, pbonzini

On Mon, 11 Jan 2021 15:33:32 -0500
Igor Mammedov <imammedo@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 <imammedo@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v2:
>   rephrase deprecation comment andwarning message
>   (Philippe Mathieu-Daudé <philmd@redhat.com>)

Paolo,

can you pick it up via your tree?

> ---
>  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,



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2021-01-20 19:31 ` Igor Mammedov
@ 2021-01-20 21:35   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-20 21:35 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel
  Cc: libvir-list, pbonzini, thuth, Eduardo Habkost, Michael S. Tsirkin

Cc'ing MST.

On 1/20/21 8:31 PM, Igor Mammedov wrote:
> On Mon, 11 Jan 2021 15:33:32 -0500
> Igor Mammedov <imammedo@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 <imammedo@redhat.com>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> v2:
>>   rephrase deprecation comment andwarning message
>>   (Philippe Mathieu-Daudé <philmd@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,
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Deprecate pmem=on with non-DAX capable backend file
  2021-01-11 20:33 Igor Mammedov
@ 2021-01-20 19:31 ` Igor Mammedov
  2021-01-20 21:35   ` Philippe Mathieu-Daudé
  2021-02-09 16:09 ` Igor Mammedov
  2021-04-27 20:48 ` Eduardo Habkost
  2 siblings, 1 reply; 10+ messages in thread
From: Igor Mammedov @ 2021-01-20 19:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, pbonzini, thuth, philmd, Eduardo Habkost

On Mon, 11 Jan 2021 15:33:32 -0500
Igor Mammedov <imammedo@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 <imammedo@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v2:
>   rephrase deprecation comment andwarning message
>   (Philippe Mathieu-Daudé <philmd@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,



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Deprecate pmem=on with non-DAX capable backend file
@ 2021-01-11 20:33 Igor Mammedov
  2021-01-20 19:31 ` Igor Mammedov
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Igor Mammedov @ 2021-01-11 20:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, pbonzini, thuth, philmd

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 <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2:
  rephrase deprecation comment andwarning message
  (Philippe Mathieu-Daudé <philmd@redhat.com>)
---
 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,
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-03 12:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 17:29 [PATCH] Deprecate pmem=on with non-DAX capable backend file Igor Mammedov
2020-12-29 18:04 ` Philippe Mathieu-Daudé
2020-12-29 20:11   ` Igor Mammedov
2021-01-11 20:33 Igor Mammedov
2021-01-20 19:31 ` Igor Mammedov
2021-01-20 21:35   ` Philippe Mathieu-Daudé
2021-02-09 16:09 ` Igor Mammedov
2021-04-27 20:48 ` Eduardo Habkost
2021-04-28 16:29   ` Eduardo Habkost
2021-05-03 12:14     ` Igor Mammedov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.