Skip to contentSkip to conversation

drm/amdgpu/userq: filter out idle userqs from pending signal list

PATCH In review Prike Liang 1 participant 2 messages Sep 7 – Sep 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/userq: filter out idle userqs from pending signal list

As for the empty pending fence list case: after cutting the userq fence driver's fence list, if no pending signaled userq fences remain, this should be treated as an idle userq condition and the hang detection worker should be cancelled accordingly.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +10 -2
index c270635c907b..2f38872dcef6 100644
@@ -162,8 +162,16 @@ amdgpu_userq_fence_driver_process(struct amdgpu_userq_fence_driver *fence_drv)
 				&userq_fence->link);
 	spin_unlock_irqrestore(&fence_drv->fence_list_lock, flags);
 
-	if (list_empty(&to_be_signaled))
-		return -ENOENT;
+	if (list_empty(&to_be_signaled)) {
+		bool idle;
+
+		/* distinguish: was the fence list already empty? */
+		spin_lock_irqsave(&fence_drv->fence_list_lock, flags);
+		idle = list_empty(&fence_drv->fences);
+		spin_unlock_irqrestore(&fence_drv->fence_list_lock, flags);
+		/* 0 = truly idle, -ENOENT = pending submission*/
+		return idle ? 0 : -ENOENT;
+	}
 
 	list_for_each_entry_safe(userq_fence, tmp, &to_be_signaled, link) {
 		fence = &userq_fence->base;
Signature · 1 line
2.34.1
#1 lore raw

AMD General

This will help on identifying the idle userq from the pending signal fences list and cancel the detect hang worker timely. Please help reviewing the patch and move it forward. Thanks!

Regards,
Prike

Quoted 44 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, September 7, 2026 8:54 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: filter out idle userqs from pending signal list

As for the empty pending fence list case: after cutting the userq fence driver's fence list, if no pending signaled userq fences remain, this should be treated as an idle userq condition and the hang detection worker should be cancelled accordingly.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +10 -2
index c270635c907b..2f38872dcef6 100644
@@ -162,8 +162,16 @@ amdgpu_userq_fence_driver_process(struct
 amdgpu_userq_fence_driver *fence_drv)
                              &userq_fence->link);
      spin_unlock_irqrestore(&fence_drv->fence_list_lock, flags);
 
-     if (list_empty(&to_be_signaled))
-             return -ENOENT;
+     if (list_empty(&to_be_signaled)) {
+             bool idle;
+
+             /* distinguish: was the fence list already empty? */
+             spin_lock_irqsave(&fence_drv->fence_list_lock, flags);
+             idle = list_empty(&fence_drv->fences);
+             spin_unlock_irqrestore(&fence_drv->fence_list_lock, flags);
+             /* 0 = truly idle, -ENOENT = pending submission*/
+             return idle ? 0 : -ENOENT;
+     }
 
      list_for_each_entry_safe(userq_fence, tmp, &to_be_signaled, link) {
              fence = &userq_fence->base;

--
2.34.1