Skip to content

Commit 15f7776

Browse files
Lin.CaoPhilipp Stanner
authored andcommitted
drm/sched: Remove optimization that causes hang when killing dependent jobs
When application A submits jobs and application B submits a job with a dependency on A's fence, the normal flow wakes up the scheduler after processing each job. However, the optimization in drm_sched_entity_add_dependency_cb() uses a callback that only clears dependencies without waking up the scheduler. When application A is killed before its jobs can run, the callback gets triggered but only clears the dependency without waking up the scheduler, causing the scheduler to enter sleep state and application B to hang. Remove the optimization by deleting drm_sched_entity_clear_dep() and its usage, ensuring the scheduler is always woken up when dependencies are cleared. Fixes: 777dbd4 ("drm/amdgpu: drop a dummy wakeup scheduler") Cc: [email protected] # v4.6+ Signed-off-by: Lin.Cao <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Philipp Stanner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 95a1616 commit 15f7776

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

drivers/gpu/drm/scheduler/sched_entity.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,6 @@ void drm_sched_entity_destroy(struct drm_sched_entity *entity)
355355
}
356356
EXPORT_SYMBOL(drm_sched_entity_destroy);
357357

358-
/* drm_sched_entity_clear_dep - callback to clear the entities dependency */
359-
static void drm_sched_entity_clear_dep(struct dma_fence *f,
360-
struct dma_fence_cb *cb)
361-
{
362-
struct drm_sched_entity *entity =
363-
container_of(cb, struct drm_sched_entity, cb);
364-
365-
entity->dependency = NULL;
366-
dma_fence_put(f);
367-
}
368-
369358
/*
370359
* drm_sched_entity_wakeup - callback to clear the entity's dependency and
371360
* wake up the scheduler
@@ -376,7 +365,8 @@ static void drm_sched_entity_wakeup(struct dma_fence *f,
376365
struct drm_sched_entity *entity =
377366
container_of(cb, struct drm_sched_entity, cb);
378367

379-
drm_sched_entity_clear_dep(f, cb);
368+
entity->dependency = NULL;
369+
dma_fence_put(f);
380370
drm_sched_wakeup(entity->rq->sched);
381371
}
382372

@@ -429,13 +419,6 @@ static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *entity)
429419
fence = dma_fence_get(&s_fence->scheduled);
430420
dma_fence_put(entity->dependency);
431421
entity->dependency = fence;
432-
if (!dma_fence_add_callback(fence, &entity->cb,
433-
drm_sched_entity_clear_dep))
434-
return true;
435-
436-
/* Ignore it when it is already scheduled */
437-
dma_fence_put(fence);
438-
return false;
439422
}
440423

441424
if (!dma_fence_add_callback(entity->dependency, &entity->cb,

0 commit comments

Comments
 (0)