Skip to content

Commit 25c314a

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 <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 9ad7353 commit 25c314a

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
@@ -459,6 +459,7 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
459459
{
460460
unsigned long flags;
461461
ktime_t deadline;
462+
bool ret;
462463

463464
if (unlikely(ring->adev->debug_disable_soft_recovery))
464465
return false;
@@ -473,12 +474,16 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
473474
dma_fence_set_error(fence, -ENODATA);
474475
spin_unlock_irqrestore(fence->lock, flags);
475476

476-
atomic_inc(&ring->adev->gpu_reset_counter);
477477
while (!dma_fence_is_signaled(fence) &&
478478
ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0)
479479
ring->funcs->soft_recovery(ring, vmid);
480480

481-
return dma_fence_is_signaled(fence);
481+
ret = dma_fence_is_signaled(fence);
482+
/* increment the counter only if soft reset worked */
483+
if (ret)
484+
atomic_inc(&ring->adev->gpu_reset_counter);
485+
486+
return ret;
482487
}
483488

484489
/*

0 commit comments

Comments
 (0)