[PATCH] drm/amdgpu: fix userq resource double freed
Christian König
christian.koenig at amd.com
Wed May 14 09:44:37 UTC 2025
On 5/14/25 10:19, Liang, Prike wrote:
> [AMD Official Use Only - AMD Internal Distribution Only]
>
>> From: Koenig, Christian <Christian.Koenig at amd.com>
>> Sent: Wednesday, May 14, 2025 3:02 PM
>> To: Liang, Prike <Prike.Liang at amd.com>; amd-gfx at lists.freedesktop.org
>> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
>> Subject: Re: [PATCH] drm/amdgpu: fix userq resource double freed
>>
>> On 5/12/25 09:30, Prike Liang wrote:
>>> As the userq resource was already freed at the drm_release early
>>> phase, it should avoid freeing userq resource again at the later kms
>>> postclose callback.
>>
>> Clear NAK. You are just hiding a bug.
>>
>> The userq resources should always be only cleaned up here and that function
>> can't be called twice.
> The original issue is that the userq resource is freed first at amdgpu_drm_release(), and then second freed at amdgpu_driver_postclose_km().
> At this point, it's more reasonable to remove the userq resource cleanup at drm file release phase and just keep freeing the userq resource at postclose moment?
Ah! In that case this code here should just be removed.
Regards,
Christian.
>
>>
>> Regards,
>> Christian.
>>
>>>
>>> Signed-off-by: Prike Liang <Prike.Liang at amd.com>
>>> ---
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 9 +++++----
>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> index 8d4a2aed7231..cf0f35a7daee 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> @@ -1502,10 +1502,11 @@ void amdgpu_driver_postclose_kms(struct
>> drm_device *dev,
>>> amdgpu_bo_unreserve(pd);
>>> }
>>>
>>> - fpriv->evf_mgr.fd_closing = true;
>>> - amdgpu_userq_mgr_fini(&fpriv->userq_mgr);
>>> - amdgpu_eviction_fence_destroy(&fpriv->evf_mgr);
>>> -
>>> + if (!fpriv->evf_mgr.fd_closing) {
>>> + fpriv->evf_mgr.fd_closing = true;
>>> + amdgpu_userq_mgr_fini(&fpriv->userq_mgr);
>>> + amdgpu_eviction_fence_destroy(&fpriv->evf_mgr);
>>> + }
>>> amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
>>> amdgpu_vm_fini(adev, &fpriv->vm);
>>>
>
More information about the amd-gfx
mailing list