From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: SRINIVASAN SHANMUGAM <srinivasan.shanmugam@amd.com>,
amd-gfx@lists.freedesktop.org, alexander.deucher@amd.com
Subject: Re: [PATCH 1/8] drm/amdgpu: grab an additional reference on the gang fence v2
Date: Fri, 14 Mar 2025 15:20:03 +0100 [thread overview]
Message-ID: <ff0378be-671c-4c60-8086-03fb4c21bc0b@gmail.com> (raw)
In-Reply-To: <de0e6edc-c3a8-4c9f-b0f3-37cfd8776db5@amd.com>
Am 14.03.25 um 05:09 schrieb SRINIVASAN SHANMUGAM:
>
> On 3/7/2025 7:18 PM, Christian König wrote:
>> We keep the gang submission fence around in adev, make sure that it
>> stays alive.
>>
>> v2: fix memory leak on retry
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 198d29faa754..337543ec615c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -6889,18 +6889,26 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
>> {
>> struct dma_fence *old = NULL;
>> + dma_fence_get(gang);
>> do {
>> dma_fence_put(old);
>> old = amdgpu_device_get_gang(adev);
>> if (old == gang)
>> break;
>> - if (!dma_fence_is_signaled(old))
>> + if (!dma_fence_is_signaled(old)) {
>
> Here, should we need to check ?
The gang is initialized to a dummy fence on bootup. So even when there is never any gang submission the old value is never NULL.
Regards,
Christian.
>
> // Check if old fence isn't signaled
> if (old && !dma_fence_is_signaled(old)) {
>
>> + dma_fence_put(gang);
>> return old;
>> + }
>> } while (cmpxchg((struct dma_fence __force **)&adev->gang_submit,
>> old, gang) != old);
>> + /*
>> + * Drop it once for the exchanged reference in adev and once for the
>> + * thread local reference acquired in amdgpu_device_get_gang().
>> + */
>> + dma_fence_put(old);
>
> if (old)
> dma_fence_put(old); // Ensure to release old reference only if it is valid?
>
>
>> dma_fence_put(old);
>> return NULL;
>> }
next prev parent reply other threads:[~2025-03-14 14:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 13:48 [PATCH 1/8] drm/amdgpu: grab an additional reference on the gang fence v2 Christian König
2025-03-07 13:48 ` [PATCH 2/8] drm/amdgpu: use GFP_NOWAIT for memory allocations Christian König
2025-03-07 13:48 ` [PATCH 3/8] drm/amdgpu: overwrite signaled fence in amdgpu_sync Christian König
2025-03-12 15:06 ` SRINIVASAN SHANMUGAM
2025-03-14 14:13 ` Christian König
2025-03-07 13:48 ` [PATCH 4/8] drm/amdgpu: rework how isolation is enforced v2 Christian König
2025-03-14 7:07 ` Christian König
2025-03-07 13:48 ` [PATCH 5/8] drm/amdgpu: rework how the cleaner shader is emitted v3 Christian König
2025-03-14 4:24 ` SRINIVASAN SHANMUGAM
2025-03-14 14:21 ` Christian König
2025-03-07 13:48 ` [PATCH 6/8] drm/amdgpu: stop reserving VMIDs to enforce isolation Christian König
2025-03-12 15:10 ` SRINIVASAN SHANMUGAM
2025-03-14 14:15 ` Christian König
2025-03-12 15:16 ` SRINIVASAN SHANMUGAM
2025-03-07 13:48 ` [PATCH 7/8] drm/amdgpu: add isolation trace point Christian König
2025-03-07 13:48 ` [PATCH 8/8] drm/amdgpu: add cleaner shader " Christian König
2025-03-14 4:09 ` [PATCH 1/8] drm/amdgpu: grab an additional reference on the gang fence v2 SRINIVASAN SHANMUGAM
2025-03-14 14:20 ` Christian König [this message]
2025-03-15 2:20 ` SRINIVASAN SHANMUGAM
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff0378be-671c-4c60-8086-03fb4c21bc0b@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=srinivasan.shanmugam@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.