RFC Use a dma_resv wound-wait transaction API for drm_exec
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest0 of 3 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 3 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/3] Use a dma_resv wound-wait transaction API for drm_exec
The forward outlook of drm_exec is to be a genuine drm_exec helper rather than a generic wound-wait transaction helper. Earlier attempts to introduce exhaustive eviction within TTM using drm_exec have been forced to extend drm_exec with modes that aren't of interest fo a drm_exec helper, like eviction mode locking, snapshots, trylocks etc.
This series introduces dma_resv_txn, a subsystem-agnostic wound-wait transaction layer for any objects that embed or reference a dma_resv. Participant types register an ops vtable supplying callbacks to reach the dma_resv and drop the object reference; the transaction layer handles all lock ordering, wound-wait arbitration, and retry control.
drm_exec is then rebuilt as a thin wrapper on top, retaining its existing API without changes to existing callers. The dma_resv code suggested here also follows the previous drm_exec implementation closely with the same design choices.
Possible use-cases may be ttm_object refcounting for eviction, Additional eviction modes as described above, a dma_buf_map() functionality passing a ww transaction locking context (drm_exec would've been a layering violation), embedding resvs in GPU vm objects etc.
A live kunit benchmark for the drm_exec locking path is included.
It should be mentioned that this could be placed on an even lower level (kernel/locking), but that would probably require potential other users first and also a proper non-allocating trylock functionality.
Also tried an approach where object structures were allocated individually using a kmem_cache and put on a linked list. However, the benchmark showed a substantial performance hit compared to the pre-allocated array approach that was originally used indrm_exec.
Thomas Hellström (3):
dma-buf: Add generic dma_resv wound-wait transaction API drm/exec: Rebuild drm_exec on top of dma_resv_txn drm/xe/tests: Add drm_exec locking benchmark kunit test
drivers/dma-buf/Makefile | 2 +- drivers/dma-buf/dma-resv-txn.c | 300 +++++++++++++++++++ drivers/gpu/drm/drm_exec.c | 203 ++----------- drivers/gpu/drm/xe/tests/Makefile | 3 +- drivers/gpu/drm/xe/tests/xe_drm_exec_kunit.c | 130 ++++++++ drivers/gpu/drm/xe/tests/xe_live_test_mod.c | 2 + drivers/gpu/drm/xe/xe_bo.c | 3 + include/drm/drm_exec.h | 161 +++------- include/linux/dma-resv-txn.h | 223 ++++++++++++++ 9 files changed, 731 insertions(+), 296 deletions(-) create mode 100644 drivers/dma-buf/dma-resv-txn.c create mode 100644 drivers/gpu/drm/xe/tests/xe_drm_exec_kunit.c create mode 100644 include/linux/dma-resv-txn.h
Signature · 1 line
2.54.0