From: "Christian König" <christian.koenig@amd.com>
To: "Kuehling, Felix" <felix.kuehling@amd.com>,
phasta@kernel.org, alexdeucher@gmail.com, simona.vetter@ffwll.ch,
tursulin@ursulin.net, airlied@gmail.com, matthew.brost@intel.com
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 11/20] drm/amdgpu: fix KFD eviction fence enable_signaling path
Date: Thu, 6 Nov 2025 18:09:52 +0100 [thread overview]
Message-ID: <a01fa221-401f-4548-80d8-5d687e93dbee@amd.com> (raw)
In-Reply-To: <5ddb1da4-84e6-48f6-a9d4-10560f58ab90@amd.com>
On 11/6/25 18:07, Kuehling, Felix wrote:
>
> On 2025-11-06 11:46, Christian König wrote:
>> On 11/6/25 17:37, Kuehling, Felix wrote:
>>> On 2025-11-06 08:43, Christian König wrote:
>>>> On 11/4/25 17:28, Philipp Stanner wrote:
>>>>> On Fri, 2025-10-31 at 14:16 +0100, Christian König wrote:
>>>>>> Calling dma_fence_is_signaled() here is illegal!
>>>>> The series was sent as a v2. But is this still an RFC?
>>>> I think when Matthew came up with the XE patches we pretty much agreed that this is the way to go.
>>>>
>>>>> If not, more detailed commit messages are a desirable thing.
>>>> Good point, how about:
>>>>
>>>> The enable_signaling callback is called with the same irqsave spinlock held than dma_fence_is_signaled() tries to grab. That will 100% reliable deadlock if that happens.
>>> I guess we could use dma_fence_is_signaled_locked instead. That said, it only tries to take the lock (in dma_fence_signal) if fence->ops->signal is set, which isn't the case for these fences. That's why this has never caused a problem up till now.
>> But when fence->ops->signal isn't set then why are we calling this?
>
> There is no need to enable-signaling (and trigger a preemption), if the eviction fence has already signaled.
But when the evicted fence has already been signaled then enable_signaling is not called in the first place:
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
return false;
if (!was_set && fence->ops->enable_signaling) {
trace_dma_fence_enable_signal(fence);
if (!fence->ops->enable_signaling(fence)) {
...
So the extra check is actually completely superfluous as far as I can see.
Regards,
Christian.
>
> Regards,
> Felix
>
>
>>
>> Regards,
>> Christian.
>>
>>> Regards,
>>> Felix
>>>
>>>
>>>> Thanks,
>>>> Christian.
>>>>
>>>>> P.
>>>>>
>>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>>> ---
>>>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 6 ------
>>>>>> 1 file changed, 6 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
>>>>>> index 1ef758ac5076..09c919f72b6c 100644
>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
>>>>>> @@ -120,12 +120,6 @@ static bool amdkfd_fence_enable_signaling(struct
>>>>>> dma_fence *f)
>>>>>> {
>>>>>> struct amdgpu_amdkfd_fence *fence =
>>>>>> to_amdgpu_amdkfd_fence(f);
>>>>>> - if (!fence)
>>>>>> - return false;
>>>>>> -
>>>>>> - if (dma_fence_is_signaled(f))
>>>>>> - return true;
>>>>>> -
>>>>>> if (!fence->svm_bo) {
>>>>>> if
>>>>>> (!kgd2kfd_schedule_evict_and_restore_process(fence->mm, f))
>>>>>> return true;
next prev parent reply other threads:[~2025-11-06 17:10 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 13:16 Independence for dma_fences! v2 Christian König
2025-10-31 13:16 ` [PATCH 01/20] dma-buf: cleanup dma_fence_describe v2 Christian König
2025-10-31 14:04 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 02/20] dma-buf: rework stub fence initialisation v2 Christian König
2025-10-31 14:05 ` Tvrtko Ursulin
2025-11-04 15:01 ` Tvrtko Ursulin
2025-11-06 13:16 ` Christian König
2025-10-31 13:16 ` [PATCH 03/20] dma-buf: protected fence ops by RCU v2 Christian König
2025-10-31 14:29 ` Tvrtko Ursulin
2025-11-06 13:14 ` Christian König
2025-11-07 11:09 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 04/20] dma-buf: detach fence ops on signal Christian König
2025-11-07 11:04 ` Philipp Stanner
2025-10-31 13:16 ` [PATCH 05/20] dma-buf: inline spinlock for fence protection Christian König
2025-11-07 11:59 ` Philipp Stanner
2025-10-31 13:16 ` [PATCH 06/20] dma-buf: use inline lock for the stub fence Christian König
2025-11-04 15:05 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 07/20] dma-buf: use inline lock for the dma-fence-array Christian König
2025-11-05 8:50 ` Tvrtko Ursulin
2025-11-07 12:04 ` Philipp Stanner
2025-11-12 13:53 ` Christian König
2025-11-12 14:00 ` Philipp Stanner
2025-10-31 13:16 ` [PATCH 08/20] dma-buf: use inline lock for the dma-fence-chain Christian König
2025-11-04 15:08 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 09/20] drm/sched: use inline locks for the drm-sched-fence Christian König
2025-11-04 15:12 ` Tvrtko Ursulin
2025-11-06 13:23 ` Christian König
2025-11-06 13:45 ` Tvrtko Ursulin
2025-11-07 8:33 ` Philipp Stanner
2025-11-12 13:58 ` Christian König
2025-10-31 13:16 ` [PATCH 10/20] drm/amdgpu: clean up and unify hw fence handling Christian König
2025-11-04 15:14 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 11/20] drm/amdgpu: fix KFD eviction fence enable_signaling path Christian König
2025-11-04 16:28 ` Philipp Stanner
2025-11-06 13:43 ` Christian König
2025-11-06 16:37 ` Kuehling, Felix
2025-11-06 16:46 ` Christian König
2025-11-06 17:07 ` Kuehling, Felix
2025-11-06 17:09 ` Christian König [this message]
2025-11-06 17:25 ` Kuehling, Felix
2025-11-13 14:37 ` Christian König
2025-11-13 17:46 ` Kuehling, Felix
2025-10-31 13:16 ` [PATCH 12/20] drm/amdgpu: independence for the amdgpu_fence! Christian König
2025-10-31 13:16 ` [PATCH 13/20] drm/amdgpu: independence for the amdgpu_eviction_fence! Christian König
2025-11-04 15:45 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 14/20] drm/amdgpu: independence for the amdgpu_vm_tlb_fence! Christian König
2025-11-04 15:45 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 15/20] drm/amdgpu: independence for the amdkfd_fence! Christian König
2025-10-31 14:34 ` Kuehling, Felix
2025-10-31 13:16 ` [PATCH 16/20] drm/amdgpu: independence for the amdgpu_userq__fence! Christian König
2025-11-04 15:59 ` Tvrtko Ursulin
2025-10-31 13:16 ` [PATCH 17/20] drm/xe: Disconnect the low hanging fences from Xe module Christian König
2025-10-31 13:16 ` [PATCH 18/20] drm/xe: Drop HW fence slab Christian König
2025-10-31 13:16 ` [PATCH 19/20] drm/xe: Promote xe_hw_fence_irq to an ref counted object Christian König
2025-10-31 13:16 ` [PATCH 20/20] drm/xe: Finish disconnect HW fences from module 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=a01fa221-401f-4548-80d8-5d687e93dbee@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=matthew.brost@intel.com \
--cc=phasta@kernel.org \
--cc=simona.vetter@ffwll.ch \
--cc=tursulin@ursulin.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox