[PATCH v6 4/5] fs, xfs: introduce MAP_DIRECT for creating block-map-atomic file ranges

2017-08-23 Thread Dan Williams
MAP_DIRECT is an mmap(2) flag with the following semantics: MAP_DIRECT When specified with MAP_SHARED a successful fault in this range indicates that the kernel is maintaining the block map (user linear address to file offset to physical address relationship) in a manner that no external

[PATCH v6 3/5] mm: introduce mmap3 for safely defining new mmap flags

2017-08-23 Thread Dan Williams
The mmap(2) syscall suffers from the ABI anti-pattern of not validating unknown flags. However, proposals like MAP_SYNC and MAP_DIRECT need a mechanism to define new behavior that is known to fail on older kernels without the support. Define a new mmap3 syscall that checks for unsupported flags at

[PATCH v6 2/5] fs, xfs: introduce S_IOMAP_SEALED

2017-08-23 Thread Dan Williams
When a filesystem sees this flag set it will not allow changes to the file-offset to physical-block-offset relationship of any extent in the file. The extent of the extents covered by the global S_IOMAP_SEALED is filesystem specific. In other words it is similar to the inode-wide XFS_DIFLAG2_REFLIN

[PATCH v6 5/5] fs, fcntl: add F_MAP_DIRECT

2017-08-23 Thread Dan Williams
A common pattern for granting a privilege to an unprivileged process is to pass it an established file descriptor over a unix domain socket. This enables fine grained access to the MAP_DIRECT mechanism instead of requiring the mapping process have CAP_LINUX_IMMUTABLE. Cc: Jan Kara Cc: Jeff Moyer

[PATCH v6 1/5] vfs: add flags parameter to ->mmap() in 'struct file_operations'

2017-08-23 Thread Dan Williams
We are running running short of vma->vm_flags. We can avoid needing a new VM_* flag in some cases if the original @flags submitted to mmap(2) is made available to the ->mmap() 'struct file_operations' implementation. For example, the proposed addition of MAP_DIRECT can be implemented without taking

[PATCH v6 0/5] MAP_DIRECT and block-map-atomic files

2017-08-23 Thread Dan Williams
Changes since v5 [1]: * Compile fixes from a much improved coccinelle semantic patch (thanks Julia!) that adds a 'flags' argument to all the ->mmap() implementations in the kernel. (0day-kbuild-robot) * Make the deprecated MAP_DENYWRITE and MAP_EXECUTABLE flags return EOPNOTSUPP with the new

Re: [PATCH 1/2] nfit: Use init_completion() in acpi_nfit_flush_probe()

2017-08-23 Thread Dan Williams
On Wed, Aug 23, 2017 at 8:25 AM, Boqun Feng wrote: > There is no need to use COMPLETION_INITIALIZER_ONSTACK() in > acpi_nfit_flush_probe(), replace it with init_completion(). Now that I see the better version of this patch with the improved changelog in the -mm tree... Acked-by: Dan Williams __

[PATCH v3] Fix ext4 fault handling when mounted with -o dax,ro

2017-08-23 Thread rdodgen
From: Randy Dodgen If an ext4 filesystem is mounted with both the DAX and read-only options, executables on that filesystem will fail to start (claiming 'Segmentation fault') due to the fault handler returning VM_FAULT_SIGBUS. This is due to the DAX fault handler (see ext4_dax_huge_fault) attemp

[PATCH] nvdimm: fix potential double-fetch bug

2017-08-23 Thread Meng Xu
From: Meng Xu While examining the kernel source code, I found a dangerous operation that could turn into a double-fetch situation (a race condition bug) where the same userspace memory region are fetched twice into kernel with sanity checks after the first fetch while missing checks after the sec

Re: [PATCH v2] Fix ext4 fault handling when mounted with -o dax,ro

2017-08-23 Thread Randy Dodgen
That's a nice simplification. I started cautiously by replicating the same checks for dax.c (dax_iomap_pte_fault checks for cow_page specifically). I recall that it used to be possible for COW pages to appear in VM_SHARED mappings, but I'm glad to see that went away in cda540ace6a19. I'll send a ne

Re: [PATCH v5 7/7] libnvdimm: Add blk-mq pmem driver

2017-08-23 Thread Dan Williams
On Wed, Aug 23, 2017 at 12:56 PM, Dave Jiang wrote: > > > On 08/23/2017 11:39 AM, Dan Williams wrote: >> On Mon, Aug 21, 2017 at 2:11 PM, Dave Jiang wrote: >>> Adding a DMA supported blk-mq driver for pmem. >> >> "Add support for offloading pmem block-device I/O operations to a DMA >> engine." >

Re: [PATCH v5 7/7] libnvdimm: Add blk-mq pmem driver

2017-08-23 Thread Dave Jiang
On 08/23/2017 11:39 AM, Dan Williams wrote: > On Mon, Aug 21, 2017 at 2:11 PM, Dave Jiang wrote: >> Adding a DMA supported blk-mq driver for pmem. > > "Add support for offloading pmem block-device I/O operations to a DMA engine." > >> This provides signficant CPU > > *significant > >> utiliz

Re: [PATCH 10/13] mm: Wire up MAP_SYNC

2017-08-23 Thread Christoph Hellwig
On Thu, Aug 17, 2017 at 06:08:12PM +0200, Jan Kara wrote: > Pretty crude for now... > > Signed-off-by: Jan Kara > --- > fs/ext4/file.c | 2 ++ > include/linux/mm.h | 1 + > include/linux/mman.h| 3 ++- > include/uapi/asm-generic/mman.h | 1 + > mm/mmap.c

Re: [PATCH v5 7/7] libnvdimm: Add blk-mq pmem driver

2017-08-23 Thread Dan Williams
On Mon, Aug 21, 2017 at 2:11 PM, Dave Jiang wrote: > Adding a DMA supported blk-mq driver for pmem. "Add support for offloading pmem block-device I/O operations to a DMA engine." > This provides signficant CPU *significant > utilization reduction. "at the cost of some increased latency and ba

Re: [PATCH 13/13] ext4: Support for synchronous DAX faults

2017-08-23 Thread Christoph Hellwig
> + pfn_t pfn; > > if (write) { > sb_start_pagefault(sb); > @@ -287,16 +288,39 @@ static int ext4_dax_huge_fault(struct vm_fault *vmf, > down_read(&EXT4_I(inode)->i_mmap_sem); > handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, >

Re: [PATCH 09/13] dax: Allow dax_iomap_fault() to return pfn

2017-08-23 Thread Christoph Hellwig
> @@ -1416,6 +1416,7 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf, > * @vmf: The description of the fault > * @pe_size: Size of the page to fault in > * @ops: Iomap ops passed from the file system > + * @pfnp: PFN to insert for synchronous faults if fsync is required > * > * Whe

Re: [PATCH 08/13] dax: Fix comment describing dax_iomap_fault()

2017-08-23 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm

Re: [PATCH 07/13] dax: Inline dax_pmd_insert_mapping() into the callsite

2017-08-23 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm

Re: [PATCH 06/13] dax: Inline dax_insert_mapping() into the callsite

2017-08-23 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm

Re: [PATCH 05/13] dax: Create local variable for vmf->flags & FAULT_FLAG_WRITE test

2017-08-23 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm

Re: [PATCH 04/13] dax: Create local variable for VMA in dax_iomap_pte_fault()

2017-08-23 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm

Re: [PATCH 03/13] dax: Factor out getting of pfn out of iomap

2017-08-23 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm

[PATCH v3] ndctl: daxctl: Adding io option for daxctl

2017-08-23 Thread Dave Jiang
The daxctl io option allows I/Os to be performed between file descriptor to and from device dax files. It also provides a way to zero a device dax device. i.e. daxctl io --input=/home/myfile --output=/dev/dax1.0 Signed-off-by: Dave Jiang --- v3: - Added support for size suffix suggested by Ross

Re: [PATCH v6 6/6] libnvdimm, btt: rework error clearing

2017-08-23 Thread Kani, Toshimitsu
On Tue, 2017-08-22 at 16:19 -0600, Vishal Verma wrote: : > + > + /* The block had a media error, and needs to be > cleared */ > + if (btt_is_badblock(btt, arena, arena- > >freelist[lane].block)) { > + arena->freelist[lane].has_err = 1; > +

Re: [PATCH v2] ndctl: daxctl: Adding io option for daxctl

2017-08-23 Thread Dan Williams
On Wed, Aug 23, 2017 at 9:47 AM, Ross Zwisler wrote: > On Tue, Aug 22, 2017 at 05:06:15PM -0700, Dave Jiang wrote: >> The daxctl io option allows I/Os to be performed between file descriptor to >> and from device dax files. It also provides a way to zero a device dax >> device. >> >> i.e. daxctl i

Re: [PATCH v2] ndctl: daxctl: Adding io option for daxctl

2017-08-23 Thread Ross Zwisler
On Tue, Aug 22, 2017 at 05:06:15PM -0700, Dave Jiang wrote: > The daxctl io option allows I/Os to be performed between file descriptor to > and from device dax files. It also provides a way to zero a device dax > device. > > i.e. daxctl io --input=/home/myfile --output=/dev/dax1.0 > > Signed-off-

Re: [PATCH v2] Fix ext4 fault handling when mounted with -o dax,ro

2017-08-23 Thread Ross Zwisler
On Tue, Aug 22, 2017 at 08:37:04PM -0700, rdod...@gmail.com wrote: > From: Randy Dodgen > > If an ext4 filesystem is mounted with both the DAX and read-only > options, executables on that filesystem will fail to start (claiming > 'Segmentation fault') due to the fault handler returning > VM_FAULT

Re: [PATCH v2 1/2] dax: fix deadlock due to misaligned PMD faults

2017-08-23 Thread Ross Zwisler
On Wed, Aug 23, 2017 at 11:57:33AM +0200, Jan Kara wrote: > On Tue 22-08-17 16:24:35, Ross Zwisler wrote: > > In DAX there are two separate places where the 2MiB range of a PMD is > > defined. > > > > The first is in the page tables, where a PMD mapping inserted for a given > > address spans from

[PATCH 1/2] nfit: Use init_completion() in acpi_nfit_flush_probe()

2017-08-23 Thread Boqun Feng
There is no need to use COMPLETION_INITIALIZER_ONSTACK() in acpi_nfit_flush_probe(), replace it with init_completion(). Signed-off-by: Boqun Feng --- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c i

Re: [PATCH v2 2/2] dax: use PG_PMD_COLOUR instead of open coding

2017-08-23 Thread Jan Kara
On Tue 22-08-17 16:24:36, Ross Zwisler wrote: > Use ~PG_PMD_COLOUR in dax_entry_waitqueue() instead of open coding an > equivalent page offset mask. > > Signed-off-by: Ross Zwisler Looks good. You can add: Reviewed-by: Jan Kara H

Re: [PATCH v2 1/2] dax: fix deadlock due to misaligned PMD faults

2017-08-23 Thread Jan Kara
On Tue 22-08-17 16:24:35, Ross Zwisler wrote: > In DAX there are two separate places where the 2MiB range of a PMD is > defined. > > The first is in the page tables, where a PMD mapping inserted for a given > address spans from (vmf->address & PMD_MASK) to > ((vmf->address & PMD_MASK) + PMD_SIZE -