Signal queue reset EVENTFD subscriptions when hung user queues are
detected.

The user queue reset path already identifies the affected queues and
marks them as AMDGPU_USERQ_STATE_HUNG.

Reuse this point to signal queue-scoped QUEUE_RESET EVENTFD
subscriptions using the corresponding queue objects.

EVENTFD remains notification-only.

Changes in v10:
- Signal QUEUE_RESET eventfds using the actual queue object to avoid
  queue_id reuse issues.

Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c 
b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
index e9189f07c6dc..0b86e236da3a 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
@@ -238,11 +238,23 @@ static int mes_userq_detect_and_reset(struct 
amdgpu_device *adev,
                        if (queue->queue_type == queue_type) {
                                for (i = 0; i < hung_db_num; i++) {
                                        if (queue->doorbell_index == 
db_array[i]) {
+                                               struct amdgpu_eventfd_mgr 
*eventfd_mgr;
+
                                                queue->state = 
AMDGPU_USERQ_STATE_HUNG;
+
+                                               eventfd_mgr =
+                                                       
amdgpu_userq_eventfd_mgr(queue->userq_mgr);
+                                               if (eventfd_mgr)
+                                                       
amdgpu_eventfd_signal(eventfd_mgr,
+                                                                             
DRM_AMDGPU_EVENT_TYPE_QUEUE_RESET,
+                                                                             
queue);
+
                                                found_hung_queue = true;
                                                
atomic_inc(&adev->gpu_reset_counter);
                                                
amdgpu_userq_fence_driver_force_completion(queue);
-                                               
drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL);
+                                               
drm_dev_wedged_event(adev_to_drm(adev),
+                                                                    
DRM_WEDGE_RECOVERY_NONE,
+                                                                    NULL);
                                        }
                                }
                        }
-- 
2.34.1

Reply via email to