Skip to contentSkip to conversation

drm/amdgpu: force complete the MES scheduler ring fences on reset

PATCH In review Jesse Zhang 2 participants 2 messages Aug 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: force complete the MES scheduler ring fences on reset

The MES scheduler ring has no drm scheduler (no_scheduler = true), so it is skipped by the force-completion loop in amdgpu_device_pre_asic_reset(). It uses a polling fence whose hw value lives in wb (GTT) memory and survives a MODE1 reset, while fence_drv.sync_seq keeps advancing for every packet.

When the reset is triggered because MES itself stopped responding, the timed-out packets advance sync_seq past the last hw fence value MES wrote. After resume the first MES submission polls forever on a seq that is never written back, failing the resume and wedging the box on a second reset:

amdgpu: MES ring buffer is full.
amdgpu: *ERROR* ring gfx_0.0.0 test failed (-110)
amdgpu: resume of IP block <gfx_v11_0> failed -110
amdgpu: GPU reset end with ret = -110

Force complete the MES scheduler ring fences together with the scheduler rings so their hw fence is realigned to sync_seq.

v2: cover all XCCs (one scheduler ring each), not just mes.ring[0].

---

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +13 -0
index 520fd59036d5..e2b8253489f3 100644
@@ -5036,6 +5036,19 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
 		amdgpu_fence_driver_force_completion(ring, fence);
 	}
 
+	/*
+	 * MES scheduler rings have no drm scheduler, so they are missed by the
+	 * loop above. Realign their polling fence too (one per XCC), otherwise the
+	 * first post-reset submission polls forever on a stale seq. sched.ready
+	 * skips KIQ pipes.
+	 */
+	for (i = 0; i < AMDGPU_MAX_MES_INST_PIPES; i++) {
+		struct amdgpu_ring *mes_ring = &adev->mes.ring[i];
+
+		if (mes_ring->fence_drv.initialized && mes_ring->sched.ready)
+			amdgpu_fence_driver_force_completion(mes_ring, fence);
+	}
+
 	amdgpu_fence_driver_isr_toggle(adev, false);
 
 	r = amdgpu_reset_prepare_hwcontext(adev, reset_context);
Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 16 lines · Jesse Zhang

The MES scheduler ring has no drm scheduler (no_scheduler = true), so it is skipped by the force-completion loop in amdgpu_device_pre_asic_reset(). It uses a polling fence whose hw value lives in wb (GTT) memory and survives a MODE1 reset, while fence_drv.sync_seq keeps advancing for every packet.

When the reset is triggered because MES itself stopped responding, the timed-out packets advance sync_seq past the last hw fence value MES wrote. After resume the first MES submission polls forever on a seq that is never written back, failing the resume and wedging the box on a second reset:

amdgpu: MES ring buffer is full.
amdgpu: *ERROR* ring gfx_0.0.0 test failed (-110)
amdgpu: resume of IP block <gfx_v11_0> failed -110
amdgpu: GPU reset end with ret = -110

Quoted 6 lines

Force complete the MES scheduler ring fences together with the scheduler rings so their hw fence is realigned to sync_seq.

v2: cover all XCCs (one scheduler ring each), not just mes.ring[0].

KIQ needs a similar fix. It also sets ring->no_scheduler = true.

Alex

Quoted 32 lines

---

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +13 -1
index 520fd59036d5..e2b8253489f3 100644
@@ -5036,6 +5036,19 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
                amdgpu_fence_driver_force_completion(ring, fence);
        }
 
+       /*
+        * MES scheduler rings have no drm scheduler, so they are missed by the
+        * loop above. Realign their polling fence too (one per XCC), otherwise the
+        * first post-reset submission polls forever on a stale seq. sched.ready
+        * skips KIQ pipes.
+        */
+       for (i = 0; i < AMDGPU_MAX_MES_INST_PIPES; i++) {
+               struct amdgpu_ring *mes_ring = &adev->mes.ring[i];
+
+               if (mes_ring->fence_drv.initialized && mes_ring->sched.ready)
+                       amdgpu_fence_driver_force_completion(mes_ring, fence);
+       }
+
        amdgpu_fence_driver_isr_toggle(adev, false);
 
        r = amdgpu_reset_prepare_hwcontext(adev, reset_context);
--

2.49.0