All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 0/3] drm: Extract dma-fence-to-workqueue pattern into common helpers
@ 2026-09-09  4:44 Srinivasan Shanmugam
  2026-09-09  4:44 ` [PATCH v9 1/3] drm: Add drm_work_fence helper Srinivasan Shanmugam
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Srinivasan Shanmugam @ 2026-09-09  4:44 UTC (permalink / raw)
  To: matthew.brost
  Cc: dri-devel, intel-xe, amd-gfx, Srinivasan Shanmugam,
	Christian König

This series extracts the dma-fence-callback-to-workqueue pattern shared
between XE and AMDGPU into common DRM helpers.

Patch 1 introduces drm_work_fence — a generic helper that queues a work
item when a dma-fence signals, for work that cannot run in IRQ context.

Patch 2 introduces drm_user_fence — extends drm_work_fence with
kthread_use_mm() support for drivers that need to write completion
status to userspace memory.

Patch 3 converts XE's open-coded xe_user_fence to use drm_user_fence.

Note: Patch 4 (per-signal compare functionality for AMDGPU's EOP
eventfd path) is deferred pending resolution of the compare address
read method (get_user() vs page-pinning), raised by Matthew Brost.

v9:
- Fix drm_work_fence_queue: drop ref if queue_work returns false,
  closing the race between callback firing and queue_work() (Matt)
- Fix drm_work_fence_cancel_sync: use disable_work_sync() to close
  the UAF race window between callback and queue_work() (Matt)
- Remove xe_sync_ufence_cancel_sync — no caller in this patch (Matt)
- Remove xe_sync_ufence_cancel from xe_vma_destroy_late — unnecessary
  behaviour change; xe_ufence_worker only accesses device-level
  resources, safe to run after VMA teardown (Matt)

v8:
- Fix copyright: The Linux Foundation → Advanced Micro Devices, Inc.
- Switch EXPORT_SYMBOL_GPL → EXPORT_SYMBOL for MIT-licensed code (Matt)
- Rename drm_work_fence_ops callback: writeback → worker (Matt)
- Rename drm_user_fence_ops callback: worker → writeback (Matt)
- Fix xe_ufence_worker ordering: WRITE_ONCE before copy_to_user,
  add smp_wmb() before wake_up_all (Matt, confirmed via 8ae04fe9ffc93)
- Rename .worker → .writeback in xe_ufence_ops (Matt)
- Drop Patch 4 pending design decision on compare address read method

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Suggested-by: Christian König <christian.koenig@amd.com>

Srinivasan Shanmugam (3):
  drm: Add drm_work_fence helper
  drm: Add drm_user_fence helper
  drm/xe: Convert xe_user_fence to drm_user_fence

 drivers/gpu/drm/Makefile           |   2 +
 drivers/gpu/drm/drm_user_fence.c   |  70 +++++++++++
 drivers/gpu/drm/drm_work_fence.c   | 186 +++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_sync.c       | 141 +++++++++++-----------
 drivers/gpu/drm/xe/xe_sync.h       |   1 +
 drivers/gpu/drm/xe/xe_sync_types.h |   1 -
 include/drm/drm_user_fence.h       | 123 +++++++++++++++++++
 include/drm/drm_work_fence.h       |  69 +++++++++++
 8 files changed, 524 insertions(+), 69 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_user_fence.c
 create mode 100644 drivers/gpu/drm/drm_work_fence.c
 create mode 100644 include/drm/drm_user_fence.h
 create mode 100644 include/drm/drm_work_fence.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-09-22 11:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09  4:44 [PATCH v9 0/3] drm: Extract dma-fence-to-workqueue pattern into common helpers Srinivasan Shanmugam
2026-09-09  4:44 ` [PATCH v9 1/3] drm: Add drm_work_fence helper Srinivasan Shanmugam
2026-09-09  4:56   ` sashiko-bot
2026-09-09  4:44 ` [PATCH v9 2/3] drm: Add drm_user_fence helper Srinivasan Shanmugam
2026-09-09  4:54   ` sashiko-bot
2026-09-09  4:44 ` [PATCH v9 3/3] drm/xe: Convert xe_user_fence to drm_user_fence Srinivasan Shanmugam
2026-09-09  4:57   ` sashiko-bot
2026-09-09  4:51 ` ✗ CI.checkpatch: warning for drm: Extract dma-fence-to-workqueue pattern into common helpers (rev2) Patchwork
2026-09-09  4:53 ` ✓ CI.KUnit: success " Patchwork
2026-09-09  5:45 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-09 10:49 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-22 11:30 ` [PATCH v9 0/3] drm: Extract dma-fence-to-workqueue pattern into common helpers SRINIVASAN SHANMUGAM

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.