Skip to content

Implement lazy unmapping for GEM VRAM buffers

Thomas Zimmermann dri-devel 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 3 repliesIn review
  2. v33 patches 8 repliesSuperseded
  3. v23 patches 11 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches0 repliesSuperseded

Changes in v4 from the cover letter

* lock kmap with ttm_bo_reserve()
* acquire lock only once for vmap()
* warn about stale mappings during buffer cleanup

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4drm/vram: Add kmap ref-counting to GEM VRAM objectsdrivers/gpu/drm/drm_gem_vram_helper.c include/drm/drm_gem_vram_helper.h+71 -180 replies
2/4drm/vram: Acquire lock only once per call to vmap()/vunmap()drivers/gpu/drm/drm_gem_vram_helper.c+73 -460 replies
3/4drm/vram: Add infrastructure for move_notify()drivers/gpu/drm/drm_vram_mm_helper.c include/drm/drm_vram_mm_helper.h+16 -00 replies
4/4drm/vram: Implement lazy unmapping for GEM VRAM buffersdrivers/gpu/drm/drm_gem_vram_helper.c include/drm/drm_gem_vram_helper.h+45 -80 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGerd HoffmannDavidlohr Bueso
SeriesR-b Reported-and-tested-by
1/4R-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] Implement lazy unmapping for GEM VRAM buffers

Generic fbdev emulation maps and unmaps the console BO for updating it's content from the shadow buffer. If this involves an actual mapping operation (instead of reusing an existing mapping), lots of debug messages may be printed, such as

x86/PAT: Overlap at 0xd0000000-0xd1000000
x86/PAT: reserve_memtype added [mem 0xd0000000-0xd02fffff], track write-combining, req write-combining, ret write-combining x86/PAT: free_memtype request [mem 0xd0000000-0xd02fffff]

as reported at [1]. Drivers using VRAM helpers may also see reduced performance as the mapping operations can create overhead.

In v3 and later of the patch set, this problem is being solved by lazily unmapping the buffer as suggested by Gerd. Unmapping with drm_gem_vram_kunmap() only changes a reference counter. VRAM helpers later perform the unmapping operation when TTM evicts the buffer object from its current location. If the buffer is never evicted, the existing mapping is reused by later calls to drm_gem_vram_kmap().

v4:
* lock kmap with ttm_bo_reserve()
* acquire lock only once for vmap()
* warn about stale mappings during buffer cleanup
v3:
* implement lazy unmapping
v2:
* fixed comment typos

[1] https://lists.freedesktop.org/archives/dri-devel/2019-September/234308.html

Thomas Zimmermann (4):
drm/vram: Add kmap ref-counting to GEM VRAM objects drm/vram: Acquire lock only once per call to vmap()/vunmap() drm/vram: Add infrastructure for move_notify() drm/vram: Implement lazy unmapping for GEM VRAM buffers

 drivers/gpu/drm/drm_gem_vram_helper.c | 229 ++++++++++++++++++--------
 drivers/gpu/drm/drm_vram_mm_helper.c  |  12 ++
 include/drm/drm_gem_vram_helper.h     |  18 ++
 include/drm/drm_vram_mm_helper.h      |   4 +
 4 files changed, 198 insertions(+), 65 deletions(-)

--
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel