Skip to contentSkip to conversation

drm/amdgpu/sdma4:fix sdma engine hang

PATCH In review Emily Deng 2 participants 3 messages Mar 30, 2018 – Apr 2, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu/sdma4:fix sdma engine hang

The sdma doesn't support register write and wait in one command. Use this will make sdma engine hang.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -8
index 9ac28b2..84d148d 100644
@@ -1178,13 +1178,6 @@ static void sdma_v4_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
 	sdma_v4_0_wait_reg_mem(ring, 0, 0, reg, 0, val, mask, 10);
 }
 
-static void sdma_v4_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
-						   uint32_t reg0, uint32_t reg1,
-						   uint32_t ref, uint32_t mask)
-{
-	sdma_v4_0_wait_reg_mem(ring, 0, 1, reg0, reg1, ref, mask, 10);
-}
-
 static int sdma_v4_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1626,7 +1619,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
 	.pad_ib = sdma_v4_0_ring_pad_ib,
 	.emit_wreg = sdma_v4_0_ring_emit_wreg,
 	.emit_reg_wait = sdma_v4_0_ring_emit_reg_wait,
-	.emit_reg_write_reg_wait = sdma_v4_0_ring_emit_reg_write_reg_wait,
+	.emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
 };
 
 static void sdma_v4_0_set_ring_funcs(struct amdgpu_device *adev)
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): 1522398248-9518-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw

The spec claims it does and we use it for HDP flush...

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Emily Deng <[email protected]>
Sent: Friday, March 30, 2018 4:24:08 AM
To: [email protected]
Cc: Deng, Emily
Subject: [PATCH] drm/amdgpu/sdma4:fix sdma engine hang

The sdma doesn't support register write and wait in one command. Use this will make sdma engine hang.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -8
index 9ac28b2..84d148d 100644
@@ -1178,13 +1178,6 @@ static void sdma_v4_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
         sdma_v4_0_wait_reg_mem(ring, 0, 0, reg, 0, val, mask, 10);
 }
 
-static void sdma_v4_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
-                                                  uint32_t reg0, uint32_t reg1,
-                                                  uint32_t ref, uint32_t mask)
-{
-       sdma_v4_0_wait_reg_mem(ring, 0, 1, reg0, reg1, ref, mask, 10);
-}
-
 static int sdma_v4_0_early_init(void *handle)
 {
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1626,7 +1619,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
         .pad_ib = sdma_v4_0_ring_pad_ib,
         .emit_wreg = sdma_v4_0_ring_emit_wreg,
         .emit_reg_wait = sdma_v4_0_ring_emit_reg_wait,
-       .emit_reg_write_reg_wait = sdma_v4_0_ring_emit_reg_write_reg_wait,
+       .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
 };
 
 static void sdma_v4_0_set_ring_funcs(struct amdgpu_device *adev)

--
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): BN6PR12MB1809BFA58237B2C3C27FE1E3F7A10-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author Acked-by Alex Deucher
#4 lore raw

Hi Alex,
When set hdp bit, the poll reg mem command will do follow sequence:
Write reference value to reg0,
Poll reg1,
Compare the reference with the reg1 value&mask(The detail behavior information is from sdma team),
but in our use case the reference value is not equal to mask, also may not equal to the reg1 value, so the compare won't pass, so causes the sdma hang.
Also verified the detail behavior with follow test:
Use the original method to do invalidate request and poll ack, but replace the mask with ref, then the sdma also will hang:
void amdgpu_ring_emit_reg_write_reg_wait_helper(struct amdgpu_ring *ring,

                                                                                                uint32_t reg0, uint32_t reg1,
                                                                                                uint32_t ref, uint32_t mask)
{
                amdgpu_ring_emit_wreg(ring, reg0, ref);
//amdgpu_ring_emit_reg_wait(ring, reg1, mask, mask);
                amdgpu_ring_emit_reg_wait(ring, reg1, ref, mask);
}

Best Wishes,
Emily Deng

From: Deucher, Alexander
Sent: Friday, March 30, 2018 8:55 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu/sdma4:fix sdma engine hang

The spec claims it does and we use it for HDP flush...

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Emily Deng <[email protected]<mailto:[email protected]>>
Sent: Friday, March 30, 2018 4:24:08 AM
To: [email protected]<mailto:[email protected]>
Cc: Deng, Emily
Subject: [PATCH] drm/amdgpu/sdma4:fix sdma engine hang

The sdma doesn't support register write and wait in one command. Use this will make sdma engine hang.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -8
index 9ac28b2..84d148d 100644
@@ -1178,13 +1178,6 @@ static void sdma_v4_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
         sdma_v4_0_wait_reg_mem(ring, 0, 0, reg, 0, val, mask, 10);
 }
 
-static void sdma_v4_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
-                                                  uint32_t reg0, uint32_t reg1,
-                                                  uint32_t ref, uint32_t mask)
-{
-       sdma_v4_0_wait_reg_mem(ring, 0, 1, reg0, reg1, ref, mask, 10);
-}
-
 static int sdma_v4_0_early_init(void *handle)
 {
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1626,7 +1619,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
         .pad_ib = sdma_v4_0_ring_pad_ib,
         .emit_wreg = sdma_v4_0_ring_emit_wreg,
         .emit_reg_wait = sdma_v4_0_ring_emit_reg_wait,
-       .emit_reg_write_reg_wait = sdma_v4_0_ring_emit_reg_write_reg_wait,
+       .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
 };
 
 static void sdma_v4_0_set_ring_funcs(struct amdgpu_device *adev)

--
2.7.4

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

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