[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RESEND PATCH 1/2] nvdimm: warn if the backend is not a
From: |
Haozhong Zhang |
Subject: |
Re: [Qemu-devel] [RESEND PATCH 1/2] nvdimm: warn if the backend is not a DAX device |
Date: |
Fri, 26 May 2017 12:30:24 +0800 |
User-agent: |
NeoMutt/20170428 (1.8.2) |
On 05/25/17 20:34 -0700, Dan Williams wrote:
> On Thu, May 25, 2017 at 7:32 PM, Haozhong Zhang
> <address@hidden> wrote:
> > Applications in Linux guest that use device-dax never trigger flush
> > that can be trapped by KVM/QEMU. Meanwhile, if the host backend is not
> > device-dax, QEMU cannot guarantee the persistence of guest writes.
> > Before solving this flushing problem, QEMU should warn users if the
> > host backend is not device-dax.
>
> I think this needs to be stronger than a "warn" it needs to be
> explicitly forbidden when it is known to be unsafe.
>
I understand your worry and am not object to your suggestion, but
forbidden will change the existing behavior that allows such unsafe
usage. Let's wait for other maintainers' comments.
> >
> > Signed-off-by: Haozhong Zhang <address@hidden>
> > Message-id: address@hidden
> > ---
> > Cc: "Michael S. Tsirkin" <address@hidden>
> > Cc: Igor Mammedov <address@hidden>
> > Cc: Xiao Guangrong <address@hidden>
> > Cc: Stefan Hajnoczi <address@hidden>
> > Cc: Dan Williams <address@hidden>
> > ---
> > Resend because the wrong maintainer email address was used.
> > ---
> > hw/mem/nvdimm.c | 37 +++++++++++++++++++++++++++++++++++++
> > 1 file changed, 37 insertions(+)
> >
> > diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> > index db896b0bb6..c7bb407f33 100644
> > --- a/hw/mem/nvdimm.c
> > +++ b/hw/mem/nvdimm.c
> > @@ -26,6 +26,7 @@
> > #include "qapi/error.h"
> > #include "qapi/visitor.h"
> > #include "hw/mem/nvdimm.h"
> > +#include "qemu/error-report.h"
> >
> > static void nvdimm_get_label_size(Object *obj, Visitor *v, const char
> > *name,
> > void *opaque, Error **errp)
> > @@ -78,12 +79,48 @@ static MemoryRegion
> > *nvdimm_get_memory_region(PCDIMMDevice *dimm)
> > return &nvdimm->nvdimm_mr;
> > }
> >
> > +static void nvdimm_check_dax(HostMemoryBackend *hostmem)
> > +{
> > + char *mem_path =
> > + object_property_get_str(OBJECT(hostmem), "mem-path", NULL);
> > + char *dev_name = NULL, *sysfs_path = NULL;
> > + bool is_dax = false;
> > +
> > + if (!mem_path) {
> > + goto out;
> > + }
> > +
> > + if (!g_str_has_prefix(mem_path, "/dev/dax")) {
> > + goto out;
> > + }
>
> What if we're using a symlink to a device-dax instance? The should
> explicitly be looking up the major / minor number of the device (after
> following any symlinks) and verifying that it is device-dax by
> checking /sys/dev/char/$major:$minor refers to a device-dax instance.
>
I'll follow to your suggestion in the next version.
Thanks,
Haozhong
- [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, (continued)
- [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Haozhong Zhang, 2017/05/25
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Marc-André Lureau, 2017/05/26
- Message not available
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Marc-André Lureau, 2017/05/26
- Message not available
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Dan Williams, 2017/05/26
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Eduardo Habkost, 2017/05/26
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Dan Williams, 2017/05/26
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Haozhong Zhang, 2017/05/26
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Paolo Bonzini, 2017/05/30
- Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment, Dan Williams, 2017/05/30
Re: [Qemu-devel] [RESEND PATCH 1/2] nvdimm: warn if the backend is not a DAX device, Dan Williams, 2017/05/25