Rust for Linux List
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Daniel Almeida" <daniel.almeida@collabora.com>
Cc: <sashiko-reviews@lists.linux.dev>,
	"Alexandre Courbot" <acourbot@nvidia.com>, <ojeda@kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	"rust-for-linux" <rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH 2/7] rust: drm: gem: gate open/close callbacks with RegistrationGuard
Date: Sun, 11 Oct 2026 16:15:04 +0200	[thread overview]
Message-ID: <DM22LS0S86HB.2G9NWE78JHV0@kernel.org> (raw)
In-Reply-To: <E989BBD7-DF97-4384-AFC1-3D7448A1C747@collabora.com>

On Fri Oct 9, 2026 at 7:39 PM CEST, Daniel Almeida wrote:
> I wonder if this is a problem in practice? And if so, would passing a e.g.:
> Option<&File> be a solution?

No, it's not a problem.  The callback is only ever skipped when the DRM device
is unregistered; this implies that the drm::File and drm::Registration private
data is dropped. I.e. there is no data left the callback could do anything with
in the first place.

> From a purely logical perspective, I do agree that a balanced open()/close()
> makes more sense than silently skipping close() though.

close() is a pure optimization callback, e.g. to unmap memory that userspace
can't reference anymore anyway.  For the reasons mentioned above, providing it
to the driver after the DRM device is unregistered is pointless, and calling it
when unregistering the DRM device would be pointless too, as any data it could
ever access is dropped at this point anyway.

  reply	other threads:[~2026-10-11 14:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 23:08 [PATCH 0/7] lifetime-parameterized DRM File private data Danilo Krummrich
2026-08-14 23:08 ` [PATCH 1/7] rust: drm: rename Ioctl device context to Userspace Danilo Krummrich
2026-10-09 16:55   ` Daniel Almeida
2026-08-14 23:09 ` [PATCH 2/7] rust: drm: gem: gate open/close callbacks with RegistrationGuard Danilo Krummrich
     [not found]   ` <20260814232106.01AA71F000E9@smtp.kernel.org>
2026-10-09 17:39     ` Daniel Almeida
2026-10-11 14:15       ` Danilo Krummrich [this message]
2026-08-14 23:09 ` [PATCH 3/7] rust: drm: move file_operations from gem to device Danilo Krummrich
2026-10-09 17:42   ` Daniel Almeida
2026-08-14 23:09 ` [PATCH 4/7] rust: fs: add iminor() helper Danilo Krummrich
2026-10-09 17:43   ` Daniel Almeida
2026-08-14 23:09 ` [PATCH 5/7] rust: drm: wrap fops open with RegistrationGuard Danilo Krummrich
2026-10-09 18:07   ` Daniel Almeida
2026-08-14 23:09 ` [PATCH 6/7] rust: drm: make Driver::File lifetime-parameterized Danilo Krummrich
2026-08-14 23:09 ` [PATCH 7/7] rust: drm: return impl PinInit from DriverFile::open() 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=DM22LS0S86HB.2G9NWE78JHV0@kernel.org \
    --to=dakr@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.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