[PATCH 2/3] drm/amdgpu: Determine soft recovery deadline next to usage

Christian König christian.koenig at amd.com
Fri Mar 8 08:23:05 UTC 2024


Am 07.03.24 um 20:04 schrieb Joshua Ashton:
> Otherwise we are determining this timeout based on
> a time before we go into some unrelated spinlock,
> which is bad.

Actually I don't think that this is a good idea.

The spinlock is the fence processing lock, so when fence processing is 
blocking this with activity it is perfectly valid and desirable that the 
timeout is decreased.

Regards,
Christian.

>
> Signed-off-by: Joshua Ashton <joshua at froggi.es>
>
> Cc: Friedrich Vock <friedrich.vock at gmx.de>
> Cc: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: André Almeida <andrealmeid at igalia.com>
> Cc: stable at vger.kernel.org
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 5505d646f43a..57c94901ed0a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -439,8 +439,6 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
>   	if (unlikely(ring->adev->debug_disable_soft_recovery))
>   		return false;
>   
> -	deadline = ktime_add_us(ktime_get(), 10000);
> -
>   	if (amdgpu_sriov_vf(ring->adev) || !ring->funcs->soft_recovery || !fence)
>   		return false;
>   
> @@ -450,6 +448,7 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
>   	spin_unlock_irqrestore(fence->lock, flags);
>   
>   	atomic_inc(&ring->adev->gpu_reset_counter);
> +	deadline = ktime_add_us(ktime_get(), 10000);
>   	while (!dma_fence_is_signaled(fence) &&
>   	       ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0)
>   		ring->funcs->soft_recovery(ring, vmid);



More information about the amd-gfx mailing list