Skip to contentSkip to conversation

drm/amdgpu: Report MES ring wait timeouts.

PATCH Superseded Erhan Bilgili 2 participants 4 messages Oct 26 – Oct 29

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

PATCH 1/1 drm/amdgpu: Report MES ring wait timeouts.

Return -ETIMEDOUT when the fence wait before submission expires instead of reporting success without submitting the packet.

Fixes 34e087e8920e ("drm/amdgpu/mes: fix mes ring buffer overflow")
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +4 -1
index b2e4da70d208..674ef3260001 100644
@@ -218,8 +218,11 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
 	r = amdgpu_fence_wait_polling(ring,
 				      seq - ring->fence_drv.num_fences_mask,
 				      timeout);
-	if (r < 1)
+	if (r < 1) {
+		if (!r)
+			r = -ETIMEDOUT;
 		goto error_undo;
+	}
 
 	api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
 	api_status->api_completion_fence_addr = status_gpu_addr;
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +4 -1
index ce577f49b630..e25d6018fd56 100644
@@ -195,8 +195,11 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
 	r = amdgpu_fence_wait_polling(ring,
 				      seq - ring->fence_drv.num_fences_mask,
 				      timeout);
-	if (r < 1)
+	if (r < 1) {
+		if (!r)
+			r = -ETIMEDOUT;
 		goto error_undo;
+	}
 
 	api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
 	api_status->api_completion_fence_addr = status_gpu_addr;
Signature · 1 line
2.56.0
#1 lore raw
Quoted 17 lines · Erhan Bilgili

Return -ETIMEDOUT when the fence wait before submission expires instead of reporting success without submitting the packet.

Fixes 34e087e8920e ("drm/amdgpu/mes: fix mes ring buffer overflow")
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +0 -0
index b2e4da70d208..674ef3260001 100644

drivers/gpu/drm/amd/amdgpu/mes_v11_0.c static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, · line 222

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +2 -1
@@ -218,8 +218,11 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
        r = amdgpu_fence_wait_polling(ring,
                                      seq - ring->fence_drv.num_fences_mask,
                                      timeout);
-       if (r < 1)
+       if (r < 1) {
+               if (!r)

I think you can just set r = -ETIMEDOUT;. No need to check !r.

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +2 -0
+                       r = -ETIMEDOUT;
                goto error_undo;
+       }
 
        api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
        api_status->api_completion_fence_addr = status_gpu_addr;
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0 -0
index ce577f49b630..e25d6018fd56 100644

drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, · line 200

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +3 -1
@@ -195,8 +195,11 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
        r = amdgpu_fence_wait_polling(ring,
                                      seq - ring->fence_drv.num_fences_mask,
                                      timeout);
-       if (r < 1)
+       if (r < 1) {
+               if (!r)
+                       r = -ETIMEDOUT;

Same here.

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1 -1
                goto error_undo;
+       }
 
        api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
        api_status->api_completion_fence_addr = status_gpu_addr;
--

2.56.0

#2 lore raw

PATCH v2 1/1 drm/amdgpu: Report MES ring wait timeouts.

In reply to Erhan Bilgili

Return -ETIMEDOUT when the fence wait before submission expires instead of reporting success without submitting the packet.

Fixes 34e087e8920e ("drm/amdgpu/mes: fix mes ring buffer overflow")

---
v2: Dropped the redundant check of the wait return value.

 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +3 -1
index b2e4da70d208..8ca487829aaa 100644
@@ -218,8 +218,10 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
 	r = amdgpu_fence_wait_polling(ring,
 				      seq - ring->fence_drv.num_fences_mask,
 				      timeout);
-	if (r < 1)
+	if (r < 1) {
+		r = -ETIMEDOUT;
 		goto error_undo;
+	}
 
 	api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
 	api_status->api_completion_fence_addr = status_gpu_addr;
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +3 -1
index ce577f49b630..a25e6f6d5a71 100644
@@ -195,8 +195,10 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
 	r = amdgpu_fence_wait_polling(ring,
 				      seq - ring->fence_drv.num_fences_mask,
 				      timeout);
-	if (r < 1)
+	if (r < 1) {
+		r = -ETIMEDOUT;
 		goto error_undo;
+	}
 
 	api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
 	api_status->api_completion_fence_addr = status_gpu_addr;
Signature · 1 line
2.56.0
#3 lore raw
Quoted 6 lines · Erhan Bilgili

Return -ETIMEDOUT when the fence wait before submission expires instead of reporting success without submitting the packet.

Fixes 34e087e8920e ("drm/amdgpu/mes: fix mes ring buffer overflow")

Reviewed and applied.

Thanks!

Quoted 42 lines

---
v2: Dropped the redundant check of the wait return value.

 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +3 -1
index b2e4da70d208..8ca487829aaa 100644
@@ -218,8 +218,10 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
        r = amdgpu_fence_wait_polling(ring,
                                      seq - ring->fence_drv.num_fences_mask,
                                      timeout);
-       if (r < 1)
+       if (r < 1) {
+               r = -ETIMEDOUT;
                goto error_undo;
+       }
 
        api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
        api_status->api_completion_fence_addr = status_gpu_addr;
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +3 -2
index ce577f49b630..a25e6f6d5a71 100644
@@ -195,8 +195,10 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
        r = amdgpu_fence_wait_polling(ring,
                                      seq - ring->fence_drv.num_fences_mask,
                                      timeout);
-       if (r < 1)
+       if (r < 1) {
+               r = -ETIMEDOUT;
                goto error_undo;
+       }
 
        api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off);
        api_status->api_completion_fence_addr = status_gpu_addr;
--

2.56.0