Skip to contentSkip to conversation

drm/panthor: fix queue_reset_timeout_locked

PATCH In review Chia-I Wu 3 participants 3 messages Dec 2, 2025 – Dec 3, 2025

Subsystems (3)
lore
Share & tools
lore

Chia-I Wu

author
#0 lore raw

PATCH v2 1/1 drm/panthor: fix queue_reset_timeout_locked

queue_check_job_completion calls queue_reset_timeout_locked to reset the timeout when progress is made. We want the reset to happen when the timeout is running, not when it is suspended.

Fixes 345c5b7cc0f85 ("drm/panthor: Make the timeout per-queue instead of per-job")

---
v2: reset queue->timeout.remaining when suspended (Boris)

---
 drivers/gpu/drm/panthor/panthor_sched.c | 26 +++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +14 -12
index 389d508b3848e..95ae42168ce18 100644
@@ -1052,18 +1052,6 @@ group_is_idle(struct panthor_group *group)
 	return hweight32(inactive_queues) == group->queue_count;
 }
 
-static void
-queue_reset_timeout_locked(struct panthor_queue *queue)
-{
-	lockdep_assert_held(&queue->fence_ctx.lock);
-
-	if (queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT) {
-		mod_delayed_work(queue->scheduler.timeout_wq,
-				 &queue->timeout.work,
-				 msecs_to_jiffies(JOB_TIMEOUT_MS));
-	}
-}
-
 static bool
 group_can_run(struct panthor_group *group)
 {
@@ -1080,6 +1068,20 @@ queue_timeout_is_suspended(struct panthor_queue *queue)
 	return queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT;
 }
 
+static void
+queue_reset_timeout_locked(struct panthor_queue *queue)
+{
+	lockdep_assert_held(&queue->fence_ctx.lock);
+
+	if (queue_timeout_is_suspended(queue)) {
+		queue->timeout.remaining = msecs_to_jiffies(JOB_TIMEOUT_MS);
+	} else {
+		mod_delayed_work(queue->scheduler.timeout_wq,
+				 &queue->timeout.work,
+				 msecs_to_jiffies(JOB_TIMEOUT_MS));
+	}
+}
+
 static void
 queue_suspend_timeout_locked(struct panthor_queue *queue)
 {
Signature · 1 line
2.52.0.158.g65b55ccf14-goog
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · On Tue, 2 Dec 2025 13:31:02 -0800 Chia-I Wu <[email protected]> wrote:

queue_check_job_completion calls queue_reset_timeout_locked to reset the timeout when progress is made. We want the reset to happen when the timeout is running, not when it is suspended.

Fixes 345c5b7cc0f85 ("drm/panthor: Make the timeout per-queue instead of per-job")
Quoted 51 lines

---
v2: reset queue->timeout.remaining when suspended (Boris)

---
 drivers/gpu/drm/panthor/panthor_sched.c | 26 +++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +14 -12
index 389d508b3848e..95ae42168ce18 100644
@@ -1052,18 +1052,6 @@ group_is_idle(struct panthor_group *group)
 	return hweight32(inactive_queues) == group->queue_count;
 }
 
-static void
-queue_reset_timeout_locked(struct panthor_queue *queue)
-{
-	lockdep_assert_held(&queue->fence_ctx.lock);
-
-	if (queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT) {
-		mod_delayed_work(queue->scheduler.timeout_wq,
-				 &queue->timeout.work,
-				 msecs_to_jiffies(JOB_TIMEOUT_MS));
-	}
-}
-
 static bool
 group_can_run(struct panthor_group *group)
 {
@@ -1080,6 +1068,20 @@ queue_timeout_is_suspended(struct panthor_queue *queue)
 	return queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT;
 }
 
+static void
+queue_reset_timeout_locked(struct panthor_queue *queue)
+{
+	lockdep_assert_held(&queue->fence_ctx.lock);
+
+	if (queue_timeout_is_suspended(queue)) {
+		queue->timeout.remaining = msecs_to_jiffies(JOB_TIMEOUT_MS);
+	} else {
+		mod_delayed_work(queue->scheduler.timeout_wq,
+				 &queue->timeout.work,
+				 msecs_to_jiffies(JOB_TIMEOUT_MS));
+	}
+}
+
 static void
 queue_suspend_timeout_locked(struct panthor_queue *queue)
 {
maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Chia-I Wu
Quoted 6 lines · Chia-I Wu

queue_check_job_completion calls queue_reset_timeout_locked to reset the timeout when progress is made. We want the reset to happen when the timeout is running, not when it is suspended.

Fixes 345c5b7cc0f85 ("drm/panthor: Make the timeout per-queue instead of per-job")

Best regards,
Liviu

Quoted 54 lines

---
v2: reset queue->timeout.remaining when suspended (Boris)

---
 drivers/gpu/drm/panthor/panthor_sched.c | 26 +++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +14 -12
index 389d508b3848e..95ae42168ce18 100644
@@ -1052,18 +1052,6 @@ group_is_idle(struct panthor_group *group)
 	return hweight32(inactive_queues) == group->queue_count;
 }
 
-static void
-queue_reset_timeout_locked(struct panthor_queue *queue)
-{
-	lockdep_assert_held(&queue->fence_ctx.lock);
-
-	if (queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT) {
-		mod_delayed_work(queue->scheduler.timeout_wq,
-				 &queue->timeout.work,
-				 msecs_to_jiffies(JOB_TIMEOUT_MS));
-	}
-}
-
 static bool
 group_can_run(struct panthor_group *group)
 {
@@ -1080,6 +1068,20 @@ queue_timeout_is_suspended(struct panthor_queue *queue)
 	return queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT;
 }
 
+static void
+queue_reset_timeout_locked(struct panthor_queue *queue)
+{
+	lockdep_assert_held(&queue->fence_ctx.lock);
+
+	if (queue_timeout_is_suspended(queue)) {
+		queue->timeout.remaining = msecs_to_jiffies(JOB_TIMEOUT_MS);
+	} else {
+		mod_delayed_work(queue->scheduler.timeout_wq,
+				 &queue->timeout.work,
+				 msecs_to_jiffies(JOB_TIMEOUT_MS));
+	}
+}
+
 static void
 queue_suspend_timeout_locked(struct panthor_queue *queue)
 {
Signature · 1 line
2.52.0.158.g65b55ccf14-goog