On 6/12/26 07:52, Srinivasan Shanmugam wrote:
> Signal QUEUE_RESET EVENTFD subscriptions when hung user queues are
> detected.
>
> The queue reset path already identifies the affected user queues. Use
> those queue objects to wake up the matching EVENTFD subscribers.
>
> EVENTFD remains notification-only.
>
> 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 | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index e9189f07c6dc..ee8dbd70e1c8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -238,7 +238,16 @@ 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]) {
That code is extremely questionable to begin with.
My suggestion is to clean that up first and add a function in amdgpu_userq.c
which gets the doorbell index and does the necessary handling.
E.g. actually lock the doorbell XA, lookup the queue and then do the right
handling.
Regards,
Christian.
> + struct amdgpu_eventfd_mgr
> *eventfd_mgr;
> +
> queue->state =
> AMDGPU_USERQ_STATE_HUNG;
> +
> + eventfd_mgr =
> +
> amdgpu_userq_eventfd_mgr(queue->userq_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);