Skip to content

RFC Emulated coherent graphics memory take 2

Thomas Hellström (VMware) dri-devel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7mm: Add write-protect and clean utilities for address space rangesMAINTAINERS include/linux/mm.h mm/Kconfig +2 more+409 -11 reply
2/7drm/ttm: Allow the driver to provide the ttm struct vm_operations_structdrivers/gpu/drm/ttm/ttm_bo.c drivers/gpu/drm/ttm/ttm_bo_vm.c include/drm/ttm/ttm_bo_driver.h+10 -30 replies
3/7drm/ttm: TTM fault handler helpersdrivers/gpu/drm/ttm/ttm_bo_vm.c include/drm/ttm/ttm_bo_api.h+114 -722 replies
4/7drm/vmwgfx: Implement an infrastructure for write-coherent resourcesdrivers/gpu/drm/vmwgfx/Kconfig drivers/gpu/drm/vmwgfx/Makefile drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +8 more+592 -200 replies
5/7drm/vmwgfx: Use an RBtree instead of linked list for MOB resourcesdrivers/gpu/drm/vmwgfx/vmwgfx_bo.c drivers/gpu/drm/vmwgfx/vmwgfx_drv.h drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +1 more+38 -220 replies
6/7drm/vmwgfx: Implement an infrastructure for read-coherent resourcesdrivers/gpu/drm/vmwgfx/vmwgfx_drv.h drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +2 more+179 -110 replies
7/7drm/vmwgfx: Add surface dirty-tracking callbacksdrivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h drivers/gpu/drm/vmwgfx/vmwgfx_drv.h drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +1 more+629 -70 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchChristian KönigDeepak RawatRalph Campbell
1/7R-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7R-b
7/7R-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 3 reviewers.

Read the v1 thread

Cover letter [RFC PATCH 0/7] Emulated coherent graphics memory take 2

From: Thomas Hellström <[email protected]>

Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU operation that touches that memory, and the CPU sees any content written by the GPU to that memory immediately after any fence object trailing the GPU operation has signaled.

Paravirtual drivers that otherwise require explicit synchronization needs to do this by hooking up dirty tracking to pagefault handlers and buffer object validation.

The mm patch page walk interface has been reworked to be similar to the reworked page-walk code (mm/pagewalk.c). There have been two other solutions to consider:
1) Using the page-walk code. That is currently not possible since it requires the mmap-sem to be held for the struct vm_area_struct vm_flags and for huge page splitting. The pagewalk code in this patchset can't hold the mmap sems since it will lead to locking inversion. Instead it uses an operation mode similar to unmap_mapping_range where the i_mmap_lock is held.
2) Using apply_to_page_range(). The primary use of this code is to fill page tables. The operation modes are IMO sufficiently different to motivate re-implementing the page-walk.

For the TTM changes they are hopefully in line with the long-term strategy of making helpers out of what's left of TTM.

The code has been tested and exercised by a tailored version of mesa where we disable all explicit synchronization and assume graphics memory is coherent. The performance loss varies of course; a typical number is around 5%.

I would like to merge this code through the DRM tree, so an ack to do that from an mm maintainer would be greatly appreciated.

Cc Andrew Morton <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Will Deacon <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Huang Ying <[email protected]>
Cc Souptick Joarder <[email protected]>
Cc "Jérôme Glisse" <[email protected]>
Cc "Christian König" <[email protected]>
Cc Christoph Hellwig <[email protected]>