From: "Danilo Krummrich" <dakr@kernel.org>
To: "Boris Brezillon" <boris.brezillon@collabora.com>
Cc: "Deborah Brouwer" <deborah.brouwer@collabora.com>,
<aliceryhl@google.com>, <airlied@gmail.com>, <simona@ffwll.ch>,
<daniel.almeida@collabora.com>, <acourbot@nvidia.com>,
<apopple@nvidia.com>, <ecourtney@nvidia.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 0/6] rust: drm: Higher-Ranked Lifetime private data
Date: Wed, 20 May 2026 12:55:40 +0200 [thread overview]
Message-ID: <DING6NMJ97JA.5HC3ONKUPMW5@kernel.org> (raw)
In-Reply-To: <20260520083813.7addec83@fedora>
On Wed May 20, 2026 at 8:38 AM CEST, Boris Brezillon wrote:
> So, GEM allocation and GPUVM are required are required early on, and
> both want a drm::Device of some sort (Unregistered or Registered). So
> the question is, are you happy with having [1] applied before/after
> your patchset to address this chicken-and-egg issue I mentioned,
Yes, this is exactly what I had in mind for all of my replies, but I think I
only implied my key point rather than making it explicit, so let me do that now.
What I'm saying is that we now have all DRM ioctls behind the SRCU guard, which
means that the drm::Registration data is always available from DRM ioctls.
Now, with this precondition, the real question is whether there are any
resources left that should be bound to the lifetime of the DRM device itself,
which I don't think is the case.
After device unbind nothing is able to call back into the driver anymore, so
there is no reason to keep the corresponding data alive within the driver's
private data.
There may be resources that are kept alive through a separate reference count
while userspace still has open file descriptors, but they are separate reference
counts and should be independent from the driver's private data.
IWO, the fact that we guard the ioctls makes the whole class of problems go away
that we inherit from having to keep the driver's private data alive until after
remvoe() -- the DRM device private data becomes obsolete and we should probably
evene remove it.
Instead, we should use the drm::Registration private data for everything.
With this, your chicken-and-egg issue is already solved; the DRM device is
available, you can populate all the resources you need (GEM, GPUVM, etc.) and
then pass it into drm::Registration::new().
In terms of making any of the resources you store in the drm::Registration data
available in the bus device private data, it becomes the same pattern as for
everything else, i.e. you need shared ownership.
So, let's say you need IoMem<'bound> in both the drm::Registration data and in
the bus device private data, then you currently need Arc<IoMem<'bound>> in both
of them, which is fine, but I think we can do better.
Eventually, once we have landed the series I currently have in flight and once
Gary finished his self-referencial support in pin-init, I think we can even
avoid the reference count. Here is an example.
struct TyrPlatformDriverData<'bound> {
_device: ARef<TyrDrmDevice>,
_reg: drm::Registration<'bound, TyrDrmData<'_>>,
iomem: IoMem<'bound>,
}
struct TyrDrmData<'bound> {
iomem: &'bound IoMem<'bound>,
}
fn probe() -> ... {
try_pin_init!(TyrPlatformDriverData {
_device: ...,
iomem <- ...,
_reg <- drm::Registration::new(..., TyrDrmData { iomem: &iomem }),
})
}
I don't know how the pin-init self-referencial stuff will exactly turn out, but
this is pretty much what I hope we can evolve this into.
(And sorry again, now that I spelled this all out, having that left implicit in
my first reply was obviously unreasonable. :)
> or are you proposing something else (Option<Subcomponent> so that we start
> with all sub-components set to None and progressively populate those, which I
> remember Daniel was strongly opposed to)?
No, I am strongly opposed to do that (as well).
next prev parent reply other threads:[~2026-05-20 10:55 UTC|newest]
Thread overview: 17+ 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-06 22:06 ` [PATCH 3/6] rust: drm: Add RegistrationData to drm::Driver Danilo Krummrich
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 [this message]
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=DING6NMJ97JA.5HC3ONKUPMW5@kernel.org \
--to=dakr@kernel.org \
--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=boris.brezillon@collabora.com \
--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=gary@garyguo.net \
--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