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

Christian König christian.koenig at amd.com
Tue Jun 24 13:11:44 UTC 2025


On 24.06.25 11:46, Tvrtko Ursulin wrote:
> 
> 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>

Acked-by: Christian König <christian.koenig at amd.com>

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

That could be because our internal branch is not yet rebased.

> 
> Which would mean adding:
> 
> Fixes: dd64956685fa ("drm/amdgpu: Remove duplicated "context still alive" check")

And maybe CC stable? Or in which release is that patch upstream?

Regards,
Christian.

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