From: "Danilo Krummrich" <dakr@kernel.org>
To: "Philipp Stanner" <phasta@mailbox.org>
Cc: phasta@kernel.org, "Gary Guo" <gary@garyguo.net>,
"Alice Ryhl" <aliceryhl@google.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: DmaFence: Add better warning through Device reference
Date: Mon, 28 Sep 2026 12:43:57 +0200 [thread overview]
Message-ID: <DLQVZ218WBQS.2A4Z1DSNU4I6H@kernel.org> (raw)
In-Reply-To: <a44b26ceb273f0cdfc04a4391040c08386b31e01.camel@mailbox.org>
On Mon Sep 28, 2026 at 10:32 AM CEST, Philipp Stanner wrote:
> On Mon, 2026-09-28 at 10:11 +0200, Danilo Krummrich wrote:
>> On Mon Sep 28, 2026 at 9:52 AM CEST, Philipp Stanner wrote:
>> > > > So I suppose we agree that a warning is fine. It won't fire in JQ
>> > > > anyways, but might benefit others.
>> > >
>> > > What scenario are you thinking of?
>> >
>> > Drivers doing "rather questionable" things, like we've seen a great
>> > many times already ;)
>> >
>> > Note that the dma_fence backend fires a WARN_ON if a fence is freed
>> > unsignaled, too, for the same reason.
>> >
>> > Life finds a way.
>>
>> I'd rather you engage with the arguments I made above and give a concrete
>> example of how it "might benefit others", instead of resorting to know-it-all
>> platitudes.
>
> Stating that I cannot know nor conceive all possible patterns and
> misbehaviors is quite literally me acknowledging that I do *not* "know
> it all".
I mean, you expressed a concern about a fence being signaled before the hardware
has been torn down accordingly. I provided arguments why I don't see that the
concern holds and then you mentioned that the warning "might benefit others".
To me this sounded as if you had concrete scenarios in mind, which doesn't seem
to be the case. If that's correct, and given that there was no reply to my
arguments, it seems we can just remove it.
Maybe to further explain my reasoning:
The concern was that it could happen that the DriverFence is dropped while the
hardware still utilizes the memory "protected" by the fence. As mentioned, to me
this is not a concern because of the programming model we have in Rust. Take
this analogous DMA memory example:
struct Channel<'a> {
shared: dma::Coherent<'a, Data>,
}
impl Drop for Channel<'_> {
fn drop(&mut self) {
self.stop_hardware();
shared.free();
}
}
We could use the exact same argument to require people to explicitly call free()
on a dma::Coherent allocation as the underlying hardware (represented by the
channel) could still use the dma::Coherent allocation if we "drop it
accidentally".
But as you can see, the ownership is already properly expressed by Rust, the
Channel owns the dma::Coherent allocation, so the memory can just be freed in
Coherent::drop().
The same applies to DriverFence, the thing that takes ownership is the thing
that operates the hardware.
> With this patch I was just trying to accommodate your post-merge
> request for replacing pr_ with dev_err() or WARN_ON. If you think
> neither is actually necessary, that's also fine by me.
I did arrive at the conclusion to discuss whether we can't just get rid of the
warning entirely in my first reply [1], which you refer to, already.
[1] https://lore.kernel.org/all/DL9AEUZ4VGV5.2RT33JE0MHYME@kernel.org/
next prev parent reply other threads:[~2026-09-28 10:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 8:19 Philipp Stanner
2026-09-25 10:26 ` Gary Guo
2026-09-25 12:30 ` Danilo Krummrich
2026-09-25 13:08 ` Philipp Stanner
2026-09-25 15:50 ` Danilo Krummrich
2026-09-25 17:21 ` Philipp Stanner
2026-09-25 17:32 ` Danilo Krummrich
2026-09-28 7:52 ` Philipp Stanner
2026-09-28 8:11 ` Danilo Krummrich
2026-09-28 8:32 ` Philipp Stanner
2026-09-28 10:43 ` Danilo Krummrich [this message]
2026-09-25 16:00 ` Danilo Krummrich
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=DLQVZ218WBQS.2A4Z1DSNU4I6H@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=christian.koenig@amd.com \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=phasta@kernel.org \
--cc=phasta@mailbox.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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®