Skip to contentSkip to conversation

drm/amdgpu: add check before free wb entry

PATCH In review [email protected] 2 participants 2 messages Apr 24, 2024

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

PATCH 1/4 drm/amdgpu: add check before free wb entry

From: Jesse Zhang <[email protected]>

check if ring is not mes queue before free wb entry.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
index 45a2d0a5a2d7..b7d33d78bce0 100644
@@ -999,7 +999,8 @@ static int sdma_v5_0_ring_test_ring(struct amdgpu_ring *ring)
 	r = amdgpu_ring_alloc(ring, 20);
 	if (r) {
 		DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-		amdgpu_device_wb_free(adev, index);
+		if (!ring->is_mes_queue)
+			amdgpu_device_wb_free(adev, index);
 		return r;
 	}
 
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +2 -1
index 43e64b2da575..cc9e961f0078 100644
@@ -839,7 +839,8 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
 	r = amdgpu_ring_alloc(ring, 20);
 	if (r) {
 		DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-		amdgpu_device_wb_free(adev, index);
+		if (!ring->is_mes_queue)
+			amdgpu_device_wb_free(adev, index);
 		return r;
 	}
 
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +2 -1
index 1f4877195213..c833b6b8373b 100644
@@ -861,7 +861,8 @@ static int sdma_v6_0_ring_test_ring(struct amdgpu_ring *ring)
 	r = amdgpu_ring_alloc(ring, 5);
 	if (r) {
 		DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-		amdgpu_device_wb_free(adev, index);
+		if (!ring->is_mes_queue)
+			amdgpu_device_wb_free(adev, index);
 		return r;
 	}
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/4
#1 lore raw
Quoted 4 lines · On Tue, Apr 23, 2024 at 11:27 PM <[email protected]> wrote:

From: Jesse Zhang <[email protected]>

check if ring is not mes queue before free wb entry.

Minor clarification to the commit text:

Check if ring is not a mes queue before freeing the wb entry because we only allocate a wb entry when it's not a mes queue.

With that fixed, the patch is:

Quoted 53 lines
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
index 45a2d0a5a2d7..b7d33d78bce0 100644
@@ -999,7 +999,8 @@ static int sdma_v5_0_ring_test_ring(struct amdgpu_ring *ring)
        r = amdgpu_ring_alloc(ring, 20);
        if (r) {
                DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-               amdgpu_device_wb_free(adev, index);
+               if (!ring->is_mes_queue)
+                       amdgpu_device_wb_free(adev, index);
                return r;
        }
 
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +2 -1
index 43e64b2da575..cc9e961f0078 100644
@@ -839,7 +839,8 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
        r = amdgpu_ring_alloc(ring, 20);
        if (r) {
                DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-               amdgpu_device_wb_free(adev, index);
+               if (!ring->is_mes_queue)
+                       amdgpu_device_wb_free(adev, index);
                return r;
        }
 
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +2 -2
index 1f4877195213..c833b6b8373b 100644
@@ -861,7 +861,8 @@ static int sdma_v6_0_ring_test_ring(struct amdgpu_ring *ring)
        r = amdgpu_ring_alloc(ring, 5);
        if (r) {
                DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-               amdgpu_device_wb_free(adev, index);
+               if (!ring->is_mes_queue)
+                       amdgpu_device_wb_free(adev, index);
                return r;
        }
 
--

2.25.1