AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9
@ 2021-11-04  9:40 YuBiao Wang
  2021-11-04  9:53 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: YuBiao Wang @ 2021-11-04  9:40 UTC (permalink / raw)
  To: amd-gfx
  Cc: YuBiao Wang, Andrey Grodzovsky, Jack Xiao, Feifei Xu, horace.chen,
	Kevin Wang, Tuikov Luben, Deucher Alexander, Jingwen Chen,
	Evan Quan, Christian König, Monk Liu, Hawking Zhang

[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.

Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 7f944bb11298..be803ebd543c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -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,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9
  2021-11-04  9:40 [PATCH] drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9 YuBiao Wang
@ 2021-11-04  9:53 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2021-11-04  9:53 UTC (permalink / raw)
  To: YuBiao Wang, amd-gfx
  Cc: Andrey Grodzovsky, Jack Xiao, Feifei Xu, horace.chen, Kevin Wang,
	Tuikov Luben, Deucher Alexander, Evan Quan, Jingwen Chen,
	Monk Liu, Hawking Zhang

Am 04.11.21 um 10:40 schrieb YuBiao Wang:
> [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.
>
> Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 7f944bb11298..be803ebd543c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -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,


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-04  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-04  9:40 [PATCH] drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9 YuBiao Wang
2021-11-04  9:53 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox