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 3/8] drm/amdgpu: overwrite signaled fence in amdgpu_sync
Date: Fri, 14 Mar 2025 15:13:01 +0100 [thread overview]
Message-ID: <898df91a-3831-4d2b-8a06-d8f37fbaefec@gmail.com> (raw)
In-Reply-To: <d16eb6df-8a40-4afd-8099-c218fd43aabc@amd.com>
Am 12.03.25 um 16:06 schrieb SRINIVASAN SHANMUGAM:
>
> On 3/7/2025 7:18 PM, Christian König wrote:
>> This allows using amdgpu_sync even without peeking into the fences for a
>> long time.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> index 86c17a8946f5..bfe12164d27d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> @@ -135,11 +135,16 @@ static bool amdgpu_sync_add_later(struct amdgpu_sync *sync, struct dma_fence *f)
>> struct amdgpu_sync_entry *e;
>> hash_for_each_possible(sync->fences, e, node, f->context) {
>> - if (unlikely(e->fence->context != f->context))
>> - continue;
>> + if (dma_fence_is_signaled(e->fence)) {
>> + dma_fence_put(e->fence);
>> + e->fence = dma_fence_get(f);
>> + return true;
>> + }
>> - amdgpu_sync_keep_later(&e->fence, f);
>> - return true;
>> + if (likely(e->fence->context == f->context)) {
>> + amdgpu_sync_keep_later(&e->fence, f);
> --> The call to amdgpu_sync_keep_later(&e->fence, f); ensures that the new fence is tracked for future synchronization., ie., so If the driver only replaced the old fence without keeping a reference to the new one of the next job or second job for example, it could lead to situations where the synchronization state is lost. This could cause race conditions where one job might proceed before another job has completed, leading to errors. , so this is " amdgpu_sync_keep_later(&e->fence, f);" done, for tracking purpose of next job/second job, if we have multiple jobs in gang submissions of same context/client, is my understanding is correct here pls?
Your questions is not easy to understand, but I think your understanding is correct.
Basically if you have submissions A,B,C to the same ring buffer and the HW guarantees that they execute in order you only need to keep a reference to C to wait for A and B as well.
Regards,
Christian.
>> + return true;
>> + }
>> }
>> return false;
>> }
next prev parent reply other threads:[~2025-03-14 14:13 UTC|newest]
Thread overview: 20+ 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 [this message]
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
2025-03-15 2:20 ` SRINIVASAN SHANMUGAM
-- strict thread matches above, loose matches on Subject: below --
2025-02-18 16:13 [PATCH 1/8] drm/amdgpu: grab an additional reference on the gang fence Christian König
2025-02-18 16:13 ` [PATCH 3/8] drm/amdgpu: overwrite signaled fence in amdgpu_sync Christian König
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=898df91a-3831-4d2b-8a06-d8f37fbaefec@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.