Skip to content

Helper to abstract vma handling in media layer

Jan Kara linux-media linux-mm linux-samsung-soc 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v7 Latest9 patches 9 repliesIn review

Changes in v7 from the cover letter

* Fixed compilation error introduced into exynos driver
* Folded patch allowing get_vaddr_pfn() code to be selected by a config option into previous patches
* Rebased on top of linux-media tree

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9vb2: 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/9mm: Provide new get_vaddr_frames() helperinclude/linux/mm.h mm/Kconfig mm/Makefile +1 more+279 -02 replies
3/9media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()drivers/media/platform/omap/Kconfig drivers/media/platform/omap/omap_vout.c+32 -360 replies
4/9vb2: Provide helpers for mapping virtual addressesdrivers/media/v4l2-core/Kconfig drivers/media/v4l2-core/videobuf2-memops.c include/media/videobuf2-memops.h+64 -00 replies
5/9media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vectordrivers/media/v4l2-core/videobuf2-dma-sg.c+15 -800 replies
6/9media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vectordrivers/media/v4l2-core/videobuf2-vmalloc.c+36 -560 replies
7/9media: vb2: Convert vb2_dc_get_userptr() to use frame vectordrivers/media/v4l2-core/videobuf2-dma-contig.c+34 -1780 replies
8/9media: vb2: Remove unused functionsdrivers/media/v4l2-core/videobuf2-memops.c include/media/videobuf2-memops.h+0 -1200 replies
9/9drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()drivers/gpu/drm/exynos/Kconfig drivers/gpu/drm/exynos/exynos_drm_g2d.c drivers/gpu/drm/exynos/exynos_drm_gem.c+30 -1595 replies

Reviews trailers per patch

7 of 9 patches have a Reviewed-by or Acked-by.

PatchMarek SzyprowskiMel GormanVlastimil BabkaInki DaeAndrew Morton
1/9
2/9A-b A-b A-b
3/9
4/9A-b T-b
5/9A-b T-b
6/9A-b T-b
7/9A-b T-b
8/9A-b T-b
9/9A-b

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

Read the v7 thread

Cover letter [PATCH 0/9 v7] Helper to abstract vma handling in media layer

From: Jan Kara <[email protected]>

Hello,

I'm sending the seventh version of my patch series to abstract vma handling from the various media drivers. Since the previous version there are just minor cleanups and fixes (see detailed changelog at the end of the email).

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).

Hans, can you please pull the changes? Thanks!

Honza

Changes since v6:
* Fixed compilation error introduced into exynos driver
* Folded patch allowing get_vaddr_pfn() code to be selected by a config option into previous patches
* Rebased on top of linux-media tree

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.