summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/scheduler
diff options
context:
space:
mode:
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>2019-04-18 11:00:23 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-05-02 15:50:55 -0500
commita5343b8a2ca5799ee6370e3cca77369a4c598221 (patch)
treecca91effac12b23864f57cc409e29d7e27dbdce9 /drivers/gpu/drm/scheduler
parent290764af7e369f0001175dc8c3cb747aa9903bb8 (diff)
downloadlwn-a5343b8a2ca5799ee6370e3cca77369a4c598221.tar.gz
lwn-a5343b8a2ca5799ee6370e3cca77369a4c598221.zip
drm/scheduler: Add flag to hint the release of guilty job.
Problem: Sched thread's cleanup function races against TO handler and removes the guilty job from mirror list and we have no way of differentiating if the job was removed from within the TO handler or from the sched thread's clean-up function. Fix: Add a flag to scheduler to hint the TO handler that the guilty job needs to be explicitly released. v2: whitespace fix Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/1555599624-12285-5-git-send-email-andrey.grodzovsky@amd.com
Diffstat (limited to 'drivers/gpu/drm/scheduler')
-rw-r--r--drivers/gpu/drm/scheduler/sched_main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 03e6bd8a1a42..f8f0e1c19002 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -293,8 +293,10 @@ static void drm_sched_job_timedout(struct work_struct *work)
* Guilty job did complete and hence needs to be manually removed
* See drm_sched_stop doc.
*/
- if (list_empty(&job->node))
+ if (sched->free_guilty) {
job->sched->ops->free_job(job);
+ sched->free_guilty = false;
+ }
spin_lock_irqsave(&sched->job_list_lock, flags);
drm_sched_start_timeout(sched);
@@ -395,10 +397,13 @@ void drm_sched_stop(struct drm_gpu_scheduler *sched, struct drm_sched_job *bad)
/*
* We must keep bad job alive for later use during
- * recovery by some of the drivers
+ * recovery by some of the drivers but leave a hint
+ * that the guilty job must be released.
*/
if (bad != s_job)
sched->ops->free_job(s_job);
+ else
+ sched->free_guilty = true;
}
}