On Fri, May 10, 2019 at 5:45 PM Pankaj Gupta <pagupta at redhat.com> wrote:> > > > > > > > > This patch adds 'DAXDEV_SYNC' flag which is set > > > for nd_region doing synchronous flush. This later > > > is used to disable MAP_SYNC functionality for > > > ext4 & xfs filesystem for devices don't support > > > synchronous flush. > > > > > > Signed-off-by: Pankaj Gupta <pagupta at redhat.com> > > > --- > > > drivers/dax/bus.c | 2 +- > > > drivers/dax/super.c | 13 ++++++++++++- > > > drivers/md/dm.c | 3 ++- > > > drivers/nvdimm/pmem.c | 5 ++++- > > > drivers/nvdimm/region_devs.c | 7 +++++++ > > > include/linux/dax.h | 8 ++++++-- > > > include/linux/libnvdimm.h | 1 + > > > 7 files changed, 33 insertions(+), 6 deletions(-) > > [..] > > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > > > index 043f0761e4a0..ee007b75d9fd 100644 > > > --- a/drivers/md/dm.c > > > +++ b/drivers/md/dm.c > > > @@ -1969,7 +1969,8 @@ static struct mapped_device *alloc_dev(int minor) > > > sprintf(md->disk->disk_name, "dm-%d", minor); > > > > > > if (IS_ENABLED(CONFIG_DAX_DRIVER)) { > > > - dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops); > > > + dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops, > > > + DAXDEV_F_SYNC); > > > > Apologies for not realizing this until now, but this is broken. > > Imaging a device-mapper configuration composed of both 'async' > > virtio-pmem and 'sync' pmem. The 'sync' flag needs to be unified > > across all members. I would change this argument to '0' and then > > arrange for it to be set at dm_table_supports_dax() time after > > validating that all components support synchronous dax. > > o.k. Need to set 'DAXDEV_F_SYNC' flag after verifying all the target > components support synchronous DAX. > > Just a question, If device mapper configuration have composed of both > virtio-pmem or pmem devices, we want to configure device mapper for async flush?If it's composed of both then, yes, it needs to be async flush at the device-mapper level. Otherwise MAP_SYNC will succeed and fail to trigger fsync on the host file when necessary for the virtio-pmem backed portion of the device-mapper device.
Pankaj Gupta
2019-May-11 01:23 UTC
[Qemu-devel] [PATCH v8 3/6] libnvdimm: add dax_dev sync flag
> > > > > > > > This patch adds 'DAXDEV_SYNC' flag which is set > > > > for nd_region doing synchronous flush. This later > > > > is used to disable MAP_SYNC functionality for > > > > ext4 & xfs filesystem for devices don't support > > > > synchronous flush. > > > > > > > > Signed-off-by: Pankaj Gupta <pagupta at redhat.com> > > > > --- > > > > drivers/dax/bus.c | 2 +- > > > > drivers/dax/super.c | 13 ++++++++++++- > > > > drivers/md/dm.c | 3 ++- > > > > drivers/nvdimm/pmem.c | 5 ++++- > > > > drivers/nvdimm/region_devs.c | 7 +++++++ > > > > include/linux/dax.h | 8 ++++++-- > > > > include/linux/libnvdimm.h | 1 + > > > > 7 files changed, 33 insertions(+), 6 deletions(-) > > > [..] > > > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > > > > index 043f0761e4a0..ee007b75d9fd 100644 > > > > --- a/drivers/md/dm.c > > > > +++ b/drivers/md/dm.c > > > > @@ -1969,7 +1969,8 @@ static struct mapped_device *alloc_dev(int minor) > > > > sprintf(md->disk->disk_name, "dm-%d", minor); > > > > > > > > if (IS_ENABLED(CONFIG_DAX_DRIVER)) { > > > > - dax_dev = alloc_dax(md, md->disk->disk_name, > > > > &dm_dax_ops); > > > > + dax_dev = alloc_dax(md, md->disk->disk_name, > > > > &dm_dax_ops, > > > > + > > > > DAXDEV_F_SYNC); > > > > > > Apologies for not realizing this until now, but this is broken. > > > Imaging a device-mapper configuration composed of both 'async' > > > virtio-pmem and 'sync' pmem. The 'sync' flag needs to be unified > > > across all members. I would change this argument to '0' and then > > > arrange for it to be set at dm_table_supports_dax() time after > > > validating that all components support synchronous dax. > > > > o.k. Need to set 'DAXDEV_F_SYNC' flag after verifying all the target > > components support synchronous DAX. > > > > Just a question, If device mapper configuration have composed of both > > virtio-pmem or pmem devices, we want to configure device mapper for async > > flush? > > If it's composed of both then, yes, it needs to be async flush at the > device-mapper level. Otherwise MAP_SYNC will succeed and fail to > trigger fsync on the host file when necessary for the virtio-pmem > backed portion of the device-mapper device.o.k. Agree. Thanks you, Pankaj> >
Pankaj Gupta
2019-May-13 17:32 UTC
[Qemu-devel] [PATCH v8 3/6] libnvdimm: add dax_dev sync flag
Hi Dan, While testing device mapper with DAX, I faced a bug with the commit: commit ad428cdb525a97d15c0349fdc80f3d58befb50df Author: Dan Williams <dan.j.williams at intel.com> Date: Wed Feb 20 21:12:50 2019 -0800 When I reverted the condition to old code[1] it worked for me. I am thinking when we map two different devices (e.g with device mapper), will start & end pfn still point to same pgmap? Or there is something else which I am missing here. Note: I tested only EXT4. [1] - if (pgmap && pgmap->type == MEMORY_DEVICE_FS_DAX) + end_pgmap = get_dev_pagemap(pfn_t_to_pfn(end_pfn), NULL); + if (pgmap && pgmap == end_pgmap && pgmap->type == MEMORY_DEVICE_FS_DAX + && pfn_t_to_page(pfn)->pgmap == pgmap + && pfn_t_to_page(end_pfn)->pgmap == pgmap + && pfn_t_to_pfn(pfn) == PHYS_PFN(__pa(kaddr)) + && pfn_t_to_pfn(end_pfn) == PHYS_PFN(__pa(end_kaddr))) dax_enabled = true; put_dev_pagemap(pgmap); Thanks, Pankaj
Maybe Matching Threads
- [Qemu-devel] [PATCH v8 3/6] libnvdimm: add dax_dev sync flag
- [PATCH v8 3/6] libnvdimm: add dax_dev sync flag
- [Qemu-devel] [PATCH v8 3/6] libnvdimm: add dax_dev sync flag
- [PATCH] mm: remove extra ZONE_DEVICE struct page refcount
- dev_pagemap related cleanups v3