Skip to contentSkip to conversation

drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9

PATCH In review YuBiao Wang 2 participants 2 messages Nov 4, 2021

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

PATCH 1/1 drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9

[Why]
csb bo is not unpinned in gfx 9. It will lead to pin_count leak on driver unload.

[How]
Call bo_free_kernel corresponding to bo_create_kernel in gfx_rlc_init_csb. This will also unify the code path with other gfx versions.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 7f944bb11298..be803ebd543c 100644
@@ -2462,7 +2462,9 @@ static int gfx_v9_0_sw_fini(void *handle)
 	amdgpu_gfx_kiq_fini(adev);
 
 	gfx_v9_0_mec_fini(adev);
-	amdgpu_bo_unref(&adev->gfx.rlc.clear_state_obj);
+	amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
+				&adev->gfx.rlc.clear_state_gpu_addr,
+				(void **)&adev->gfx.rlc.cs_ptr);
 	if (adev->flags & AMD_IS_APU) {
 		amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
 				&adev->gfx.rlc.cp_table_gpu_addr,
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 04.11.21 um 10:40 schrieb YuBiao Wang:

Quoted 10 lines

[Why]
csb bo is not unpinned in gfx 9. It will lead to pin_count leak on driver unload.

[How]
Call bo_free_kernel corresponding to bo_create_kernel in gfx_rlc_init_csb. This will also unify the code path with other gfx versions.

Quoted 19 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 7f944bb11298..be803ebd543c 100644
@@ -2462,7 +2462,9 @@ static int gfx_v9_0_sw_fini(void *handle)
  	amdgpu_gfx_kiq_fini(adev);
 
  	gfx_v9_0_mec_fini(adev);
-	amdgpu_bo_unref(&adev->gfx.rlc.clear_state_obj);
+	amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
+				&adev->gfx.rlc.clear_state_gpu_addr,
+				(void **)&adev->gfx.rlc.cs_ptr);
  	if (adev->flags & AMD_IS_APU) {
  		amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
  				&adev->gfx.rlc.cp_table_gpu_addr,