Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] drm/sched: Document reclaim restrictions for ops->prepare_job()
@ 2026-11-27 14:24 Philipp Stanner
  2026-11-27 14:30 ` Danilo Krummrich
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2026-11-27 14:24 UTC (permalink / raw)
  To: Matthew Brost, Danilo Krummrich, Philipp Stanner,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Tvrtko Ursulin
  Cc: dri-devel, linux-kernel, linux-media

drm_sched_backend_ops->prepare_job() gets called from
drm_sched_entity_pop_job(). Thus, it's in the fence critical path where
a memory reclaim might wait for the job / fence to complete.

Sleeping in general seems to be (currently) allowed in prepare_job(),
but a sleeping allocation risks deadlock.

Document the allocation pitfals for prepare_job().

Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
Didn't we recently discuss deprecating this callback for good?
There's a great many users, though...
---
 include/drm/gpu_scheduler.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 3b0978fa8cf0..1e4d0399a9b9 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -447,6 +447,10 @@ struct drm_sched_backend_ops {
 	 *
 	 * Can be NULL if no additional preparation to the dependencies are
 	 * necessary. Skipped when jobs are killed instead of run.
+	 *
+	 * This gets called in the job submission path (dma_fence critical path).
+	 * You must not perform sleeping allocations in your implementation, or
+	 * deadlock can occur.
 	 */
 	struct dma_fence *(*prepare_job)(struct drm_sched_job *sched_job,
 					 struct drm_sched_entity *s_entity);
-- 
2.56.0


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 14:24 [PATCH] drm/sched: Document reclaim restrictions for ops->prepare_job() Philipp Stanner
2026-11-27 14:30 ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox