Skip to content

Commit 86790e3

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Increase reset counter only on success
Increment the reset counter only if soft recovery succeeded. This is consistent with a ring hard reset behaviour where counter gets incremented only if hard reset succeeded. Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 25c314a) Cc: [email protected]
1 parent 4c1a0fc commit 86790e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
427427
{
428428
unsigned long flags;
429429
ktime_t deadline;
430+
bool ret;
430431

431432
if (unlikely(ring->adev->debug_disable_soft_recovery))
432433
return false;
@@ -441,12 +442,16 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
441442
dma_fence_set_error(fence, -ENODATA);
442443
spin_unlock_irqrestore(fence->lock, flags);
443444

444-
atomic_inc(&ring->adev->gpu_reset_counter);
445445
while (!dma_fence_is_signaled(fence) &&
446446
ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0)
447447
ring->funcs->soft_recovery(ring, vmid);
448448

449-
return dma_fence_is_signaled(fence);
449+
ret = dma_fence_is_signaled(fence);
450+
/* increment the counter only if soft reset worked */
451+
if (ret)
452+
atomic_inc(&ring->adev->gpu_reset_counter);
453+
454+
return ret;
450455
}
451456

452457
/*

0 commit comments

Comments
 (0)