Skip to contentSkip to conversation

drm/amdgpu/gfx8: Fix compute ring failure after resetting

PATCH In review Xiangliang.Yu 2 participants 4 messages Nov 10, 2017 3 messages not in the archive

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

PATCH 1/1 drm/amdgpu/gfx8: Fix compute ring failure after resetting

Do ring clear before ring test, otherwise compute ring test will fail after gpu resetting.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -3
index a74515a..a982919 100644
@@ -4868,9 +4868,6 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
 		/* reset MQD to a clean status */
 		if (adev->gfx.mec.mqd_backup[mqd_idx])
 			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
-		/* reset ring buffer */
-		ring->wptr = 0;
-		amdgpu_ring_clear_ring(ring);
 	} else {
 		amdgpu_ring_clear_ring(ring);
 	}
@@ -4945,6 +4942,11 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 	/* Test KCQs */
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
+		if (adev->in_gpu_reset) {
+			/* reset ring buffer */
+			ring->wptr = 0;
+			amdgpu_ring_clear_ring(ring);
+		}
 		ring->ready = true;
 		r = amdgpu_ring_test_ring(ring);
 		if (r)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1510296717-25096-1-git-send-email-Xiangliang.Yu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

The ring clear is already before "ring test", you patch just postpone the ring clear to an even later point, Do you know the root cause of your fix ?

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Xiangliang.Yu
Sent: 2017年11月10日 14:52
To: [email protected]
Cc: Yu, Xiangliang <[email protected]>
Subject: [PATCH] drm/amdgpu/gfx8: Fix compute ring failure after resetting

Do ring clear before ring test, otherwise compute ring test will fail after gpu resetting.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -3
index a74515a..a982919 100644
@@ -4868,9 +4868,6 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
 		/* reset MQD to a clean status */
 		if (adev->gfx.mec.mqd_backup[mqd_idx])
 			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
-		/* reset ring buffer */
-		ring->wptr = 0;
-		amdgpu_ring_clear_ring(ring);
 	} else {
 		amdgpu_ring_clear_ring(ring);
 	}
@@ -4945,6 +4942,11 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 	/* Test KCQs */
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
+		if (adev->in_gpu_reset) {
+			/* reset ring buffer */
+			ring->wptr = 0;
+			amdgpu_ring_clear_ring(ring);
+		}
 		ring->ready = true;
 		r = amdgpu_ring_test_ring(ring);
 		if (r)

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BY1PR12MB0456E23322CE1E734F00423684540-PicGAnIBOoZZHrdT0E092gdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw
Quoted 2 lines

The ring clear is already before "ring test", you patch just postpone the ring clear to an even later point, Do you know the root cause of your fix ?

Yes, just postpone it. Still can't find the root cause and the issue only happen on gfx8. I'm ok if you can find better solution.

Quoted 49 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Xiangliang.Yu
Sent: 2017年11月10日 14:52
To: [email protected]
Cc: Yu, Xiangliang <[email protected]>
Subject: [PATCH] drm/amdgpu/gfx8: Fix compute ring failure after resetting

Do ring clear before ring test, otherwise compute ring test will fail after gpu resetting.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
index a74515a..a982919 100644
@@ -4868,9 +4868,6 @@ static int gfx_v8_0_kcq_init_queue(struct
 amdgpu_ring *ring)
 		/* reset MQD to a clean status */
 		if (adev->gfx.mec.mqd_backup[mqd_idx])
 			memcpy(mqd, adev-
 >gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
-		/* reset ring buffer */
-		ring->wptr = 0;
-		amdgpu_ring_clear_ring(ring);
 	} else {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -0
 		amdgpu_ring_clear_ring(ring);
 	}
@@ -4945,6 +4942,11 @@ static int gfx_v8_0_kiq_resume(struct
 amdgpu_device *adev)
 	/* Test KCQs */
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
+		if (adev->in_gpu_reset) {
+			/* reset ring buffer */
+			ring->wptr = 0;
+			amdgpu_ring_clear_ring(ring);
+		}
 		ring->ready = true;
 		r = amdgpu_ring_test_ring(ring);

if (r)
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BY2PR1201MB093501B5302E86D581398A5AEB540-O28G1zQ8oGkaqtME6NEo1mrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#6 lore raw

That way please add comments like "w/a for ring test fail after GPU reset, root cause unknown"

Ack-by: Monk

-----Original Message-----
From: Yu, Xiangliang
Sent: 2017年11月10日 16:58
To: Liu, Monk <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu/gfx8: Fix compute ring failure after resetting

Quoted 2 lines

The ring clear is already before "ring test", you patch just postpone the ring clear to an even later point, Do you know the root cause of your fix ?

Yes, just postpone it. Still can't find the root cause and the issue only happen on gfx8. I'm ok if you can find better solution.

Quoted 50 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Xiangliang.Yu
Sent: 2017年11月10日 14:52
To: [email protected]
Cc: Yu, Xiangliang <[email protected]>
Subject: [PATCH] drm/amdgpu/gfx8: Fix compute ring failure after resetting

Do ring clear before ring test, otherwise compute ring test will fail after gpu resetting.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
index a74515a..a982919 100644
@@ -4868,9 +4868,6 @@ static int gfx_v8_0_kcq_init_queue(struct 
 amdgpu_ring *ring)
 		/* reset MQD to a clean status */
 		if (adev->gfx.mec.mqd_backup[mqd_idx])
 			memcpy(mqd, adev-
 >gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
-		/* reset ring buffer */
-		ring->wptr = 0;
-		amdgpu_ring_clear_ring(ring);
 	} else {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -0
 		amdgpu_ring_clear_ring(ring);
 	}
@@ -4945,6 +4942,11 @@ static int gfx_v8_0_kiq_resume(struct 
 amdgpu_device *adev)
 	/* Test KCQs */
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
+		if (adev->in_gpu_reset) {
+			/* reset ring buffer */
+			ring->wptr = 0;
+			amdgpu_ring_clear_ring(ring);
+		}
 		ring->ready = true;
 		r = amdgpu_ring_test_ring(ring);

if (r)
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx