[AMD Official Use Only - AMD Internal Distribution Only]

Hi Ursulin, Christian,

I find the upstream patch: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dd64956685fa48358c4152d952070c8c073e5f89

May I ask if I can modify the commit msg as:

drm/amdgpu: Fix memory leak in amdgpu_ctx_mgr_entity_fini

patch "dd64956685fa 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.

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

Signed-off-by: Lin.Cao <linca...@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursu...@igalia.com>
Acked-by: Christian König <christian.koe...@amd.com>

Thanks,
Lin
________________________________
From: Koenig, Christian <christian.koe...@amd.com>
Sent: Tuesday, June 24, 2025 21:11
To: Tvrtko Ursulin <tursu...@ursulin.net>; cao, lin <lin....@amd.com>; 
amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Chang, HaiJun <haijun.ch...@amd.com>
Subject: Re: [PATCH] drm/amdgpu: put ctx's ref count in 
amdgpu_ctx_mgr_entity_fini()

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.ursu...@igalia.com>

Acked-by: Christian König <christian.koe...@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 <linca...@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);
>>       }
>>   }
>>
>

Reply via email to