[RFC PATCH 11/15] memremap: Add zone device access protection

2020-07-14 Thread ira . weiny
From: Ira Weiny Device managed memory exposes itself to the kernel direct map which allows stray pointers to access these device memories. Stray pointers to normal memory may result in a crash or other undesirable behavior which, while unfortunate, are usually recoverable with a reboot. Stray

[RFC PATCH 03/15] x86/pks: Enable Protection Keys Supervisor (PKS)

2020-07-14 Thread ira . weiny
and then enable PKS when configured and indicated by the CPU instance. While not strictly necessary in this patch, ARCH_HAS_SUPERVISOR_PKEYS separates this functionality through the patch series so it is introduced here. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu

[RFC PATCH 01/15] x86/pkeys: Create pkeys_internal.h

2020-07-14 Thread ira . weiny
From: Ira Weiny Protection Keys User (PKU) and Protection Keys Supervisor (PKS) work in similar fashions. Share code between them by creating a header with common defines, move those defines into this header, change their names to reflect the new use, and include the header where needed

[RFC PATCH 05/15] x86/pks: Add PKS kernel API

2020-07-14 Thread ira . weiny
.) Finally, pks_key_free() allows a user to return the key to the allocator for use by others. The interface maintains Access Disabled (AD=1) for all keys not currently allocated. Therefore, the user can depend on access being disabled when pks_key_alloc() returns a key. Co-developed-by: Ira Weiny

[RFC PATCH 14/15] nvdimm/pmem: Stray write protection for pmem->virt_addr

2020-07-14 Thread ira . weiny
From: Ira Weiny The pmem driver uses a cached virtual address to access its memory directly. Because the nvdimm driver is well aware of the special protections it has mapped memory with, we call dev_access_[en|dis]able() around the direct pmem->virt_addr (pmem_addr) usage inst

[RFC PATCH 10/15] drivers/dax: Expand lock scope to cover the use of addresses

2020-07-14 Thread ira . weiny
From: Ira Weiny The addition of PKS protection to dax read lock/unlock will require that the address returned by dax_direct_access() be protected by this lock. While not technically necessary for this series, this corrects the locking by ensuring that the use of kaddr and end_kaddr are covered

[RFC PATCH 12/15] kmap: Add stray write protection for device pages

2020-07-14 Thread ira . weiny
From: Ira Weiny Device managed pages may have additional protections. These protections need to be removed prior to valid use by kernel users. Check for special treatment of device managed pages in kmap and take action if needed. We use kmap as an interface for generic kernel code because

[RFC PATCH 13/15] dax: Stray write protection for dax_direct_access()

2020-07-14 Thread ira . weiny
From: Ira Weiny dax_direct_access() is a special case of accessing pmem via a page offset and without a struct page. Because the dax driver is well aware of the special protections it has mapped memory with, call dev_access_[en|dis]able() directly instead of the unnecessary overhead of trying

[RFC PATCH 07/15] Documentation/pkeys: Update documentation for kernel pkeys

2020-07-14 Thread ira . weiny
From: Ira Weiny Future Intel CPUS will support Protection Key Supervisor (PKS). Update the protection key documentation to cover pkeys on supervisor pages. Signed-off-by: Ira Weiny --- Documentation/core-api/protection-keys.rst | 81 +- 1 file changed, 63 insertions

[RFC PATCH 09/15] fs/dax: Remove unused size parameter

2020-07-14 Thread ira . weiny
From: Ira Weiny Passing size to copy_user_dax implies it can copy variable sizes of data when in fact it calls copy_user_page() which is exactly a page. We are safe because the only caller uses PAGE_SIZE anyway so just remove the variable for clarity. While we are at it change copy_user_dax

[RFC PATCH 15/15] [dax|pmem]: Enable stray write protection

2020-07-14 Thread ira . weiny
From: Ira Weiny Protecting against stray writes is particularly important for PMEM because, unlike writes to anonymous memory, writes to PMEM persists across a reboot. Thus data corruption could result in permanent loss of data. Therefore, there is no option presented to the user. Enable

[RFC PATCH 06/15] x86/pks: Add a debugfs file for allocated PKS keys

2020-07-14 Thread ira . weiny
From: Fenghua Yu The sysadmin may need to know which PKS keys are currently being used. Add a debugfs file to show the allocated PKS keys and their names. Signed-off-by: Fenghua Yu --- arch/x86/mm/pkeys.c | 40 1 file changed, 40 insertions(+) diff

[RFC PATCH 00/15] PKS: Add Protection Keys Supervisor (PKS) support

2020-07-14 Thread ira . weiny
From: Ira Weiny This RFC series has been reviewed by Dave Hansen. This patch set introduces a new page protection mechanism for supervisor pages, Protection Key Supervisor (PKS) and an initial user of them, persistent memory, PMEM. PKS enables protections on 'domains' of supervisor pages

[RFC PATCH 02/15] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support

2020-07-14 Thread ira . weiny
From: Fenghua Yu Define a helper, get_new_pkr(), which will be used to support both Protection Key User (PKU) and the new Protection Key for Supervisor (PKS) in subsequent patches. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu --- arch/x86/include/asm/pkeys.h

[RFC PATCH 08/15] x86/pks: Add PKS Test code

2020-07-14 Thread ira . weiny
From: Ira Weiny The core PKS functionality provides an interface for kernel users to reserve keys to their domains set up the page tables with those keys and control access to those domains when needed. Define test code which exercises the core functionality of PKS via a debugfs entry. Basic

Re: [PATCH 13/17] Documentation/driver-api: nvdimm: drop doubled word

2020-07-06 Thread Ira Weiny
On Fri, Jul 03, 2020 at 08:44:58PM -0700, Randy Dunlap wrote: > Drop the doubled word "to". > > Signed-off-by: Randy Dunlap > Cc: Jonathan Corbet > Cc: linux-...@vger.kernel.org > Cc: Dan Williams > Cc: Vishal Verma > Cc: Dave Jiang > Cc: Ira Weiny

Re: [PATCH v2 2/3] x86, sched: Bail out of frequency invariance if turbo frequency is unknown

2020-07-06 Thread Ira Weiny
ition > > scale-invariant calculations can't be performed. > > > > Signed-off-by: Giovanni Gherdovich > > Suggested-by: Ricardo Neri > > FWIW, > > Tested-by: Ricardo Neri Is this going to make it as a fix to 5.8? Tested-by: Ira Weiny

Re: [PATCH -next] device-dax: make dev_dax_kmem_probe() static

2020-07-10 Thread Ira Weiny
t static. > > Signed-off-by: Wei Yongjun Seems ok, Reviewed-by: Ira Weiny > --- > drivers/dax/kmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c > index 275aa5f87399..87e271668170 100644 > ---

Re: DMA Engine: Transfer From Userspace

2020-06-26 Thread Ira Weiny
On Thu, Jun 25, 2020 at 10:11:28AM +0200, Thomas Ruf wrote: > > > On 25 June 2020 at 02:42 Dave Jiang wrote: > > > > > > > > > > On 6/21/2020 12:24 AM, Vinod Koul wrote: > > > On 19-06-20, 16:31, Dave Jiang wrote: > > >> > > >> > > >> On 6/19/2020 3:47 PM, Federico Vaga wrote: > > >>> Hello,

Re: [PATCH][next] nvdimm/region: Use struct_size() in kzalloc()

2020-06-19 Thread Ira Weiny
> Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83 > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Ira Weiny > --- > drivers/nvdimm/region_devs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/nvdimm/region_devs.c

Re: [PATCH V3 7/8] fs/ext4: Introduce DAX inode flag

2020-05-20 Thread Ira Weiny
On Wed, May 20, 2020 at 04:11:38PM +0200, Jan Kara wrote: > On Tue 19-05-20 22:57:52, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. > > > > Set the flag to be user visible and changeable. Set the

Re: [PATCH V3 4/8] fs/ext4: Update ext4_should_use_dax()

2020-05-20 Thread Ira Weiny
On Wed, May 20, 2020 at 03:37:28PM +0200, Jan Kara wrote: > On Tue 19-05-20 22:57:49, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > S_DAX should only be enabled when the underlying block device supports > > dax. > > > > Change ext4_should_use_

Re: [PATCH V3 7/8] fs/ext4: Introduce DAX inode flag

2020-05-20 Thread Ira Weiny
On Wed, May 20, 2020 at 01:26:44PM -0600, Andreas Dilger wrote: > On May 19, 2020, at 11:57 PM, ira.we...@intel.com wrote: > > > > From: Ira Weiny > > > > Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. > > > > Set the flag to be use

Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice

2020-05-21 Thread Ira Weiny
On Tue, May 19, 2020 at 12:42:15PM -0700, Guenter Roeck wrote: > > On Tue, May 19, 2020 at 09:54:22AM -0700, Guenter Roeck wrote: > > > as do the nosmp sparc32 boot tests, > > > but sparc32 boot tests with SMP enabled still fail with lots of messages > > > such as: > > > > > > BUG: Bad page state

Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice

2020-05-21 Thread Ira Weiny
On Thu, May 21, 2020 at 09:05:41AM -0700, Guenter Roeck wrote: > On 5/19/20 10:13 PM, Ira Weiny wrote: > > On Tue, May 19, 2020 at 12:42:15PM -0700, Guenter Roeck wrote: > >> On Tue, May 19, 2020 at 11:40:32AM -0700, Ira Weiny wrote: > >>> On Tue, May 19, 2020 at 0

[PATCH V4 1/8] fs/ext4: Narrow scope of DAX check in setflags

2020-05-21 Thread ira . weiny
From: Ira Weiny When preventing DAX and journaling on an inode. Use the effective DAX check rather than the mount option. This will be required to support per inode DAX flags. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- fs/ext4/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH V4 0/8] Enable ext4 support for per-file/directory DAX operations

2020-05-21 Thread ira . weiny
From: Ira Weiny Changes from V3: Change EXT4_DAX_FL to bit24 Cache device DAX support in the super block and use that is ext4_should_use_dax() Changes from V2: Rework DAX exclusivity with verity and encryption based on feedback from Eric Enable

[PATCH V4 5/8] fs/ext4: Only change S_DAX on inode load

2020-05-21 Thread ira . weiny
From: Ira Weiny To prevent complications with in memory inodes we only set S_DAX on inode load. FS_XFLAG_DAX can be changed at any time and S_DAX will change after inode eviction and reload. Add init bool to ext4_set_inode_flags() to indicate if the inode is being newly initialized. Assert

[PATCH V4 6/8] fs/ext4: Make DAX mount option a tri-state

2020-05-21 Thread ira . weiny
From: Ira Weiny We add 'always', 'never', and 'inode' (default). '-o dax' continues to operate the same which is equivalent to 'always'. This new functionality is limited to ext4 only. Specifically we introduce a 2nd DAX mount flag EXT4_MOUNT2_DAX_NEVER and set it and EXT4_MOUNT_DAX_ALWAYS

[PATCH V4 2/8] fs/ext4: Disallow verity if inode is DAX

2020-05-21 Thread ira . weiny
From: Ira Weiny Verity and DAX are incompatible. Changing the DAX mode due to a verity flag change is wrong without a corresponding address_space_operations update. Make the 2 options mutually exclusive by returning an error if DAX was set first. (Setting DAX is already disabled if Verity

[PATCH V4 3/8] fs/ext4: Change EXT4_MOUNT_DAX to EXT4_MOUNT_DAX_ALWAYS

2020-05-21 Thread ira . weiny
From: Ira Weiny In prep for the new tri-state mount option which then introduces EXT4_MOUNT_DAX_NEVER. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- Changes: New patch --- fs/ext4/ext4.h | 4 ++-- fs/ext4/inode.c | 2 +- fs/ext4/super.c | 12 ++-- 3 files changed, 9

[PATCH V4 4/8] fs/ext4: Update ext4_should_use_dax()

2020-05-21 Thread ira . weiny
From: Ira Weiny S_DAX should only be enabled when the underlying block device supports dax. Cache the underlying support for DAX in the super block and modify ext4_should_use_dax() to check for device support prior to the over riding mount option. While we are at it change the function

[PATCH V4 8/8] Documentation/dax: Update DAX enablement for ext4

2020-05-21 Thread ira . weiny
From: Ira Weiny Update the document to reflect ext4 and xfs now behave the same. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- Changes from RFC: Update with ext2 text... --- Documentation/filesystems/dax.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH V4 7/8] fs/ext4: Introduce DAX inode flag

2020-05-21 Thread ira . weiny
From: Ira Weiny Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. Set the flag to be user visible and changeable. Set the flag to be inherited. Allow applications to change the flag at any time with the exception of if VERITY or ENCRYPT is set. Disallow setting VERITY or ENCRYPT if DAX

Re: [RESEND PATCH v7 3/5] powerpc/papr_scm: Fetch nvdimm health information from PHYP

2020-05-21 Thread Ira Weiny
On Wed, May 20, 2020 at 10:45:58PM +0530, Vaibhav Jain wrote: ... > > On Wed, May 20, 2020 at 12:30:56AM +0530, Vaibhav Jain wrote: ... > >> @@ -39,6 +78,15 @@ struct papr_scm_priv { > >>struct resource res; > >>struct nd_region *region; > >>struct nd_interleave_set nd_set; > >> + >

Re: [RESEND PATCH v9 3/5] powerpc/papr_scm: Fetch nvdimm health information from PHYP

2020-06-02 Thread Ira Weiny
t describing flags reported by > the the new sysfs attribute 'papr/flags' is also introduced at > Documentation/ABI/testing/sysfs-bus-papr-pmem. > > [1] commit 58b278f568f0 ("powerpc: Provide initial documentation for > PAPR hcalls") > > Cc: "Aneesh Kumar K . V" >

Re: [RESEND PATCH v9 4/5] ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods

2020-06-02 Thread Ira Weiny
scm_ndctl() and performs sanity tests on them. A new function > papr_scm_service_pdsm() is introduced and is called from > papr_scm_ndctl() in case of a PDSM request is received via ND_CMD_CALL > command from libnvdimm. > > Cc: "Aneesh Kumar K . V" > Cc: Dan Williams

Re: [RESEND PATCH v9 4/5] ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods

2020-06-02 Thread Ira Weiny
On Tue, Jun 02, 2020 at 01:51:49PM -0700, 'Ira Weiny' wrote: > On Tue, Jun 02, 2020 at 03:44:37PM +0530, Vaibhav Jain wrote: ... > > + > > +/* > > + * PDSM Envelope: > > + * > > + * The ioctl ND_CMD_CALL transfers data between user-space and kernel via > >

Re: [RESEND PATCH v9 5/5] powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH

2020-06-02 Thread Ira Weiny
ed. > > Cc: "Aneesh Kumar K . V" > Cc: Dan Williams > Cc: Michael Ellerman > Cc: Ira Weiny > Reviewed-by: Aneesh Kumar K.V > Signed-off-by: Vaibhav Jain > --- > Changelog: > > Resend: > * Added ack from Aneesh. > > v8..v9: > * s/PAPR_SCM_

Re: [RESEND PATCH v9 1/5] powerpc: Document details on H_SCM_HEALTH hcall

2020-06-02 Thread Ira Weiny
Cc: Michael Ellerman > Cc: Ira Weiny Acked-by: Ira Weiny > Signed-off-by: Vaibhav Jain > --- > Changelog: > > Resend: > * None > > v8..v9: > * s/SCM/PMEM device. [ Dan Williams, Aneesh ] > > v7..v8: > * Added a clarification on bit-ordering of Health B

Re: [PATCH V11 11/11] fs/xfs: Update xfs_ioctl_setattr_dax_invalidate()

2020-06-02 Thread Ira Weiny
On Tue, Jun 02, 2020 at 10:23:53AM -0700, Darrick J. Wong wrote: > On Tue, Apr 28, 2020 at 01:11:38PM -0700, Darrick J. Wong wrote: > > On Mon, Apr 27, 2020 at 05:21:42PM -0700, ira.we...@intel.com wrote: > > > From: Ira Weiny > > > ... > > >

Re: [GIT PULL] vfs: improve DAX behavior for 5.8, part 1

2020-06-02 Thread Ira Weiny
On Tue, Jun 02, 2020 at 09:58:52AM -0700, Darrick J. Wong wrote: > Hi Linus, > > After many years of LKML-wrangling about how to enable programs to query > and influence the file data access mode (DAX) when a filesystem resides > on storage devices such as persistent memory, Ira We

Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice

2020-06-03 Thread Ira Weiny
On Wed, Jun 03, 2020 at 01:57:36PM -0700, Andrew Morton wrote: > On Thu, 21 May 2020 10:42:50 -0700 Ira Weiny wrote: > > > > > > > > > Actually it occurs to me that the patch consolidating kmap_prot is odd > > > > for > > > > sparc 32 bit

Re: [RESEND PATCH v9 4/5] ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods

2020-06-03 Thread Ira Weiny
On Wed, Jun 03, 2020 at 11:41:42PM +0530, Vaibhav Jain wrote: > Hi Ira, > > Thanks for reviewing this patch. My responses below: > > Ira Weiny writes: > ... > >> + * > >> + * Payload Version: > >> + * > >> + * A 'payload_v

Re: [RESEND PATCH v9 5/5] powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH

2020-06-03 Thread Ira Weiny
On Thu, Jun 04, 2020 at 12:34:04AM +0530, Vaibhav Jain wrote: > Hi Ira, > > Thanks for reviewing this patch. My responses below: > > Ira Weiny writes: > > > On Tue, Jun 02, 2020 at 03:44:38PM +0530, Vaibhav Jain wrote: > >> This patch implements support f

Re: [RESEND PATCH v9 4/5] ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods

2020-06-03 Thread Ira Weiny
On Thu, Jun 04, 2020 at 01:58:00AM +0530, Vaibhav Jain wrote: > Hi Ira, > > Thanks again for reviewing this patch. My Response below: > > Ira Weiny writes: > > > On Tue, Jun 02, 2020 at 01:51:49PM -0700, 'Ira Weiny' wrote: > >> On Tue, Jun 02, 2020 at 03:

Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice

2020-06-04 Thread Ira Weiny
On Wed, Jun 03, 2020 at 04:44:17PM -0700, Guenter Roeck wrote: > On 6/3/20 2:14 PM, Ira Weiny wrote: > > On Wed, Jun 03, 2020 at 01:57:36PM -0700, Andrew Morton wrote: > >> On Thu, 21 May 2020 10:42:50 -0700 Ira Weiny wrote: > >> ... > >> > >&

Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice

2020-06-04 Thread Ira Weiny
On Thu, Jun 04, 2020 at 09:18:05AM +0300, Mike Rapoport wrote: > On Wed, Jun 03, 2020 at 04:44:17PM -0700, Guenter Roeck wrote: > > On 6/3/20 2:14 PM, Ira Weiny wrote: > > > On Wed, Jun 03, 2020 at 01:57:36PM -0700, Andrew Morton wrote: > > >> On Thu, 21 May 2020 1

Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice

2020-06-04 Thread Ira Weiny
On Thu, Jun 04, 2020 at 09:37:45AM +0300, Mike Rapoport wrote: > On Wed, Jun 03, 2020 at 11:22:26PM -0700, Ira Weiny wrote: > > On Wed, Jun 03, 2020 at 04:44:17PM -0700, Guenter Roeck wrote: > > > > With linux-next on sparc I too see the spinlock issue; something like: >

Re: [PATCH v11 4/6] powerpc/papr_scm: Improve error logging and handling papr_scm_ndctl()

2020-06-08 Thread Ira Weiny
by assigning it pointer to a local variable in case cmd_rc > == NULL. > > Finally the patch also updates the 'default' add a debug log unknown > 'cmd' values. > > Cc: "Aneesh Kumar K . V" > Cc: Dan Williams > Cc: Michael Ellerman > Cc: Ira Weiny Revie

Re: [PATCH v11 5/6] ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods

2020-06-08 Thread Ira Weiny
scm_ndctl() and performs sanity tests on them. A new function > papr_scm_service_pdsm() is introduced and is called from > papr_scm_ndctl() in case of a PDSM request is received via ND_CMD_CALL > command from libnvdimm. > > Cc: "Aneesh Kumar K . V" > Cc: Dan William

Re: [PATCH v11 6/6] powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH

2020-06-08 Thread Ira Weiny
Cc: Dan Williams > Cc: Michael Ellerman > Cc: Ira Weiny > Signed-off-by: Vaibhav Jain > --- > Changelog: > > v10..v11: > * Changed the definition of 'struct nd_papr_pdsm_health' to a maximal > struct 184 bytes in size [ Dan Williams ] > * Added new fiel

Re: [PATCH v13 3/6] powerpc/papr_scm: Fetch nvdimm health information from PHYP

2020-06-15 Thread Ira Weiny
t describing flags reported by > the the new sysfs attribute 'papr/flags' is also introduced at > Documentation/ABI/testing/sysfs-bus-papr-pmem. > > [1] commit 58b278f568f0 ("powerpc: Provide initial documentation for > PAPR hcalls") > > Cc: "Aneesh Kumar K . V" &g

[PATCH V2 2/7] mm/gup: Change write parameter to flags in fast walk

2019-02-13 Thread ira . weiny
From: Ira Weiny In order to support more options in the GUP fast walk, change the write parameter to flags throughout the call stack. This patch does not change functionality and passes FOLL_WRITE where write was previously used. Signed-off-by: Ira Weiny --- mm/gup.c | 52

[PATCH V2 1/7] mm/gup: Replace get_user_pages_longterm() with FOLL_LONGTERM

2019-02-13 Thread ira . weiny
From: Ira Weiny Rather than have a separate get_user_pages_longterm() call, introduce FOLL_LONGTERM and change the longterm callers to use it. This patch does not change any functionality. FOLL_LONGTERM can only be supported with get_user_pages() as it requires vmas to determine if DAX

[PATCH V2 6/7] IB/qib: Use the new FOLL_LONGTERM flag to get_user_pages_fast()

2019-02-13 Thread ira . weiny
From: Ira Weiny Use the new FOLL_LONGTERM to get_user_pages_fast() to protect against FS DAX pages being mapped. Signed-off-by: Ira Weiny --- drivers/infiniband/hw/qib/qib_user_sdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c

[PATCH V2 7/7] IB/mthca: Use the new FOLL_LONGTERM flag to get_user_pages_fast()

2019-02-13 Thread ira . weiny
From: Ira Weiny Use the new FOLL_LONGTERM to get_user_pages_fast() to protect against FS DAX pages being mapped. Signed-off-by: Ira Weiny --- drivers/infiniband/hw/mthca/mthca_memfree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mthca

[PATCH V2 5/7] IB/hfi1: Use the new FOLL_LONGTERM flag to get_user_pages_fast()

2019-02-13 Thread ira . weiny
From: Ira Weiny Use the new FOLL_LONGTERM to get_user_pages_fast() to protect against FS DAX pages being mapped. Signed-off-by: Ira Weiny --- drivers/infiniband/hw/hfi1/user_pages.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hfi1

[PATCH V2 3/7] mm/gup: Change GUP fast to use flags rather than a write 'bool'

2019-02-13 Thread ira . weiny
From: Ira Weiny To facilitate additional options to get_user_pages_fast() change the singular write parameter to be gup_flags. This patch does not change any functionality. New functionality will follow in subsequent patches. Some of the get_user_pages_fast() call sites were unchanged because

[PATCH V2 4/7] mm/gup: Add FOLL_LONGTERM capability to GUP fast

2019-02-13 Thread ira . weiny
From: Ira Weiny DAX pages were previously unprotected from longterm pins when users called get_user_pages_fast(). Use the new FOLL_LONGTERM flag to check for DEVMAP pages and fall back to regular GUP processing if a DEVMAP page is encountered. Signed-off-by: Ira Weiny --- mm/gup.c | 24

[PATCH V2 0/7] Add FOLL_LONGTERM to GUP fast and use it

2019-02-13 Thread ira . weiny
From: Ira Weiny NOTE: This series depends on my clean up patch to remove the write parameter from gup_fast_permitted()[1] HFI1, qib, and mthca, use get_user_pages_fast() due to it performance advantages. These pages can be held for a significant time. But get_user_pages_fast() does

Re: [PATCH 0/5] use pinned_vm instead of locked_vm to account pinned pages

2019-02-13 Thread Ira Weiny
On Mon, Feb 11, 2019 at 03:54:47PM -0700, Jason Gunthorpe wrote: > On Mon, Feb 11, 2019 at 05:44:32PM -0500, Daniel Jordan wrote: > > > All five of these places, and probably some of Davidlohr's conversions, > > probably want to be collapsed into a common helper in the core mm for > > accounting

Re: [PATCH 0/5] use pinned_vm instead of locked_vm to account pinned pages

2019-02-14 Thread Ira Weiny
On Wed, Feb 13, 2019 at 11:00:06PM -0700, Jason Gunthorpe wrote: > On Wed, Feb 13, 2019 at 05:53:14PM -0800, Ira Weiny wrote: > > On Mon, Feb 11, 2019 at 03:54:47PM -0700, Jason Gunthorpe wrote: > > > On Mon, Feb 11, 2019 at 05:44:32PM -0500, Daniel Jordan wrote: >

Re: [PATCH 0/5] use pinned_vm instead of locked_vm to account pinned pages

2019-02-14 Thread Ira Weiny
On Thu, Feb 14, 2019 at 01:12:31PM -0700, Jason Gunthorpe wrote: > On Thu, Feb 14, 2019 at 11:33:53AM -0800, Ira Weiny wrote: > > > > I think it had to do with double accounting pinned and mlocked pages > > > and thus delivering a lower than expected limit to userspac

Re: [PATCH 0/2] mm: put_user_page() call site conversion first

2019-02-14 Thread Ira Weiny
ps://lkml.kernel.org/r/20190204052135.25784-1-jhubb...@nvidia.com > > Cc: Christian Benvenuti > Cc: Christoph Hellwig > Cc: Christopher Lameter > Cc: Dan Williams > Cc: Dave Chinner > Cc: Dennis Dalessandro > Cc: Doug Ledford > Cc: Jan Kara > Cc: Jason

Re: [PATCH 0/6] RFC v2: mm: gup/dma tracking

2019-02-04 Thread Ira Weiny
On Mon, Feb 04, 2019 at 05:14:19PM +, Christopher Lameter wrote: > Frankly I still think this does not solve anything. > > Concurrent write access from two sources to a single page is simply wrong. > You cannot make this right by allowing long term RDMA pins in a filesystem > and thus the

[LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-05 Thread Ira Weiny
is still under discussion." -- John Hubbard[2] The following people have been involved in previous conversations and would be key to the face to face discussion. John Hubbard Jan Kara Dave Chinner Michal Hocko Dan Williams Matthew Wilcox Jason Gunthorpe Thank you, I

Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-05 Thread Ira Weiny
I had an old invalid address for Jason Gunthorpe in my address book... Correcting his email in the thread. On Tue, Feb 05, 2019 at 09:50:59AM -0800, 'Ira Weiny' wrote: > > The problem: Once we have pages marked as GUP-pinned how should various > subsystems work with those

[PATCH] mm/gup.c: Remove unused write variable

2019-02-09 Thread ira . weiny
From: Ira Weiny write is unused in gup_fast_permitted so remove it. Acked-by: Kirill A. Shutemov Signed-off-by: Ira Weiny --- arch/x86/include/asm/pgtable_64.h | 3 +-- mm/gup.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86

Re: [PATCH] mm/gup.c: Remove unused write variable

2019-02-10 Thread Ira Weiny
On Sun, Feb 10, 2019 at 08:39:44PM +0100, Thomas Gleixner wrote: > Ira, > > On Sat, 9 Feb 2019, ira.we...@intel.com wrote: > > nice patch. Just a few nitpicks vs. the subject and the change log. > > > Subject: [PATCH] mm/gup.c: Remove unused write variable > > We usually avoid filenames in the

[PATCH V2] mm/gup: Remove write argument in gup_fast_permitted()

2019-02-10 Thread ira . weiny
From: Ira Weiny The write argument is unused in gup_fast_permitted() so remove it. Acked-by: Kirill A. Shutemov Signed-off-by: Ira Weiny --- Changes since V1 Clean up commit message arch/x86/include/asm/pgtable_64.h | 3 +-- mm/gup.c | 6 +++--- 2 files

Re: [PATCH 3/5] RDMA/uverbs: add owner parameter to ib_umem_get

2019-01-29 Thread Ira Weiny
On Tue, Jan 29, 2019 at 03:26:24PM +0200, Joel Nider wrote: > ib_umem_get is a core function used by drivers that support RDMA. > The 'owner' parameter signifies the process that owns the memory. > Until now, it was assumed that the owning process was the current > process. This adds the

Re: [PATCH 0/5] RDMA: reg_remote_mr

2019-01-29 Thread Ira Weiny
On Tue, Jan 29, 2019 at 10:44:48AM -0600, Steve Wise wrote: > > On 1/29/2019 7:26 AM, Joel Nider wrote: > > As discussed at LPC'18, there is a need to be able to register a memory > > region (MR) on behalf of another process. One example is the case of > > post-copy container migration, in which

Re: [PATCH 3/6] drivers/IB,qib: do not use mmap_sem

2019-01-29 Thread Ira Weiny
_user_pages was not taking into > > > account the current value of pinned_vm. > > > > > > Cc: dennis.dalessan...@intel.com > > > Cc: mike.marcinis...@intel.com > > > Reviewed-by: Ira Weiny > > > Signed-off-by: Davidlohr Bueso > > > dri

Re: [PATCH] MAINTAINERS: Update filesystem-dax and NVDIMM entries

2019-01-24 Thread Ira Weiny
ice-DAX > sub-systems. > > The linux-nvdimm mailing hosts a patchwork instance for both DAX and > NVDIMM patches. > > Cc: Jan Kara > Cc: Ira Weiny > Cc: Ross Zwisler > Cc: Keith Busch > Cc: Matthew Wilcox > Signed-off-by: Dan Williams Acked-by: Ira Weiny > ---

Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-07 Thread Ira Weiny
On Wed, Feb 06, 2019 at 10:23:10PM -0700, Jason Gunthorpe wrote: > On Thu, Feb 07, 2019 at 02:52:58PM +1100, Dave Chinner wrote: > > > Requiring ODP capable hardware and applications that control RDMA > > access to use file leases and be able to cancel/recall client side > > delegations (like NFS

Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-07 Thread Ira Weiny
On Thu, Feb 07, 2019 at 10:28:05AM -0500, Tom Talpey wrote: > On 2/7/2019 10:04 AM, Chuck Lever wrote: > > > > > > > On Feb 7, 2019, at 12:23 AM, Jason Gunthorpe wrote: > > > > > > On Thu, Feb 07, 2019 at 02:52:58PM +1100, Dave Chinner wrote: > > > > > > > Requiring ODP capable hardware and

Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-07 Thread Ira Weiny
On Wed, Feb 06, 2019 at 07:13:16PM -0800, Dan Williams wrote: > On Wed, Feb 6, 2019 at 6:42 PM Doug Ledford wrote: > > > > On Wed, 2019-02-06 at 14:44 -0800, Dan Williams wrote: > > > On Wed, Feb 6, 2019 at 2:25 PM Doug Ledford wrote: > > > > Can someone give me a real world scenario that

Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-07 Thread Ira Weiny
On Thu, Feb 07, 2019 at 04:55:37PM +, Christopher Lameter wrote: > One approach that may be a clean way to solve this: > > 1. Long term GUP usage requires the virtual mapping to the pages be fixed >for the duration of the GUP Map. There never has been a way to break >the pinnning and

Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA

2019-02-07 Thread Ira Weiny
On Thu, Feb 07, 2019 at 03:54:58PM -0800, Dan Williams wrote: > On Thu, Feb 7, 2019 at 9:17 AM Jason Gunthorpe wrote: > > > > Insisting to run RDMA & DAX without ODP and building an elaborate > > revoke mechanism to support non-ODP HW is inherently baroque. > > > > Use the HW that supports ODP. >

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Ira Weiny
On Fri, May 10, 2019 at 09:36:12AM -0700, Matthew Wilcox wrote: > On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > > + nr_reclaimed += (1 << compound_order(page)); > > > > How about to change this to > > > > > > nr_reclaimed += hpage_nr_pages(page); > > Please

Re: [PATCH] mm/gup.c: Make follow_page_mask static

2019-05-10 Thread Ira Weiny
Bharath Vedartham Reviewed-by: Ira Weiny > --- > mm/gup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 91819b8..e6f3b7f 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -409,7 +409,7 @@ static struct page *follow

Re: [PATCH] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-05-15 Thread Ira Weiny
> > -/* Handle removing and resetting vm mappings related to the vm_struct. */ > -static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) > +/* Handle removing and resetting vm mappings related to the va->vm > vm_struct. */ > +static void vm_remove_mappings(struct vmap_area

[RFC PATCH 03/10] mm/gup: Pass flags down to __gup_device_huge* calls

2019-04-28 Thread ira . weiny
From: Ira Weiny In order to support taking and/or checking for a LONGTERM lease on a FS DAX inode these calls need to know if FOLL_LONGTERM was specified. This patch passes the flags down but does not use them. It does this in prep for 2 future patches. --- mm/gup.c | 26

[RFC PATCH 10/10] mm/gup: Remove FOLL_LONGTERM DAX exclusion

2019-04-28 Thread ira . weiny
From: Ira Weiny Now that there is a mechanism for users to safely take LONGTERM pins on FS DAX pages. Remove the FS DAX exclusion from GUP with FOLL_LONGTERM. Special processing remains in effect for CONFIG_CMA --- mm/gup.c | 65 ++-- 1 file

[RFC PATCH 08/10] mm/gup: fs: Send SIGBUS on truncate of active file

2019-04-28 Thread ira . weiny
From: Ira Weiny Now that the taking of LONGTERM leases is in place we can now facilitate sending a SIGBUS to process if a file truncate or hole punch is performed and they do not respond by releasing the lease. The standard file lease_break_time is used to time out the LONGTERM lease which

[RFC PATCH 04/10] WIP: mm/gup: Ensure F_LONGTERM lease is held on GUP pages

2019-04-28 Thread ira . weiny
From: Ira Weiny Honestly I think I should remove this patch. It is removed later in the series and ensuring the lease is there at GUP time does not guarantee the lease is held. The user could remove the lease??? Regardless the code in GUP to take the lease holds it even if the user does try

[RFC PATCH 02/10] fs/locks: Introduce FL_LONGTERM file lease

2019-04-28 Thread ira . weiny
From: Ira Weiny GUP longterm pins of non-pagecache file system pages (FS DAX) are currently disallowed because they are unsafe. The danger for pinning these pages comes from the fact that hole punch and/or truncate of those files results in the pages being mapped and pinned by a user space

[RFC PATCH 06/10] fs/locks: Add longterm lease traces

2019-04-28 Thread ira . weiny
From: Ira Weiny --- fs/locks.c | 5 + include/trace/events/filelock.h | 37 - 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/fs/locks.c b/fs/locks.c index ae508d192223..58c6d7a411b6 100644 --- a/fs/locks.c +++ b/fs

[RFC PATCH 05/10] mm/gup: Take FL_LONGTERM lease if not set by user

2019-04-28 Thread ira . weiny
From: Ira Weiny If a user has failed to take a F_LONGTERM lease on a file and they do a longterm pin on the pages associated with a file, take a FL_LONGTERM lease for them. If the user has not taken a lease on the file they are trying to pin create a FL_LONGTERM lease and attach it to the inode

[RFC PATCH 01/10] fs/locks: Add trace_leases_conflict

2019-04-28 Thread ira . weiny
From: Ira Weiny Signed-off-by: Ira Weiny --- fs/locks.c | 20 ++- include/trace/events/filelock.h | 35 + 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index eaa1cfaf73b0

[RFC PATCH 09/10] fs/locks: Add tracepoint for SIGBUS on LONGTERM expiration

2019-04-28 Thread ira . weiny
From: Ira Weiny --- fs/locks.c | 1 + include/trace/events/filelock.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/locks.c b/fs/locks.c index c77eee081d11..42b96bfc71fa 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1592,6 +1592,7 @@ static void

[RFC PATCH 07/10] fs/dax: Create function dax_mapping_is_dax()

2019-04-28 Thread ira . weiny
From: Ira Weiny In order to support longterm lease breaking operations. Lease break code in the file systems need to know if a mapping is DAX. Split out the logic to determine if a mapping is DAX and export it. --- fs/dax.c| 23 --- include/linux/dax.h | 6

[RFC PATCH 00/10] RDMA/FS DAX "LONGTERM" lease proposal

2019-04-28 Thread ira . weiny
From: Ira Weiny In order to support RDMA to File system pages[*] without On Demand Paging a number of things need to be done. 1) GUP "longterm"[1] users need to inform the other subsystems that they have taken a pin on a page which may remain pinned for a very "long time&qu

Re: [PATCH 07/10] mm/hmm: add an helper function that fault pages and map them to a device

2019-03-19 Thread Ira Weiny
On Tue, Mar 19, 2019 at 09:30:05AM -0400, Jerome Glisse wrote: > On Mon, Mar 18, 2019 at 08:29:45PM -0700, Dan Williams wrote: > > On Mon, Mar 18, 2019 at 3:15 PM Jerome Glisse wrote: > > > > > > On Mon, Mar 18, 2019 at 02:30:15PM -0700, Dan Williams wrote: > > > > On Mon, Mar 18, 2019 at 1:41 PM

Re: [PATCH v4 1/1] mm: introduce put_user_page*(), placeholder versions

2019-03-19 Thread Ira Weiny
On Tue, Mar 19, 2019 at 04:36:44PM +0100, Jan Kara wrote: > On Tue 19-03-19 17:29:18, Kirill A. Shutemov wrote: > > On Tue, Mar 19, 2019 at 10:14:16AM -0400, Jerome Glisse wrote: > > > On Tue, Mar 19, 2019 at 09:47:24AM -0400, Jerome Glisse wrote: > > > > On Tue, Mar 19, 2019 at 03:04:17PM +0300,

Re: [PATCH 07/10] mm/hmm: add an helper function that fault pages and map them to a device

2019-03-19 Thread Ira Weiny
On Tue, Mar 19, 2019 at 01:10:43PM -0400, Jerome Glisse wrote: > On Tue, Mar 19, 2019 at 01:44:57AM -0700, Ira Weiny wrote: > > On Tue, Mar 19, 2019 at 09:30:05AM -0400, Jerome Glisse wrote: > > > On Mon, Mar 18, 2019 at 08:29:45PM -0700, Dan Williams wrote: > > > > O

Re: [PATCH 00/10] HMM updates for 5.1

2019-03-19 Thread Ira Weiny
On Tue, Mar 19, 2019 at 12:13:40PM -0700, Dan Williams wrote: > On Tue, Mar 19, 2019 at 12:05 PM Jerome Glisse wrote: > > > > On Tue, Mar 19, 2019 at 11:42:00AM -0700, Dan Williams wrote: > > > On Tue, Mar 19, 2019 at 10:45 AM Jerome Glisse wrote: > > > > > > > > On Tue, Mar 19, 2019 at

Re: [RESEND PATCH 0/7] Add FOLL_LONGTERM to GUP fast and use it

2019-02-27 Thread Ira Weiny
On Tue, Feb 19, 2019 at 09:30:33PM -0800, 'Ira Weiny' wrote: > From: Ira Weiny > > Resending these as I had only 1 minor comment which I believe we have covered > in this series. I was anticipating these going through the mm tree as they > depend on a cleanup patch there and

Re: [PATCH 1/2] mm/gup.c: fix the wrong comments

2019-04-09 Thread Ira Weiny
On Tue, Apr 09, 2019 at 09:08:33AM +0800, Huang Shijie wrote: > On Mon, Apr 08, 2019 at 07:13:13AM -0700, Matthew Wilcox wrote: > > On Mon, Apr 08, 2019 at 10:37:45AM +0800, Huang Shijie wrote: > > > When CONFIG_HAVE_GENERIC_GUP is defined, the kernel will use its own > > > get_user_pages_fast().

<    2   3   4   5   6   7   8   9   10   >