From: "Christian König" <christian.koenig@amd.com>
To: "Paul Cercueil" <paul@crapouillou.net>,
phasta@kernel.org, "Neill Kapron" <nkapron@google.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Al Viro" <viro@zeniv.linux.org.uk>,
"Nuno Sá" <nuno.sa@analog.com>, "Sam Day" <me@samcday.com>,
"Michael Bommarito" <michael.bommarito@gmail.com>,
"Gabriel Prostitis" <prostitisgabriel@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] usb: gadget: f_fs: Remove deprecated dma_fence->ops
Date: Fri, 30 Oct 2026 10:23:20 +0100 [thread overview]
Message-ID: <b1e52411-e866-469d-943f-87922fd31068@amd.com> (raw)
In-Reply-To: <304c061aa5fa7f271acfa74c640ab1f0a40e393c.camel@crapouillou.net>
On 10/29/26 15:18, Paul Cercueil wrote:
> Le jeudi 29 octobre 2026 à 14:49 +0100, Philipp Stanner a écrit :
>> Hi,
>>
>> On Thu, 2026-10-29 at 14:19 +0100, Paul Cercueil wrote:
>>> Hi Philipp,
>>>
>>> For context, this .release() callback was added to avoid the implicit free
>>> of
>>> the base class, which IIRC was a request I got during the review process of
>>> this
>>> change set.
>>
>> Can't say anything about the request you got, but fences are reference-
>> counted and the ability to free itself exists since at least
>> 3c3b177a9369 (2014).
>
> Yes, it already existed when I wrote the code and I was requested to make it
> explicit. Not trying to make a point here, just stating the reasons why it was
> written that way.
>
>> From dma_fence's perspective it's certainly the desired canonical
>> pattern since the release() ops prevents fences from the important
>> feature of decoupling fence producer and consumer.
>
> ACK.
>
>>> I'm personally fine with the change, but do we need a "keep this field at
>>> the
>>> top" comment for the base class in the ffs_dma_fence struct? Or what's the
>>> policy here?
>>
>> When I got into the kernel I was told that it's common practice to
>> always have the base class as the first element. That also allows for
>> obtaining the parent class by a mere pointer-cast instead of
>> container_of.
>>
>> But the reality is also that some users are not aware of this rule. I
>> can document it in a v2 if you like.
>
> Let's wait on feedback from more people. I don't have a strong opinion either
> way.
As far as I know It is indeed common practice , if you want a comment or not on your structure that the base class needs to be the first element or the dma_fence release will break is totally up to you I think.
On the other hand it is maybe possible to provide a dma_fence_alloc_obj() macro which wraps kmalloc_obj and compile time asserts that the member you give for the base class is at offset 0.
Regards,
Christian.
>
> Cheers,
> -Paul
next prev parent reply other threads:[~2026-10-30 9:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 12:51 [PATCH] usb: gadget: f_fs: Remove deprecated dma_fence->ops Philipp Stanner
2026-10-29 13:02 ` sashiko-bot
2026-10-29 13:19 ` Paul Cercueil
2026-10-29 13:49 ` Philipp Stanner
2026-10-29 14:18 ` Paul Cercueil
2026-10-30 9:23 ` Christian König [this message]
2026-10-30 9:08 ` 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=b1e52411-e866-469d-943f-87922fd31068@amd.com \
--to=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=me@samcday.com \
--cc=michael.bommarito@gmail.com \
--cc=nkapron@google.com \
--cc=nuno.sa@analog.com \
--cc=paul@crapouillou.net \
--cc=phasta@kernel.org \
--cc=prostitisgabriel@gmail.com \
--cc=sumit.semwal@linaro.org \
--cc=viro@zeniv.linux.org.uk \
/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