From: "Christian König" <christian.koenig@amd.com>
To: phasta@kernel.org, Sumit Semwal <sumit.semwal@linaro.org>
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-buf/dma-fence: Mark two callbacks as deprecated
Date: Wed, 23 Sep 2026 17:35:24 +0200 [thread overview]
Message-ID: <c400f12a-04db-45eb-853b-629f19e3060e@amd.com> (raw)
In-Reply-To: <469d5deb2ef644b5d77d21bc2d700443f00c0b4d.camel@mailbox.org>
On 9/23/26 17:27, Philipp Stanner wrote:
> On Wed, 2026-09-23 at 17:13 +0200, Christian König wrote:
>> On 9/23/26 17:03, Philipp Stanner wrote:
>>>
>
> […]
>
>>
>>> Consumers of a fence can instead notify themselves by
>>> + * registering a callback on the fence.
>>
>> Mhm, the wait callback is transparent to consumers it's just that implementations used it for quite a number of different hacks.
>
> Right…
>
> but doesn't the question then become why dma_fence_wait_timeout() even
> exists? IOW, shall we deprecate it, too?
Yes, without the wait callback it is only a wrapper to block the current thread for a dma_fence to signal using a callback.
It's still quite useful to have a common function for that I think.
> It seems to be a reimplementation of waitqueues. The driver could get
> this functionality by using a waitqueue whose event gets triggered by a
> fence callback.
>
> dma_fence_default_wait() interacts directly with the task state with
> __XX_task() functions which looks very.. deep to me :)
That is *exactly* what I pointed out as well >10 years ago before that stuff was merged upstream :)
A wait_event based implementation would be tons of cleaner if you ask me.
>>
>> I would just drop that sentence.
>>
>>> */
>>> signed long (*wait)(struct dma_fence *fence,
>>> bool intr, signed long timeout);
>>> @@ -243,6 +249,8 @@ struct dma_fence_ops {
>>> /**
>>> * @release:
>>> *
>>> + * DEPRECATED!
>>> + *
>>> * Called on destruction of fence to release additional resources.
>>> * Can be called from irq context. This callback is optional. If it is
>>> * NULL, then dma_fence_free() is instead called as the default
>>> @@ -254,6 +262,12 @@ struct dma_fence_ops {
>>> *
>>> * If the callback is implemented the memory backing the dma_fence
>>> * object must be freed RCU safe.
>>> + *
>>> + * Deprecated because it prevents the producer of a fence from
>>> + * unloading. No new users must be implemented. Parties with a
>>> + * hypothetical need for this callback can instead simply and directly
>>> + * perform their custom release operations one RCU grace period after
>>> + * they have signaled the fence.
>>
>> Yeah that is a bit problematic.
>>
>> We need my patch set to explicit signal fences instead of returning true/false from callback for that so that a backend can properly implement this.
>
> Well, what I'm trying to say in this docu is that the driver can kick
> off custom operations that shall be performed once everyone is "done"
> with the fence after signaling it. Any driver data that might still be
> around cannot be accessed by fence consumers after signaling anymore.
> So the driver could trigger cleanup work after a graceperiod, as long
> as it does not involve kfree()-ing the fence itself.
That sounds sane to me, but I'm not sure how to phrase it cleaner either.
For now I'm ok with it, maybe somebody else has a better idea to how write this.
Thanks,
Christian.
>
>
> P.
next prev parent reply other threads:[~2026-09-23 15:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 15:03 Philipp Stanner
2026-09-23 15:13 ` Christian König
2026-09-23 15:27 ` Philipp Stanner
2026-09-23 15:35 ` Christian König [this message]
2026-09-24 8:14 ` Philipp Stanner
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=c400f12a-04db-45eb-853b-629f19e3060e@amd.com \
--to=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=phasta@kernel.org \
--cc=sumit.semwal@linaro.org \
/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
all inboxes | Powered by JetHome®