The queue reset path already resolves the affected queue directly from
the doorbell and funnels successful reset handling through
amdgpu_userq_handle_hung_queue(). Reuse that common handling point to
create the corresponding WAIT_EVENT record.

Keeping the notification in the common helper ensures that queue state
is updated before userspace is notified and that both EVENTFD and
WAIT_EVENT observe the same reset. It also avoids duplicating the
doorbell lookup or adding a queue scan in the MES reset path.

No MES or GFX interrupt changes are needed.

Changes since v10:
- Rebase on the latest user queue reset handling changes.
- Record QUEUE_RESET WAIT_EVENT notifications from the common
  queue-specific reset helper.
- Keep device-level reset accounting and wedged-event notification in
  the top-level recovery paths.

Changes since v9:
- Document the existing USERQ-before-postclose teardown ordering in the
  WAIT_EVENT manager patch to clarify the manager lifetime used by this
  reset producer.

Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index edf6c3e91900..0ba87e0e3951 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -158,7 +158,7 @@ static void amdgpu_userq_mgr_reset_work(struct work_struct 
*work)
  * @queue: affected user queue
  *
  * Mark the queue as hung, force-complete its fences, and notify matching
- * QUEUE_RESET EVENTFD subscribers.
+ * QUEUE_RESET EVENTFD and WAIT_EVENT subscribers.
  *
  * Device-level reset accounting and wedged-event notification are handled
  * separately by the top-level guilty-queue reset path.
@@ -167,6 +167,7 @@ void
 amdgpu_userq_handle_hung_queue(struct amdgpu_usermode_queue *queue)
 {
        struct amdgpu_eventfd_mgr *eventfd_mgr;
+       struct amdgpu_wait_event_mgr *wait_event_mgr;
 
        queue->state = AMDGPU_USERQ_STATE_HUNG;
 
@@ -176,6 +177,11 @@ amdgpu_userq_handle_hung_queue(struct 
amdgpu_usermode_queue *queue)
        amdgpu_eventfd_signal(eventfd_mgr,
                              DRM_AMDGPU_EVENT_TYPE_QUEUE_RESET,
                              queue);
+
+       wait_event_mgr = amdgpu_userq_wait_event_mgr(queue->userq_mgr);
+       amdgpu_wait_event_add(wait_event_mgr,
+                             DRM_AMDGPU_EVENT_TYPE_QUEUE_RESET,
+                             queue);
 }
 
 static void amdgpu_userq_hang_detect_work(struct work_struct *work)
-- 
2.34.1

Reply via email to