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 <[email protected]> --- Changes in v2: - Be more precise about the fence critical section. (Danilo) --- include/drm/gpu_scheduler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 3b0978fa8cf0..30f7b2107c73 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -447,6 +447,11 @@ 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 after the job's dma_fence may have been published, + * thus, it must be considered a dma_fence signaling critical section. + * You must not perform sleeping allocations in your implementation, + * otherwise deadlocks can occur. */ struct dma_fence *(*prepare_job)(struct drm_sched_job *sched_job, struct drm_sched_entity *s_entity); -- 2.56.0
