summary refs log tree commit diff
diff options
context:
space:
mode:
authorFriedrich Vock <friedrich.vock@gmx.de>2024-01-18 19:54:02 +0100
committerJoshua Ashton <joshua@froggi.es>2024-01-18 21:47:54 +0000
commiteb28f7ee3c8d4f695b4360d5a73e40fcf78f6fd2 (patch)
tree6083c832ed9df7c88626eebe45a087f2e552d83d
parent6776ea1fdbdfd291370e638736ef588d14ec68d7 (diff)
downloadlinux-eb28f7ee3c8d4f695b4360d5a73e40fcf78f6fd2.tar.gz
drm/amdgpu: Process fences on IH overflow
If the IH ring buffer overflows, it's possible that fence signal events
were lost. Check each ring for progress to prevent job timeouts/GPU
hangs due to the fences staying unsignaled despite the work being done.

Cc: Joshua Ashton <joshua@froggi.es>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org

Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
index fceb3b384955..122f5d0000ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
@@ -205,6 +205,7 @@ int amdgpu_ih_process(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih)
 {
 	unsigned int count;
 	u32 wptr;
+	int i;
 
 	if (!ih->enabled || adev->shutdown)
 		return IRQ_NONE;
@@ -223,6 +224,21 @@ restart_ih:
 		ih->rptr &= ih->ptr_mask;
 	}
 
+	/* If the ring buffer overflowed, we might have lost some fence
+	 * signal interrupts. Check if there was any activity so the signal
+	 * doesn't get lost.
+	 */
+	if (ih->overflow) {
+		for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
+			struct amdgpu_ring *ring = adev->rings[i];
+
+			if (!ring || !ring->fence_drv.initialized)
+				continue;
+			amdgpu_fence_process(ring);
+		}
+		ih->overflow = false;
+	}
+
 	amdgpu_ih_set_rptr(adev, ih);
 	wake_up_all(&ih->wait_process);