Skip to contentSkip to conversation

drm/amdgpu: fix reload KMD hang on GFX10 KIQ

PATCH In review Monk Liu 3 participants 3 messages Aug 10, 2020

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix reload KMD hang on GFX10 KIQ

GFX10 KIQ will hang if we try below steps:
modprobe amdgpu
rmmod amdgpu
modprobe amdgpu sched_hw_submission=4

Due to KIQ is always living there even after KMD unloaded thus when doing the realod KIQ will crash upon its register being programed by different values with the previous loading (the config like HQD addr, ring size, is easily changed if we alter the sched_hw_submission)

the fix is we must inactive KIQ first before touching any of its registgers

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
index 622f442..0702c94 100644
@@ -6435,6 +6435,10 @@ static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring)
 	struct v10_compute_mqd *mqd = ring->mqd_ptr;
 	int j;
 
+	/* inactivate the queue */
+	if (amdgpu_sriov_vf(adev))
+		WREG32_SOC15(GC, 0, mmCP_HQD_ACTIVE, 0);
+
 	/* disable wptr polling */
 	WREG32_FIELD15(GC, 0, CP_PQ_WPTR_POLL_CNTL, EN, 0);
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Quoted 45 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Monk Liu
Sent: Monday, August 10, 2020 11:59 AM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu: fix reload KMD hang on GFX10 KIQ

GFX10 KIQ will hang if we try below steps:
modprobe amdgpu
rmmod amdgpu
modprobe amdgpu sched_hw_submission=4

Due to KIQ is always living there even after KMD unloaded thus when doing the realod KIQ will crash upon its register being programed by different values with the previous loading (the config like HQD addr, ring size, is easily changed if we alter the sched_hw_submission)

the fix is we must inactive KIQ first before touching any of its registgers

---
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++++

1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -1
index 622f442..0702c94 100644
@@ -6435,6 +6435,10 @@ static int gfx_v10_0_kiq_init_register(struct
 amdgpu_ring *ring)
 struct v10_compute_mqd *mqd = ring->mqd_ptr;
 int j;
 
+/* inactivate the queue */
+if (amdgpu_sriov_vf(adev))
+WREG32_SOC15(GC, 0, mmCP_HQD_ACTIVE, 0);
+
 /* disable wptr polling */
 WREG32_FIELD15(GC, 0, CP_PQ_WPTR_POLL_CNTL, EN, 0);
 
--

2.7.4

Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.fre
edesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&amp;data=02%7C01%7CEmily.Deng%40amd.com%7C07fdd33db9d74d6cf 25808d83ce1cc84%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7 C637326287807233108&amp;sdata=Ab4%2BYW%2BTg42YDOqD1RdAKJk9xsT 5RLAQj5LSEzuGzZU%3D&amp;reserved=0

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

#2 lore raw
In reply to Monk Liu

Am 10.08.20 um 05:59 schrieb Monk Liu:

Quoted 24 lines

GFX10 KIQ will hang if we try below steps:
modprobe amdgpu
rmmod amdgpu
modprobe amdgpu sched_hw_submission=4

Due to KIQ is always living there even after KMD unloaded thus when doing the realod KIQ will crash upon its register being programed by different values with the previous loading (the config like HQD addr, ring size, is easily changed if we alter the sched_hw_submission)

the fix is we must inactive KIQ first before touching any of its registgers

---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
index 622f442..0702c94 100644

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring) · line 6439

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -0
@@ -6435,6 +6435,10 @@ static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring)
  	struct v10_compute_mqd *mqd = ring->mqd_ptr;
  	int j;
 
+	/* inactivate the queue */
+	if (amdgpu_sriov_vf(adev))

Could you think of any reason why we shouldn't do this on bare metal as well?

I mean it can't hurt to be extra careful even if the KIQ shouldn't be running.

Christian.

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring) · line 6444

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -0
+		WREG32_SOC15(GC, 0, mmCP_HQD_ACTIVE, 0);
+
  	/* disable wptr polling */
  	WREG32_FIELD15(GC, 0, CP_PQ_WPTR_POLL_CNTL, EN, 0);
 

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