mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Gary Guo" <gary@garyguo.net>
Cc: "Philipp Stanner" <phasta@kernel.org>,
	"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: Fri, 25 Sep 2026 14:30:17 +0200	[thread overview]
Message-ID: <DLOECU7X3MTR.31Z6N1I0WB0MJ@kernel.org> (raw)
In-Reply-To: <DLOBPY6OBEOG.2Y4I4LRA276WU@garyguo.net>

On Fri Sep 25, 2026 at 12:26 PM CEST, Gary Guo wrote:
> On Fri Sep 25, 2026 at 9:19 AM BST, Philipp Stanner wrote:
>> Replace the warning print with a dev_warn!(). To do so, have the
>> FenceContext carry a reference to a Device, protected by the already
>> present lifetime.
>
> Add a lifetime just to do this a print doesn't sound ideal. You could use
> `ARef<Device>` instead?

Yes, that's what I recommend in general.

Another thing to consider for the DMA fence context specifically, there's two
kinds of users. The absolute majority are drivers; there are very few non-driver
ones (e.g. drm_crtc), which will remain to be C code for at least quite a while.

I think it wouldn't be unreasonable to keep the API driver centric, and in this
case it also wouldn't be unreasonable to add the lifetime, as the T will most
likely carry it anyway, and even if not it wouldn't make sense for the fence
context to outlive driver unbind.

That said, we can also use WARN_ON() instead, which avoids the device dependency
to begin with and still provides enough information to find the "offender".

But as I mentioned previously, I don't consider this that bad of a condition in
the first place. Signaling with ECANCELED on drop() seems perfectly reasonable:

When a driver does a teardown of the channel (or more generically the execution
context) it will follow the RAII pattern, so it will be very natural to just
drop the Jobqueue, which will drop all jobs and hence all DriverFence objects.

IOW, driver will likely invent a new type that does the same thing on drop, just
without the warning. :)

  reply	other threads:[~2026-09-25 12:30 UTC|newest]

Thread overview: 6+ 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 [this message]
2026-09-25 13:08     ` Philipp Stanner
2026-09-25 15:50       ` Danilo Krummrich
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=DLOECU7X3MTR.31Z6N1I0WB0MJ@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=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®