dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/scheduler: Fix sched hang when killing app with dependent jobs
@ 2025-07-14  6:23 Lin.Cao
  2025-07-14 11:03 ` Christian König
  2025-07-14 12:46 ` Philipp Stanner
  0 siblings, 2 replies; 15+ messages in thread
From: Lin.Cao @ 2025-07-14  6:23 UTC (permalink / raw)
  To: dri-devel
  Cc: zhenguo.yin, Emily.Deng, Christian König, phasta, dakr,
	matthew.brost, Lin.Cao

When Application A submits jobs (a1, a2, a3) and application B submits
job b1 with a dependency on a2's scheduler fence, killing application A
before run_job(a1) causes drm_sched_entity_kill_jobs_work() to force
signal all jobs sequentially. However, due to missing work_run_job or
work_free_job in entity_kill_job_work(), the scheduler enters sleep
state, causing application B hang.

Add drm_sched_wakeup() when entity_kill_job_work() to preventing
scheduler sleep and subsequent application hangs.

v2:
- Move drm_sched_wakeup() to after drm_sched_fence_scheduled()

Signed-off-by: Lin.Cao <lincao12@amd.com>
---
 drivers/gpu/drm/scheduler/sched_entity.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index e671aa241720..66f2a43c58fd 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -177,6 +177,7 @@ static void drm_sched_entity_kill_jobs_work(struct work_struct *wrk)
 	struct drm_sched_job *job = container_of(wrk, typeof(*job), work);
 
 	drm_sched_fence_scheduled(job->s_fence, NULL);
+	drm_sched_wakeup(job->sched);
 	drm_sched_fence_finished(job->s_fence, -ESRCH);
 	WARN_ON(job->s_fence->parent);
 	job->sched->ops->free_job(job);
-- 
2.46.1


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

end of thread, other threads:[~2025-07-15 13:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14  6:23 [PATCH v2] drm/scheduler: Fix sched hang when killing app with dependent jobs Lin.Cao
2025-07-14 11:03 ` Christian König
2025-07-14 12:46 ` Philipp Stanner
2025-07-14 13:08   ` Christian König
2025-07-14 13:27     ` Philipp Stanner
2025-07-14 13:39       ` Christian König
2025-07-15  3:38         ` cao, lin
2025-07-15  9:12           ` Philipp Stanner
2025-07-15  9:51             ` cao, lin
2025-07-15 10:27               ` Philipp Stanner
2025-07-15 10:52                 ` Christian König
2025-07-15 12:20                   ` Philipp Stanner
2025-07-15 12:32                     ` Christian König
2025-07-15 13:07                       ` Philipp Stanner
2025-07-15 13:20                         ` cao, lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).