[PATCH v6 7/7] fs/xfs: Add dax dedupe support

2021-05-18 Thread Shiyang Ruan
Introduce xfs_mmaplock_two_inodes_and_break_dax_layout() for dax files who are going to be deduped. After that, call compare range function only when files are both DAX or not. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_file.c| 2 +- fs/xfs/xfs_inode.c | 57 ++

[PATCH v6 6/7] fs/xfs: Handle CoW for fsdax write() path

2021-05-18 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After CoW, new allocated extents needs to be remapped to the file. So, add an iomap_end for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 3 +-- fs/xfs/xfs_file.c | 9 +

[PATCH v6 4/7] iomap: Introduce iomap_apply2() for operations on two files

2021-05-18 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan Reviewed-by: Darri

[PATCH v6 5/7] fsdax: Dedup file range to use a compare function

2021-05-18 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton which is similar with vfs_dedupe_file_range_compare(). And introduce dax_remap_file_range_prep() for filesystem use. Signed-off-by: Goldwyn Rodrigues Signed-off-by: Shiyang Ruan --- fs/dax.c | 66 ++

[PATCH v6 3/7] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-05-18 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_copy_edge() too. Otherwise, data in not aligned area will be not correct. So, add the srcmap to dax_iomap_zero() and replace memset() as dax_copy_edge(). Signed-off-by: Shiyang Ruan Reviewed-by: Ritesh Harjani --- fs/dax.c | 25 ++

[PATCH v6 2/7] fsdax: Replace mmap entry in case of CoW

2021-05-18 Thread Shiyang Ruan
We replace the existing entry to the newly allocated one in case of CoW. Also, we mark the entry as PAGECACHE_TAG_TOWRITE so writeback marks this entry as writeprotected. This helps us snapshots so new write pagefaults after snapshots trigger a CoW. Signed-off-by: Goldwyn Rodrigues Signed-off-by

[PATCH v6 1/7] fsdax: Introduce dax_iomap_cow_copy()

2021-05-18 Thread Shiyang Ruan
In the case where the iomap is a write operation and iomap is not equal to srcmap after iomap_begin, we consider it is a CoW operation. The destance extent which iomap indicated is new allocated extent. So, it is needed to copy the data from srcmap to new allocated extent. In theory, it is better

[PATCH v6 0/7] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-05-18 Thread Shiyang Ruan
This patchset is attempt to add CoW support for fsdax, and take XFS, which has both reflink and fsdax feature, as an example. Changes from V5: - Fix the lock order of xfs_inode in xfs_mmaplock_two_inodes_and_break_dax_layout() - move dax_remap_file_range_prep() to fs/dax.c - change type of len

Re: [PATCH v19 6/8] PM: hibernate: disable when there are active secretmem users

2021-05-18 Thread James Bottomley
On Tue, 2021-05-18 at 18:49 -0700, Dan Williams wrote: > On Tue, May 18, 2021 at 6:33 PM James Bottomley > wrote: > > On Tue, 2021-05-18 at 11:24 +0100, Mark Rutland wrote: > > > On Thu, May 13, 2021 at 09:47:32PM +0300, Mike Rapoport wrote: > > > > From: Mike Rapoport > > > > > > > > It is unsa

Re: [PATCH v20 4/7] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Mike Rapoport
On Tue, May 18, 2021 at 05:44:22PM -0700, Andrew Morton wrote: > On Tue, 18 May 2021 10:20:31 +0300 Mike Rapoport wrote: > > > From: Mike Rapoport > > > > Introduce "memfd_secret" system call with the ability to create memory > > areas visible only in the context of the owning process and not m

Re: [PATCH v19 6/8] PM: hibernate: disable when there are active secretmem users

2021-05-18 Thread Dan Williams
On Tue, May 18, 2021 at 6:33 PM James Bottomley wrote: > > On Tue, 2021-05-18 at 11:24 +0100, Mark Rutland wrote: > > On Thu, May 13, 2021 at 09:47:32PM +0300, Mike Rapoport wrote: > > > From: Mike Rapoport > > > > > > It is unsafe to allow saving of secretmem areas to the hibernation > > > snaps

Re: [PATCH v19 6/8] PM: hibernate: disable when there are active secretmem users

2021-05-18 Thread James Bottomley
On Tue, 2021-05-18 at 11:24 +0100, Mark Rutland wrote: > On Thu, May 13, 2021 at 09:47:32PM +0300, Mike Rapoport wrote: > > From: Mike Rapoport > > > > It is unsafe to allow saving of secretmem areas to the hibernation > > snapshot as they would be visible after the resume and this > > essentiall

Re: [PATCH v20 4/7] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Andrew Morton
On Tue, 18 May 2021 10:20:31 +0300 Mike Rapoport wrote: > From: Mike Rapoport > > Introduce "memfd_secret" system call with the ability to create memory > areas visible only in the context of the owning process and not mapped not > only to other processes but in the kernel page tables as well.

Re: [ndctl PATCH] ndctl: Update nvdimm mailing list address

2021-05-18 Thread Dan Williams
On Tue, May 18, 2021 at 3:26 PM Vishal Verma wrote: > > The 'nvdimm' mailing list has moved from lists.01.org to > lists.linux.dev. Update CONTRIBUTING.md and configure.ac to reflect > this. LGTM Reviewed-by: Dan Williams

[ndctl PATCH] ndctl: Update nvdimm mailing list address

2021-05-18 Thread Vishal Verma
The 'nvdimm' mailing list has moved from lists.01.org to lists.linux.dev. Update CONTRIBUTING.md and configure.ac to reflect this. Cc: Dan Williams Signed-off-by: Vishal Verma --- configure.ac| 2 +- CONTRIBUTING.md | 7 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a

Re: [PATCH v1 04/11] mm/memremap: add ZONE_DEVICE support for compound pages

2021-05-18 Thread Jane Chu
On 5/18/2021 10:27 AM, Joao Martins wrote: On 5/5/21 11:36 PM, Joao Martins wrote: On 5/5/21 11:20 PM, Dan Williams wrote: On Wed, May 5, 2021 at 12:50 PM Joao Martins wrote: On 5/5/21 7:44 PM, Dan Williams wrote: On Thu, Mar 25, 2021 at 4:10 PM Joao Martins wrote: diff --git a/include/li

Re: [PATCH v1 04/11] mm/memremap: add ZONE_DEVICE support for compound pages

2021-05-18 Thread Joao Martins
On 5/5/21 11:36 PM, Joao Martins wrote: > On 5/5/21 11:20 PM, Dan Williams wrote: >> On Wed, May 5, 2021 at 12:50 PM Joao Martins >> wrote: >>> On 5/5/21 7:44 PM, Dan Williams wrote: On Thu, Mar 25, 2021 at 4:10 PM Joao Martins wrote: > diff --git a/include/linux/memremap.h b/incl

Re: [PATCH v19 5/8] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Michal Hocko
On Tue 18-05-21 12:35:36, David Hildenbrand wrote: > On 18.05.21 12:31, Michal Hocko wrote: > > On Tue 18-05-21 12:06:42, David Hildenbrand wrote: > > > On 18.05.21 11:59, Michal Hocko wrote: > > > > On Sun 16-05-21 10:29:24, Mike Rapoport wrote: > > > > > On Fri, May 14, 2021 at 11:25:43AM +0200,

Re: [PATCH v19 5/8] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Michal Hocko
On Tue 18-05-21 12:06:42, David Hildenbrand wrote: > On 18.05.21 11:59, Michal Hocko wrote: > > On Sun 16-05-21 10:29:24, Mike Rapoport wrote: > > > On Fri, May 14, 2021 at 11:25:43AM +0200, David Hildenbrand wrote: > > [...] > > > > > + if (!page) > > > > > + return

Re: [PATCH v19 5/8] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Michal Hocko
On Sun 16-05-21 10:29:24, Mike Rapoport wrote: > On Fri, May 14, 2021 at 11:25:43AM +0200, David Hildenbrand wrote: [...] > > > + if (!page) > > > + return VM_FAULT_OOM; > > > + > > > + err = set_direct_map_invalid_noflush(page, 1); > > > + if (err) { > > > +

Re: [PATCH v19 5/8] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread David Hildenbrand
On 18.05.21 12:31, Michal Hocko wrote: On Tue 18-05-21 12:06:42, David Hildenbrand wrote: On 18.05.21 11:59, Michal Hocko wrote: On Sun 16-05-21 10:29:24, Mike Rapoport wrote: On Fri, May 14, 2021 at 11:25:43AM +0200, David Hildenbrand wrote: [...] + if (!page) +

Re: [PATCH v19 6/8] PM: hibernate: disable when there are active secretmem users

2021-05-18 Thread David Hildenbrand
On 18.05.21 12:24, Mark Rutland wrote: On Thu, May 13, 2021 at 09:47:32PM +0300, Mike Rapoport wrote: From: Mike Rapoport It is unsafe to allow saving of secretmem areas to the hibernation snapshot as they would be visible after the resume and this essentially will defeat the purpose of secret

Re: [PATCH v19 6/8] PM: hibernate: disable when there are active secretmem users

2021-05-18 Thread Mark Rutland
On Thu, May 13, 2021 at 09:47:32PM +0300, Mike Rapoport wrote: > From: Mike Rapoport > > It is unsafe to allow saving of secretmem areas to the hibernation > snapshot as they would be visible after the resume and this essentially > will defeat the purpose of secret memory mappings. > > Prevent h

Re: [PATCH v19 5/8] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread David Hildenbrand
On 18.05.21 11:59, Michal Hocko wrote: On Sun 16-05-21 10:29:24, Mike Rapoport wrote: On Fri, May 14, 2021 at 11:25:43AM +0200, David Hildenbrand wrote: [...] + if (!page) + return VM_FAULT_OOM; + + err = set_direct_map_invalid_noflush(page, 1)

[PATCH v20 7/7] secretmem: test: add basic selftest for memfd_secret(2)

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport The test verifies that file descriptor created with memfd_secret does not allow read/write operations, that secret memory mappings respect RLIMIT_MEMLOCK and that remote accesses with process_vm_read() and ptrace() to the secret memory fail. Signed-off-by: Mike Rapoport Acke

[PATCH v20 6/7] arch, mm: wire up memfd_secret system call where relevant

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport Wire up memfd_secret system call on architectures that define ARCH_HAS_SET_DIRECT_MAP, namely arm64, risc-v and x86. Signed-off-by: Mike Rapoport Acked-by: Palmer Dabbelt Acked-by: Arnd Bergmann Acked-by: Catalin Marinas Acked-by: David Hildenbrand Acked-by: James Bottom

[PATCH v20 5/7] PM: hibernate: disable when there are active secretmem users

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport It is unsafe to allow saving of secretmem areas to the hibernation snapshot as they would be visible after the resume and this essentially will defeat the purpose of secret memory mappings. Prevent hibernation whenever there are active secret memory users. Signed-off-by: Mik

[PATCH v20 4/7] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport Introduce "memfd_secret" system call with the ability to create memory areas visible only in the context of the owning process and not mapped not only to other processes but in the kernel page tables as well. The secretmem feature is off by default and the user must explicitl

[PATCH v20 3/7] set_memory: allow querying whether set_direct_map_*() is actually enabled

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport On arm64, set_direct_map_*() functions may return 0 without actually changing the linear map. This behaviour can be controlled using kernel parameters, so we need a way to determine at runtime whether calls to set_direct_map_invalid_noflush() and set_direct_map_default_noflus

[PATCH v20 2/7] riscv/Kconfig: make direct map manipulation options depend on MMU

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport ARCH_HAS_SET_DIRECT_MAP and ARCH_HAS_SET_MEMORY configuration options have no meaning when CONFIG_MMU is disabled and there is no point to enable them for the nommu case. Add an explicit dependency on MMU for these options. Signed-off-by: Mike Rapoport Reported-by: kernel t

[PATCH v20 1/7] mmap: make mlock_future_check() global

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport It will be used by the upcoming secret memory implementation. Signed-off-by: Mike Rapoport Reviewed-by: David Hildenbrand Acked-by: James Bottomley Cc: Alexander Viro Cc: Andy Lutomirski Cc: Arnd Bergmann Cc: Borislav Petkov Cc: Catalin Marinas Cc: Christopher Lameter

[PATCH v20 0/7] mm: introduce memfd_secret system call to create "secret" memory areas

2021-05-18 Thread Mike Rapoport
From: Mike Rapoport Hi, @Andrew, this is based on v5.13-rc1, I can rebase whatever way you prefer. This is an implementation of "secret" mappings backed by a file descriptor. The file descriptor backing secret memory mappings is created using a dedicated memfd_secret system call The desired pr