[PATCH] drm/amdgpu: put ctx's ref count in amdgpu_ctx_mgr_entity_fini()

Tvrtko Ursulin tursulin at ursulin.net
Tue Jun 24 09:46:55 UTC 2025


On 24/06/2025 10:18, Lin.Cao wrote:
> patch "daf823f1d0cd drm/amdgpu: Remove duplicated "context still
> alive" check" removed ctx put, which will cause amdgpu_ctx_fini()
> cannot be called and then cause some finished fence that added by
> amdgpu_ctx_add_fence() cannot be released and cause memleak.

Ouch I removed the wrong one. :( Probably misread kref_put as kref_read..

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>

But is the SHA correct? I see it is dd64956685fa.

Which would mean adding:

Fixes: dd64956685fa ("drm/amdgpu: Remove duplicated "context still 
alive" check")

Regards,

Tvrtko

> Signed-off-by: Lin.Cao <lincao12 at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 85567d0d9545..f5d5c45ddc0d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -944,6 +944,7 @@ static void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)
>   				drm_sched_entity_fini(entity);
>   			}
>   		}
> +		kref_put(&ctx->refcount, amdgpu_ctx_fini);
>   	}
>   }
>   



More information about the amd-gfx mailing list