Skip to content

Helper to abstract vma handling in media layer

Jan Kara linux-media linux-mm linux-samsung-soc 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest10 patches 4 repliesIn review
  2. v59 patches 11 repliesSuperseded
  3. v49 patches 9 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v39 patches0 repliesSuperseded
v29 patches7 repliesSuperseded

Changes in v6 from the cover letter

* Moved mm helper into a separate file and behind a config option
* Changed the first patch pushing mmap_sem down in videobuf2 core to avoid possible deadlock

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10vb2: Push mmap_sem down to memopsdrivers/media/v4l2-core/videobuf2-core.c drivers/media/v4l2-core/videobuf2-dma-contig.c drivers/media/v4l2-core/videobuf2-dma-sg.c +1 more+12 -30 replies
2/10mm: Provide new get_vaddr_frames() helperinclude/linux/mm.h mm/gup.c+267 -00 replies
3/10media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()drivers/media/platform/omap/omap_vout.c+31 -360 replies
4/10vb2: Provide helpers for mapping virtual addressesdrivers/media/v4l2-core/videobuf2-memops.c include/media/videobuf2-memops.h+63 -00 replies
5/10media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vectordrivers/media/v4l2-core/videobuf2-dma-sg.c+15 -800 replies
6/10media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vectordrivers/media/v4l2-core/videobuf2-vmalloc.c+36 -560 replies
7/10media: vb2: Convert vb2_dc_get_userptr() to use frame vectordrivers/media/v4l2-core/videobuf2-dma-contig.c+34 -1780 replies
8/10media: vb2: Remove unused functionsdrivers/media/v4l2-core/videobuf2-memops.c include/media/videobuf2-memops.h+0 -1200 replies
9/10drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()drivers/gpu/drm/exynos/exynos_drm_g2d.c drivers/gpu/drm/exynos/exynos_drm_gem.c+29 -1590 replies
10/10mm: Move get_vaddr_frames() behind a config optiondrivers/gpu/drm/exynos/Kconfig drivers/media/platform/omap/Kconfig drivers/media/v4l2-core/Kconfig +4 more+238 -2220 replies

Reviews trailers per patch

6 of 10 patches have a Reviewed-by or Acked-by.

PatchMarek SzyprowskiMel GormanVlastimil Babka
1/10
2/10A-b A-b
3/10
4/10A-b T-b
5/10A-b T-b
6/10A-b T-b
7/10A-b T-b
8/10A-b T-b
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH 0/10 v6] Helper to abstract vma handling in media layer

Hello,

I'm sending the sixth version of my patch series to abstract vma handling from the various media drivers. Since the previous version I have added a patch to move mm helpers into a separate file and behind a config option. I also changed patch pushing mmap_sem down in videobuf2 core to avoid lockdep warning and NULL dereference Hans found in his testing. I've also included small fixups Andrew was carrying.

After this patch set drivers have to know much less details about vmas, their types, and locking. Also quite some code is removed from them. As a bonus drivers get automatically VM_FAULT_RETRY handling. The primary motivation for this series is to remove knowledge about mmap_sem locking from as many places a possible so that we can change it with reasonable effort.

The core of the series is the new helper get_vaddr_frames() which is given a virtual address and it fills in PFNs / struct page pointers (depending on VMA type) into the provided array. If PFNs correspond to normal pages it also grabs references to these pages. The difference from get_user_pages() is that this function can also deal with pfnmap, and io mappings which is what the media drivers need.

I have tested the patches with vivid driver so at least vb2 code got some exposure. Conversion of other drivers was just compile-tested (for x86 so e.g. exynos driver which is only for Samsung platform is completely untested).

Andrew, can you please update the patches in mm three? Thanks!

Honza

Changes since v5:
* Moved mm helper into a separate file and behind a config option
* Changed the first patch pushing mmap_sem down in videobuf2 core to avoid possible deadlock

Changes since v4:
* Minor cleanups and fixes pointed out by Mel and Vlasta
* Added Acked-by tags

Changes since v3:
* Added include <linux/vmalloc.h> into mm/gup.c as it's needed for some archs
* Fixed error path for exynos driver

Changes since v2:
* Renamed functions and structures as Mel suggested
* Other minor changes suggested by Mel
* Rebased on top of 4.1-rc2
* Changed functions to get pointer to array of pages / pfns to perform conversion if necessary. This fixes possible issue in the omap I may have introduced in v2 and generally makes the API less errorprone.

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