NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Alistair Popple" <apopple@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: <aliceryhl@google.com>, <airlied@gmail.com>, <simona@ffwll.ch>,
	<daniel.almeida@collabora.com>, <acourbot@nvidia.com>,
	<ecourtney@nvidia.com>, <deborah.brouwer@collabora.com>,
	<lyude@redhat.com>, <ojeda@kernel.org>, <boqun@kernel.org>,
	<gary@garyguo.net>, <bjorn3_gh@protonmail.com>,
	<lossin@kernel.org>, <a.hindborg@kernel.org>, <tmgross@umich.edu>,
	<driver-core@lists.linux.dev>, <nova-gpu@lists.linux.dev>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	<rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH 2/6] rust: drm: Add UnbindGuard for drm_dev_enter/exit critical sections
Date: Wed, 27 May 2026 20:47:47 +0100	[thread overview]
Message-ID: <DITPVW44P95X.18VRH23M2Q0AI@garyguo.net> (raw)
In-Reply-To: <ahZBOXFh7rb7vxzX@nvdebian.thelocal>

On Wed May 27, 2026 at 2:03 AM BST, Alistair Popple wrote:
> On 2026-05-26 at 16:17 +1000, Alistair Popple <apopple@nvidia.com> wrote...
>> On 2026-05-07 at 08:06 +1000, Danilo Krummrich <dakr@kernel.org> wrote...
>> > DRM ioctls do not guarantee that the parent bus device is still bound.
>> > However, since DRM device registration is managed through Devres, using
>> > drm_dev_unplug() on unregistration ensures that between drm_dev_enter()
>> > and drm_dev_exit() the parent device must be bound.
>> > 
>> > Add UnbindGuard, a guard object representing a drm_dev_enter/exit SRCU
>> > critical section that dereferences to &Device<Bound> of the parent bus
>> > device. The guard is only available on Device<T, Registered>, ensuring
>> > it cannot be used on unregistered devices.
>> > 
>> > Also add with_unbind_guard() as a convenience helper that executes a
>> > closure with the bound device reference.
>> > 
>> > Switch Registration::drop from drm_dev_unregister() to drm_dev_unplug()
>> > to provide the SRCU barrier that UnbindGuard's safety argument relies on.
>> 
>> I don't (yet) claim to be a Rust-for-Linux expert but reading through this made
>> sense to me and it's been useful for some Nova development so feel free to add:
>> 
>> Reviewed-by: Alistair Popple <apopple@nvidia.com>
>> 
>> for whatever that is worth :-)
>
> Which is definitely not much :) I just realised this has been replaced by a more
> recent version of this series with 24 patches, so will use that instead.

Are you talking about
https://lore.kernel.org/rust-for-linux/20260525202921.124698-1-dakr@kernel.org?
That's for driver-core, this is for DRM.

Best,
Gary

  reply	other threads:[~2026-05-27 19:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 22:05 [PATCH 0/6] rust: drm: Higher-Ranked Lifetime private data Danilo Krummrich
2026-05-06 22:05 ` [PATCH 1/6] rust: drm: Add Driver::ParentDevice associated type Danilo Krummrich
2026-05-08 21:49   ` lyude
2026-05-06 22:06 ` [PATCH 2/6] rust: drm: Add UnbindGuard for drm_dev_enter/exit critical sections Danilo Krummrich
2026-05-26  6:17   ` Alistair Popple
2026-05-27  1:03     ` Alistair Popple
2026-05-27 19:47       ` Gary Guo [this message]
2026-05-27 19:52   ` Gary Guo
2026-05-06 22:06 ` [PATCH 3/6] rust: drm: Add RegistrationData to drm::Driver Danilo Krummrich
2026-05-27 19:21   ` lyude
2026-05-29  0:15     ` lyude
2026-05-29  1:00       ` lyude
2026-05-06 22:06 ` [PATCH 4/6] rust: drm: Wrap ioctl dispatch in UnbindGuard Danilo Krummrich
2026-05-06 22:06 ` [PATCH 5/6] rust: drm: Pass registration data to ioctl handlers Danilo Krummrich
2026-05-06 22:06 ` [PATCH 6/6] rust: drm: Pass bound parent device " Danilo Krummrich
2026-05-07  9:38 ` [PATCH 0/6] rust: drm: Higher-Ranked Lifetime private data Danilo Krummrich
2026-05-14 18:59   ` Deborah Brouwer
2026-05-14 19:07     ` Danilo Krummrich
2026-05-19 18:59       ` Boris Brezillon
2026-05-19 19:02         ` lyude
2026-05-19 19:28         ` Danilo Krummrich
2026-05-20  6:38           ` Boris Brezillon
2026-05-20 10:55             ` Danilo Krummrich
2026-05-20 11:25               ` Boris Brezillon

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=DITPVW44P95X.18VRH23M2Q0AI@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=deborah.brouwer@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=ecourtney@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    /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