[PATCH 09/31] drm/amdgpu: optimize amdgpu_ring_reemit_unprocessed_jobs()

Alex Deucher alexander.deucher at amd.com
Thu Jun 5 01:45:39 UTC 2025


If we fail to allocate enough ring space to reemit the
previous contents, process all fences, but return
success to avoid an adapter reset.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 3a0e0883bd8e7..717c128b2d6fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -831,8 +831,13 @@ int amdgpu_ring_reemit_unprocessed_jobs(struct amdgpu_ring *ring)
 	/* re-emit the unprocessed ring contents */
 	if (ring->ring_backup_entries_to_copy) {
 		r = amdgpu_ring_alloc(ring, ring->ring_backup_entries_to_copy);
-		if (r)
-			return r;
+		if (r) {
+			/* if we can't re-emit the rest of the ring contents, force completion
+			 * for all jobs, but return success to avoid an adapter reset.
+			 */
+			amdgpu_fence_driver_force_completion(ring);
+			return 0;
+		}
 		/* signal the fence of the bad job */
 		amdgpu_fence_driver_seq_force_completion(ring, ring->ring_bad_seq);
 		for (i = 0; i < ring->ring_backup_entries_to_copy; i++)
-- 
2.49.0



More information about the amd-gfx mailing list