RFC Common preempt fences and semantics
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 12 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | dma-resv: Add DMA_RESV_USAGE_PREEMPTdrivers/ drivers/ include/ +1 more | +49 | 0 replies | |
| 2/6 | drm/sched: Teach scheduler about DMA_RESV_USAGE_PREEMPTdrivers/ drivers/ include/ | +73 | 3 replies | |
| 3/6 | dma-fence: Add dma_fence_preempt base classdrivers/ drivers/ include/ | +157 | 0 replies | |
| 4/6 | drm/sched: Teach scheduler about dma_fence_prempt typedrivers/ | +3 | 0 replies | |
| 5/6 | drm/xe: Use DMA_RESV_USAGE_PREEMPT for preempt fencesdrivers/ drivers/ drivers/ +1 more | +13 | 0 replies | |
| 6/6 | drm/xe: Use dma_fence_preempt base classdrivers/ drivers/ drivers/ +2 more | +32 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/6] Common preempt fences and semantics
The motivation for this series comes from pending UMD submission work by AMD [1], ARM [3], and the Xe team, who are also beginning to look at this. Sima has suggested [4] some common driver preemptive fences and semantics, which we all agree on. This is the first attempt to implement them, based on Xe's existing long-running preemptive fences.
The semantics are fairly simple: preemptive fences attached to a dma-resv must wait to enable signaling (and thus preempt device execution) until all fences in other slots have been signaled. These semantics are necessary to avoid deadlocks when preempting a device while a user submission is pending, and resuming device execution depends on the user submission completing. The semantics align with Christian's view [5], which I also arrived at independently (with a little help from Sima).
Implemented via the new dma-resv slot DMA_RESV_USAGE_PREEMPT, a common embedded base preemptive fence class with driver operations, and updates to the scheduler to adhere to these semantics.
The current Xe long-running preemptive fences have been converted to the new common code, and UMD submission is expected to follow (hopefully) shortly thereafter in a subsequent series.
Not intended to be presented as the final solution, but rather to kickstart serious discussions on this topic.
Matt
[1] https://patchwork.freedesktop.org/series/113675/
[2] https://patchwork.freedesktop.org/series/114385/
[3] https://patchwork.freedesktop.org/series/137924/
[4] https://patchwork.kernel.org/project/dri-devel/cover/[email protected]/#26011577
[5] https://patchwork.kernel.org/project/dri-devel/cover/[email protected]/#26011853
Matthew Brost (6):
dma-resv: Add DMA_RESV_USAGE_PREEMPT drm/sched: Teach scheduler about DMA_RESV_USAGE_PREEMPT
dma-fence: Add dma_fence_preempt base class drm/sched: Teach scheduler about dma_fence_prempt type drm/xe: Use DMA_RESV_USAGE_PREEMPT for preempt fences drm/xe: Use dma_fence_preempt base class
drivers/dma-buf/Makefile | 2 +- drivers/dma-buf/dma-fence-preempt.c | 102 ++++++++++++++++++++ drivers/dma-buf/dma-resv.c | 43 ++++++--- drivers/dma-buf/st-dma-resv.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 29 +++++- drivers/gpu/drm/scheduler/sched_main.c | 50 +++++++--- drivers/gpu/drm/xe/xe_bo.c | 22 +---- drivers/gpu/drm/xe/xe_guc_submit.c | 3 + drivers/gpu/drm/xe/xe_hw_engine_group.c | 4 +- drivers/gpu/drm/xe/xe_migrate.c | 4 +- drivers/gpu/drm/xe/xe_preempt_fence.c | 81 +++++----------- drivers/gpu/drm/xe/xe_preempt_fence.h | 2 +- drivers/gpu/drm/xe/xe_preempt_fence_types.h | 11 +-- drivers/gpu/drm/xe/xe_pt.c | 12 +-- drivers/gpu/drm/xe/xe_vm.c | 22 +---- include/drm/gpu_scheduler.h | 15 +++ include/linux/dma-fence-preempt.h | 54 +++++++++++ include/linux/dma-fence.h | 1 + include/linux/dma-resv.h | 24 +++-- 19 files changed, 326 insertions(+), 157 deletions(-) create mode 100644 drivers/dma-buf/dma-fence-preempt.c create mode 100644 include/linux/dma-fence-preempt.h
Signature · 1 line
2.34.1