Skip to contentSkip to conversation

drm/amdgpu: fix pin count leak of PDB bo when unref

PATCH In review Guchun Chen 2 participants 3 messages Mar 15, 2022

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

PATCH 2/2 drm/amdgpu: fix pin count leak of PDB bo when unref

Use amdgpu_bo_free_kernel instead of amdgpu_bo_unref to perform a clean unreference job.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 431742eb7811..e4e7e6dbc6fb 100644
@@ -1721,7 +1721,7 @@ static int gmc_v9_0_sw_fini(void *handle)
 	amdgpu_gem_force_release(adev);
 	amdgpu_vm_manager_fini(adev);
 	amdgpu_gart_table_vram_free(adev);
-	amdgpu_bo_unref(&adev->gmc.pdb0_bo);
+	amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, adev->gmc.ptr_pdb0);
 	amdgpu_bo_fini(adev);
 
 	return 0;
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Am 15.03.22 um 08:11 schrieb Guchun Chen:

Quoted 2 lines

Use amdgpu_bo_free_kernel instead of amdgpu_bo_unref to perform a clean unreference job.

I think the subject is incorrect. This doesn't leak the pin count, but rather produces a warning that the BO needs a proper cleanup.

Quoted 1 line

With the subject line re-validated the patch is Reviewed-by: Christian König <[email protected]>

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 431742eb7811..e4e7e6dbc6fb 100644
@@ -1721,7 +1721,7 @@ static int gmc_v9_0_sw_fini(void *handle)
  	amdgpu_gem_force_release(adev);
  	amdgpu_vm_manager_fini(adev);
  	amdgpu_gart_table_vram_free(adev);
-	amdgpu_bo_unref(&adev->gmc.pdb0_bo);
+	amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, adev->gmc.ptr_pdb0);
  	amdgpu_bo_fini(adev);
 
  	return 0;
#2 lore raw

Thanks for your review, Christian. I will send an updated patch set soon. How about patch 1 in my series "[PATCH 1/2] drm/amdgpu: prevent memory wipe in suspend/shutdown stage"?

Regards,
Guchun

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, March 15, 2022 3:22 PM
To: Chen, Guchun <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Pan, Xinhui <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: fix pin count leak of PDB bo when unref

Am 15.03.22 um 08:11 schrieb Guchun Chen:

Quoted 2 lines

Use amdgpu_bo_free_kernel instead of amdgpu_bo_unref to perform a clean unreference job.

I think the subject is incorrect. This doesn't leak the pin count, but rather produces a warning that the BO needs a proper cleanup.

Quoted 1 line

With the subject line re-validated the patch is Reviewed-by: Christian König <[email protected]>

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 431742eb7811..e4e7e6dbc6fb 100644
@@ -1721,7 +1721,7 @@ static int gmc_v9_0_sw_fini(void *handle)
  	amdgpu_gem_force_release(adev);
  	amdgpu_vm_manager_fini(adev);
  	amdgpu_gart_table_vram_free(adev);
-	amdgpu_bo_unref(&adev->gmc.pdb0_bo);
+	amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, adev->gmc.ptr_pdb0);
  	amdgpu_bo_fini(adev);
 
  	return 0;