linux-media.vger.kernel.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 7/7] [media] ivtv: Convert to get_user_pages_unlocked() Jan Kara
  0 siblings, 1 reply; 2+ 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>

^ permalink raw reply	[flat|nested] 2+ 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
@ 2015-10-06  9:24 ` Jan Kara
  0 siblings, 0 replies; 2+ 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


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

end of thread, other threads:[~2015-10-06  9:24 UTC | newest]

Thread overview: 2+ 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 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).