Skip to content

Commit 62f2a58

Browse files
Lijo Lazargregkh
authored andcommitted
drm/amdgpu: Increase reset counter only on success
commit 86790e3 upstream. 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> (cherry picked from commit 25c314a) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 228ad2a commit 62f2a58

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
@@ -439,6 +439,7 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
439439
{
440440
unsigned long flags;
441441
ktime_t deadline;
442+
bool ret;
442443

443444
if (unlikely(ring->adev->debug_disable_soft_recovery))
444445
return false;
@@ -453,12 +454,16 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid,
453454
dma_fence_set_error(fence, -ENODATA);
454455
spin_unlock_irqrestore(fence->lock, flags);
455456

456-
atomic_inc(&ring->adev->gpu_reset_counter);
457457
while (!dma_fence_is_signaled(fence) &&
458458
ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0)
459459
ring->funcs->soft_recovery(ring, vmid);
460460

461-
return dma_fence_is_signaled(fence);
461+
ret = dma_fence_is_signaled(fence);
462+
/* increment the counter only if soft reset worked */
463+
if (ret)
464+
atomic_inc(&ring->adev->gpu_reset_counter);
465+
466+
return ret;
462467
}
463468

464469
/*

0 commit comments

Comments
 (0)