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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm curious what problem this patch fix? Any crash?

My impression list_for will check if the list is empty, am I wrong?

Regards,
David Zhou

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Monk Liu
Sent: Saturday, February 04, 2017 6:22 PM
To: amd-gfx at lists.freedesktop.org
Cc: Liu, Monk <Monk.Liu at amd.com>
Subject: [PATCH 03/21] drm/amdgpu:fix scheduler hw reset&recovery

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

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux