linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] get_user_pages() cleanup
@ 2015-10-06  9:24 Jan Kara
  2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm
  Cc: Jan Kara, Jesper Nilsson, linux-cris-kernel, Mikael Starvik,
	linux-ia64, Tony Luck, David Airlie, dri-devel, Timur Tabi,
	linux-rdma, Roland Dreier, Daniel Vetter, Andy Walls,
	linux-media, Mauro Carvalho Chehab

From: Jan Kara <jack@suse.cz>

  Hello,

Now when the usage of get_user_pages() in media drivers got cleaned up, here
comes a series which removes knowledge about mmap_sem from a couple of other
drivers. Patches are trivial and standalone but please check, they are only
compile tested. If you are OK with them, either take them through your
respective trees or ack them and I can take care of pushing them to Linus
(probably through mm tree). Thanks.

After these patches there are some 12 call sites of get_user_pages() outside of
core code (mostly infiniband and RDMA). So we are slowly getting to the goal of
removing knowledge about page fault locking from drivers which will
consequently allow us to change the locking rules with reasonable effort.

								Honza

CC: Jesper Nilsson <jesper.nilsson@axis.com>
CC: linux-cris-kernel@axis.com
CC: Mikael Starvik <starvik@axis.com>
CC: linux-ia64@vger.kernel.org
CC: Tony Luck <tony.luck@intel.com>
CC: David Airlie <airlied@linux.ie>
CC: dri-devel@lists.freedesktop.org
CC: Timur Tabi <timur@freescale.com>
CC: linux-rdma@vger.kernel.org
CC: Roland Dreier <roland@kernel.org>
CC: Daniel Vetter <daniel.vetter@intel.com>
CC: David Airlie <airlied@linux.ie>
CC: dri-devel@lists.freedesktop.org
CC: Andy Walls <awalls@md.metrocast.net>
CC: linux-media@vger.kernel.org
CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast()
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  2015-10-06  9:53   ` Mikael Starvik
  2015-10-09 14:41   ` Jesper Nilsson
  2015-10-06  9:24 ` [PATCH 2/7] ia64: Use get_user_pages_fast() in err_inject.c Jan Kara
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, linux-cris-kernel, Mikael Starvik, Jesper Nilsson

From: Jan Kara <jack@suse.cz>

CC: linux-cris-kernel@axis.com
CC: Mikael Starvik <starvik@axis.com>
CC: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 arch/cris/arch-v32/drivers/cryptocop.c | 35 ++++++++++------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 877da1908234..df7ceeff1086 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -2716,43 +2716,28 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
 		}
 	}
 
-	/* Acquire the mm page semaphore. */
-	down_read(&current->mm->mmap_sem);
-
-	err = get_user_pages(current,
-			     current->mm,
-			     (unsigned long int)(oper.indata + prev_ix),
-			     noinpages,
-			     0,  /* read access only for in data */
-			     0, /* no force */
-			     inpages,
-			     NULL);
+	err = get_user_pages_fast((unsigned long)(oper.indata + prev_ix),
+				  noinpages,
+				  0,  /* read access only for in data */
+				  inpages);
 
 	if (err < 0) {
-		up_read(&current->mm->mmap_sem);
 		nooutpages = noinpages = 0;
-		DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n"));
+		DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages_fast indata\n"));
 		goto error_cleanup;
 	}
 	noinpages = err;
 	if (oper.do_cipher){
-		err = get_user_pages(current,
-				     current->mm,
-				     (unsigned long int)oper.cipher_outdata,
-				     nooutpages,
-				     1, /* write access for out data */
-				     0, /* no force */
-				     outpages,
-				     NULL);
-		up_read(&current->mm->mmap_sem);
+		err = get_user_pages_fast((unsigned long)oper.cipher_outdata,
+					  nooutpages,
+					  1, /* write access for out data */
+					  outpages);
 		if (err < 0) {
 			nooutpages = 0;
-			DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n"));
+			DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages_fast outdata\n"));
 			goto error_cleanup;
 		}
 		nooutpages = err;
-	} else {
-		up_read(&current->mm->mmap_sem);
 	}
 
 	/* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/7] ia64: Use get_user_pages_fast() in err_inject.c
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
  2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  2015-10-06  9:24 ` [PATCH 3/7] drm: Convert via driver to use get_user_pages_fast() Jan Kara
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, Tony Luck, linux-ia64

From: Jan Kara <jack@suse.cz>

Convert get_user_pages() call to get_user_pages_fast(). This actually
fixes an apparent bug where get_user_pages() has been called without
mmap_sem for an arbitrary user-provided address.

CC: Tony Luck <tony.luck@intel.com>
CC: linux-ia64@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 arch/ia64/kernel/err_inject.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 0c161ed6d18e..1fc8995bd8b8 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -142,8 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
 	u64 virt_addr=simple_strtoull(buf, NULL, 16);
 	int ret;
 
-        ret = get_user_pages(current, current->mm, virt_addr,
-                        1, VM_READ, 0, NULL, NULL);
+	ret = get_user_pages_fast(virt_addr, 1, VM_READ, NULL);
 	if (ret<=0) {
 #ifdef ERR_INJ_DEBUG
 		printk("Virtual address %lx is not existing.\n",virt_addr);
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/7] drm: Convert via driver to use get_user_pages_fast()
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
  2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
  2015-10-06  9:24 ` [PATCH 2/7] ia64: Use get_user_pages_fast() in err_inject.c Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  2015-10-06  9:24 ` [PATCH 4/7] fsl_hypervisor: Convert ioctl_memcpy() " Jan Kara
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, David Airlie, dri-devel

From: Jan Kara <jack@suse.cz>

CC: David Airlie <airlied@linux.ie>
CC: dri-devel@lists.freedesktop.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 drivers/gpu/drm/via/via_dmablit.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c
index d0cbd5ecd7f0..d71add236e62 100644
--- a/drivers/gpu/drm/via/via_dmablit.c
+++ b/drivers/gpu/drm/via/via_dmablit.c
@@ -238,14 +238,10 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg,  drm_via_dmablit_t *xfer)
 	vsg->pages = vzalloc(sizeof(struct page *) * vsg->num_pages);
 	if (NULL == vsg->pages)
 		return -ENOMEM;
-	down_read(&current->mm->mmap_sem);
-	ret = get_user_pages(current, current->mm,
-			     (unsigned long)xfer->mem_addr,
-			     vsg->num_pages,
-			     (vsg->direction == DMA_FROM_DEVICE),
-			     0, vsg->pages, NULL);
-
-	up_read(&current->mm->mmap_sem);
+	ret = get_user_pages_fast((unsigned long)xfer->mem_addr,
+				  vsg->num_pages,
+				  (vsg->direction == DMA_FROM_DEVICE),
+				  vsg->pages);
 	if (ret != vsg->num_pages) {
 		if (ret < 0)
 			return ret;
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/7] fsl_hypervisor: Convert ioctl_memcpy() to use get_user_pages_fast()
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
                   ` (2 preceding siblings ...)
  2015-10-06  9:24 ` [PATCH 3/7] drm: Convert via driver to use get_user_pages_fast() Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  2015-10-06  9:24 ` [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() " Jan Kara
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, Timur Tabi

From: Jan Kara <jack@suse.cz>

CC: Timur Tabi <timur@freescale.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 drivers/virt/fsl_hypervisor.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index 32c8fc5f7a5c..c65e5e60d7fd 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -243,13 +243,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
 	sg_list = PTR_ALIGN(sg_list_unaligned, sizeof(struct fh_sg_list));
 
 	/* Get the physical addresses of the source buffer */
-	down_read(&current->mm->mmap_sem);
-	num_pinned = get_user_pages(current, current->mm,
-		param.local_vaddr - lb_offset, num_pages,
-		(param.source == -1) ? READ : WRITE,
-		0, pages, NULL);
-	up_read(&current->mm->mmap_sem);
-
+	num_pinned = get_user_pages_fast(param.local_vaddr - lb_offset,
+		num_pages, (param.source == -1) ? READ : WRITE, pages);
 	if (num_pinned != num_pages) {
 		/* get_user_pages() failed */
 		pr_debug("fsl-hv: could not lock source buffer\n");
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() to use get_user_pages_fast()
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
                   ` (3 preceding siblings ...)
  2015-10-06  9:24 ` [PATCH 4/7] fsl_hypervisor: Convert ioctl_memcpy() " Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  2015-10-06  9:24 ` [PATCH 6/7] drm/i915: Convert to use get_user_page_unlocked() Jan Kara
  2015-10-06  9:24 ` [PATCH 7/7] [media] ivtv: Convert to get_user_pages_unlocked() Jan Kara
  6 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, Roland Dreier, linux-rdma

From: Jan Kara <jack@suse.cz>

Function mthca_map_user_db() appears to call get_user_pages() without
holding mmap_sem. Fix the bug by using get_user_pages_fast() instead
which also takes care of the locking.

CC: Roland Dreier <roland@kernel.org>
CC: linux-rdma@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 drivers/infiniband/hw/mthca/mthca_memfree.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 7d2e42dd6926..c3543b27a2a7 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -472,8 +472,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
 		goto out;
 	}
 
-	ret = get_user_pages(current, current->mm, uaddr & PAGE_MASK, 1, 1, 0,
-			     pages, NULL);
+	ret = get_user_pages_fast(uaddr & PAGE_MASK, 1, 1, pages);
 	if (ret < 0)
 		goto out;
 
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/7] drm/i915: Convert to use get_user_page_unlocked()
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
                   ` (4 preceding siblings ...)
  2015-10-06  9:24 ` [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() " Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  2015-10-06  9:24 ` [PATCH 7/7] [media] ivtv: Convert to get_user_pages_unlocked() Jan Kara
  6 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, Daniel Vetter, David Airlie, dri-devel

From: Jan Kara <jack@suse.cz>

Convert __i915_gem_userptr_get_pages_worker() to use
get_user_page_unlocked() so that we don't unnecessarily leak knowledge of
mm locking into driver code.

CC: Daniel Vetter <daniel.vetter@intel.com>
CC: David Airlie <airlied@linux.ie>
CC: dri-devel@lists.freedesktop.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 8fd431bcdfd3..5138fe61d2fa 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -585,19 +585,18 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
 	if (pvec != NULL) {
 		struct mm_struct *mm = obj->userptr.mm->mm;
 
-		down_read(&mm->mmap_sem);
 		while (pinned < num_pages) {
-			ret = get_user_pages(work->task, mm,
-					     obj->userptr.ptr + pinned * PAGE_SIZE,
-					     num_pages - pinned,
-					     !obj->userptr.read_only, 0,
-					     pvec + pinned, NULL);
+			ret = get_user_pages_unlocked(
+					work->task, mm,
+					obj->userptr.ptr + pinned * PAGE_SIZE,
+					num_pages - pinned,
+					!obj->userptr.read_only, 0,
+					pvec + pinned);
 			if (ret < 0)
 				break;
 
 			pinned += ret;
 		}
-		up_read(&mm->mmap_sem);
 	}
 
 	mutex_lock(&dev->struct_mutex);
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/7] [media] ivtv: Convert to get_user_pages_unlocked()
  2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
                   ` (5 preceding siblings ...)
  2015-10-06  9:24 ` [PATCH 6/7] drm/i915: Convert to use get_user_page_unlocked() Jan Kara
@ 2015-10-06  9:24 ` Jan Kara
  6 siblings, 0 replies; 10+ messages in thread
From: Jan Kara @ 2015-10-06  9:24 UTC (permalink / raw)
  To: linux-mm; +Cc: Jan Kara, Andy Walls, Mauro Carvalho Chehab, linux-media

From: Jan Kara <jack@suse.cz>

Convert ivtv_yuv_prep_user_dma() to use get_user_pages_unlocked() so
that we don't unnecessarily leak knowledge about mm locking into drivers
code.

CC: Andy Walls <awalls@md.metrocast.net>
CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
CC: linux-media@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 drivers/media/pci/ivtv/ivtv-yuv.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c
index 2ad65eb29832..2b8e7b2f2b86 100644
--- a/drivers/media/pci/ivtv/ivtv-yuv.c
+++ b/drivers/media/pci/ivtv/ivtv-yuv.c
@@ -75,15 +75,15 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
 	ivtv_udma_get_page_info (&uv_dma, (unsigned long)args->uv_source, 360 * uv_decode_height);
 
 	/* Get user pages for DMA Xfer */
-	down_read(&current->mm->mmap_sem);
-	y_pages = get_user_pages(current, current->mm, y_dma.uaddr, y_dma.page_count, 0, 1, &dma->map[0], NULL);
+	y_pages = get_user_pages_unlocked(current, current->mm,
+				y_dma.uaddr, y_dma.page_count, 0, 1,
+				&dma->map[0]);
 	uv_pages = 0; /* silence gcc. value is set and consumed only if: */
 	if (y_pages == y_dma.page_count) {
-		uv_pages = get_user_pages(current, current->mm,
-					  uv_dma.uaddr, uv_dma.page_count, 0, 1,
-					  &dma->map[y_pages], NULL);
+		uv_pages = get_user_pages_unlocked(current, current->mm,
+					uv_dma.uaddr, uv_dma.page_count, 0, 1,
+					&dma->map[y_pages]);
 	}
-	up_read(&current->mm->mmap_sem);
 
 	if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
 		int rc = -EFAULT;
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast()
  2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
@ 2015-10-06  9:53   ` Mikael Starvik
  2015-10-09 14:41   ` Jesper Nilsson
  1 sibling, 0 replies; 10+ messages in thread
From: Mikael Starvik @ 2015-10-06  9:53 UTC (permalink / raw)
  To: Jan Kara
  Cc: linux-mm, Jan Kara, linux-cris-kernel, Mikael Starvik, Jesper Nilsson

Thank you! I will do the same change in our out-of-tree modules! Jesper will do the ack.



> 6 okt 2015 kl. 11:43 skrev Jan Kara <jack@suse.com>:
> 
> From: Jan Kara <jack@suse.cz>
> 
> CC: linux-cris-kernel@axis.com
> CC: Mikael Starvik <starvik@axis.com>
> CC: Jesper Nilsson <jesper.nilsson@axis.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> arch/cris/arch-v32/drivers/cryptocop.c | 35 ++++++++++------------------------
> 1 file changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
> index 877da1908234..df7ceeff1086 100644
> --- a/arch/cris/arch-v32/drivers/cryptocop.c
> +++ b/arch/cris/arch-v32/drivers/cryptocop.c
> @@ -2716,43 +2716,28 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
>        }
>    }
> 
> -    /* Acquire the mm page semaphore. */
> -    down_read(&current->mm->mmap_sem);
> -
> -    err = get_user_pages(current,
> -                 current->mm,
> -                 (unsigned long int)(oper.indata + prev_ix),
> -                 noinpages,
> -                 0,  /* read access only for in data */
> -                 0, /* no force */
> -                 inpages,
> -                 NULL);
> +    err = get_user_pages_fast((unsigned long)(oper.indata + prev_ix),
> +                  noinpages,
> +                  0,  /* read access only for in data */
> +                  inpages);
> 
>    if (err < 0) {
> -        up_read(&current->mm->mmap_sem);
>        nooutpages = noinpages = 0;
> -        DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n"));
> +        DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages_fast indata\n"));
>        goto error_cleanup;
>    }
>    noinpages = err;
>    if (oper.do_cipher){
> -        err = get_user_pages(current,
> -                     current->mm,
> -                     (unsigned long int)oper.cipher_outdata,
> -                     nooutpages,
> -                     1, /* write access for out data */
> -                     0, /* no force */
> -                     outpages,
> -                     NULL);
> -        up_read(&current->mm->mmap_sem);
> +        err = get_user_pages_fast((unsigned long)oper.cipher_outdata,
> +                      nooutpages,
> +                      1, /* write access for out data */
> +                      outpages);
>        if (err < 0) {
>            nooutpages = 0;
> -            DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n"));
> +            DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages_fast outdata\n"));
>            goto error_cleanup;
>        }
>        nooutpages = err;
> -    } else {
> -        up_read(&current->mm->mmap_sem);
>    }
> 
>    /* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and
> -- 
> 2.1.4
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast()
  2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
  2015-10-06  9:53   ` Mikael Starvik
@ 2015-10-09 14:41   ` Jesper Nilsson
  1 sibling, 0 replies; 10+ messages in thread
From: Jesper Nilsson @ 2015-10-09 14:41 UTC (permalink / raw)
  To: Jan Kara
  Cc: linux-mm, Jan Kara, linux-cris-kernel, Mikael Starvik, Jesper Nilsson

On Tue, Oct 06, 2015 at 11:24:24AM +0200, Jan Kara wrote:
> From: Jan Kara <jack@suse.cz>
> 
> CC: linux-cris-kernel@axis.com
> CC: Mikael Starvik <starvik@axis.com>

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

> Signed-off-by: Jan Kara <jack@suse.cz>

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-09 14:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
2015-10-06  9:53   ` Mikael Starvik
2015-10-09 14:41   ` Jesper Nilsson
2015-10-06  9:24 ` [PATCH 2/7] ia64: Use get_user_pages_fast() in err_inject.c Jan Kara
2015-10-06  9:24 ` [PATCH 3/7] drm: Convert via driver to use get_user_pages_fast() Jan Kara
2015-10-06  9:24 ` [PATCH 4/7] fsl_hypervisor: Convert ioctl_memcpy() " Jan Kara
2015-10-06  9:24 ` [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() " Jan Kara
2015-10-06  9:24 ` [PATCH 6/7] drm/i915: Convert to use get_user_page_unlocked() Jan Kara
2015-10-06  9:24 ` [PATCH 7/7] [media] ivtv: Convert to get_user_pages_unlocked() Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).