Skip to contentSkip to conversation

drm/amdgpu: Not to finish an uninitialized ring

PATCH In review Trigger Huang 3 participants 3 messages Aug 8, 2017 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: Not to finish an uninitialized ring

If a ring is not initialized, it also should not be finished. For example, in Vega10's SR-IOV environment, UVD's decode ring is not initialized, but will be finnished in amdgpu_uvd_sw_fini, because UVD driver put all the uvd decode ring's finish operation into amdgpu_uvd_sw_fini function, while not uvd_vXXX_0_sw_fini. This will lead to amdgpu module unloading failure.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +4 -0
index 704475674..6c5646b 100644
@@ -261,6 +261,10 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
 {
 	ring->ready = false;
 
+	/* Not to finish a ring which is not initialized */
+	if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
+		return;
+
 	amdgpu_wb_free(ring->adev, ring->rptr_offs);
 	amdgpu_wb_free(ring->adev, ring->wptr_offs);
 
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): 1502189764-11227-1-git-send-email-trigger.huang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Monk Liu
#2 lore raw

Review

Quoted 1 line
(quoted diff) +1 -0
+	/* Not to finish a ring which is not initialized */

Just write "don't finish the ring if not initialized"

With that comment addressed,

-----Original Message-----
From: Trigger Huang [mailto:[email protected]]
Sent: Tuesday, August 8, 2017 6:56 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>; Yu, Xiangliang <[email protected]>; Huang, Trigger <[email protected]>
Subject: [PATCH] drm/amdgpu: Not to finish an uninitialized ring

If a ring is not initialized, it also should not be finished.
For example, in Vega10's SR-IOV environment, UVD's decode ring is not initialized, but will be finnished in amdgpu_uvd_sw_fini, because UVD driver put all the uvd decode ring's finish operation into amdgpu_uvd_sw_fini function, while not uvd_vXXX_0_sw_fini. This will lead to amdgpu module unloading failure.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +4 -1
index 704475674..6c5646b 100644
@@ -261,6 +261,10 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)  {
 	ring->ready = false;
 
+	/* Not to finish a ring which is not initialized */
+	if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
+		return;
+
 	amdgpu_wb_free(ring->adev, ring->rptr_offs);
 	amdgpu_wb_free(ring->adev, ring->wptr_offs);
 
--

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): BLUPR12MB044960035E0F22C79ABC112D848A0-7LeqcoF/[email protected]

#4 lore raw

Am 08.08.2017 um 13:13 schrieb Liu, Monk:

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_fini(struct amdgpu_ring *ring) { · line 263

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -0
+	/* Not to finish a ring which is not initialized */

Just write "don't finish the ring if not initialized"

With that comment addressed,

Additional to that the commit message is to long. Please break it after 80 chars.

With that fixed the patch is Reviewed-by: Christian König <[email protected]>

Quoted 33 lines

-----Original Message-----
From: Trigger Huang [mailto:[email protected]]
Sent: Tuesday, August 8, 2017 6:56 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>; Yu, Xiangliang <[email protected]>; Huang, Trigger <[email protected]>
Subject: [PATCH] drm/amdgpu: Not to finish an uninitialized ring

If a ring is not initialized, it also should not be finished.
For example, in Vega10's SR-IOV environment, UVD's decode ring is not initialized, but will be finnished in amdgpu_uvd_sw_fini, because UVD driver put all the uvd decode ring's finish operation into amdgpu_uvd_sw_fini function, while not uvd_vXXX_0_sw_fini. This will lead to amdgpu module unloading failure.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +4 -1
index 704475674..6c5646b 100644
@@ -261,6 +261,10 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)  {
  	ring->ready = false;
 
+	/* Not to finish a ring which is not initialized */
+	if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
+		return;
+
  	amdgpu_wb_free(ring->adev, ring->rptr_offs);
  	amdgpu_wb_free(ring->adev, ring->wptr_offs);
 
--

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