[PATCH 03/21] drm/amdgpu:fix scheduler hw reset&recovery

Monk Liu Monk.Liu at amd.com
Sat Feb 4 10:21:41 UTC 2017


Change-Id: I39e0b77029d22dc3fb37e2f19da699647ae96aad
Signed-off-by: Monk Liu <Monk.Liu at amd.com>
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index ffe1f85..73dd5a7 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -384,6 +384,13 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched)
 	struct amd_sched_job *s_job;
 
 	spin_lock(&sched->job_list_lock);
+	s_job = list_first_entry_or_null(&sched->ring_mirror_list,
+					 struct amd_sched_job, node);
+	if (!s_job) {
+		spin_unlock(&sched->job_list_lock);
+		return;
+	}
+
 	list_for_each_entry_reverse(s_job, &sched->ring_mirror_list, node) {
 		if (fence_remove_callback(s_job->s_fence->parent, &s_job->s_fence->cb)) {
 			fence_put(s_job->s_fence->parent);
@@ -405,6 +412,11 @@ void amd_sched_job_recovery(struct amd_gpu_scheduler *sched)
 	if (s_job && sched->timeout != MAX_SCHEDULE_TIMEOUT)
 		schedule_delayed_work(&s_job->work_tdr, sched->timeout);
 
+	if (!s_job) {
+		spin_unlock(&sched->job_list_lock);
+		return;
+	}
+
 	list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) {
 		struct amd_sched_fence *s_fence = s_job->s_fence;
 		struct fence *fence;
-- 
2.7.4



More information about the amd-gfx mailing list