On 9/17/26 15:13, Sunil Khatri wrote:
> Function amdgpu_userq_start_hang_detect_work() calls msecs_to_jiffies()
> on adev->gfx_timeout/compute_timeout/sdma_timeout before arming
> hang_detect_work. These timeout values already hold jiffies values from
> amdgpu_device_get_job_timeout_settings() at device init.
> 
> This silently shrinks the real hang-detect deadline to (2 * HZ) ms
> instead of the intended timeout. e.g. 500ms instead of the 2000ms
> default on a CONFIG_HZ=250 kernel, only coincidentally correct at
> HZ=1000. The shortened window is easily exceeded by ordinary
> fence-completion latency, causing hang_detect_work to fire and
> trigger a per-queue or full GPU reset for queues that are not
> actually hung.
> 
> Pass the jiffies value directly to queue_delayed_work() instead of
> converting it a second time.
> 
> Fixes: fc3336be9c62 ("drm/amd/amdgpu: Add independent hang detect work for 
> user queue fence")
> Signed-off-by: Sunil Khatri <[email protected]>

Reviewed-by: Christian König <[email protected]> for the entire set.

Regards,
Christian.

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 5d07320a29b2..75d5ceaa53c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -184,27 +184,27 @@ static void amdgpu_userq_hang_detect_work(struct 
> work_struct *work)
>  void amdgpu_userq_start_hang_detect_work(struct amdgpu_usermode_queue *queue)
>  {
>       struct amdgpu_device *adev;
> -     unsigned long timeout_ms;
> +     unsigned long timeout_jiffies;
>  
>       adev = queue->userq_mgr->adev;
>       /* Determine timeout based on queue type */
>       switch (queue->queue_type) {
>       case AMDGPU_RING_TYPE_GFX:
> -             timeout_ms = adev->gfx_timeout;
> +             timeout_jiffies = adev->gfx_timeout;
>               break;
>       case AMDGPU_RING_TYPE_COMPUTE:
> -             timeout_ms = adev->compute_timeout;
> +             timeout_jiffies = adev->compute_timeout;
>               break;
>       case AMDGPU_RING_TYPE_SDMA:
> -             timeout_ms = adev->sdma_timeout;
> +             timeout_jiffies = adev->sdma_timeout;
>               break;
>       default:
> -             timeout_ms = adev->gfx_timeout;
> +             timeout_jiffies = adev->gfx_timeout;
>               break;
>       }
>  
>       queue_delayed_work(adev->reset_domain->wq, &queue->hang_detect_work,
> -                        msecs_to_jiffies(timeout_ms));
> +                        timeout_jiffies);
>  }
>  
>  void amdgpu_userq_process_fence_irq(struct amdgpu_device *adev, u32 doorbell)

Reply via email to