From: "Gary Guo" <gary@garyguo.net>
To: "Danilo Krummrich" <dakr@kernel.org>, <aliceryhl@google.com>,
<daniel.almeida@collabora.com>, <airlied@gmail.com>,
<simona@ffwll.ch>, <lossin@kernel.org>, <gary@garyguo.net>,
<ojeda@kernel.org>, <boqun@kernel.org>,
<bjorn3_gh@protonmail.com>, <a.hindborg@kernel.org>,
<tmgross@umich.edu>, <tamird@kernel.org>, <acourbot@nvidia.com>,
<work@onurozkan.dev>
Cc: <dri-devel@lists.freedesktop.org>,
<rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] drm/tyr: name resource lifetimes after their types
Date: Thu, 19 Nov 2026 02:08:34 +0000 [thread overview]
Message-ID: <DMYTKRS80NRC.18PBQHK9SZ8K9@garyguo.net> (raw)
In-Reply-To: <20261118233727.3147222-2-dakr@kernel.org>
On Wed Nov 18, 2026 at 11:37 PM GMT, Danilo Krummrich wrote:
> The firmware, buffer, VM and MMU types use 'drm for their resource
> lifetimes, even though each parameter is local to its type.
This doesn't make any sense, a lifetime on a type by definition cannot refer to
a scope of itself.
`'sec` is not the lifetime of `Section` and `'fw` is not the lifetime of
`Firmware` and I think this is just confusing.
Best,
Gary
>
> Rename these parameters to reflect the respective type's scope in
> preparation for converting the resource ownership to self-referential
> pin-init.
>
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
> drivers/gpu/drm/tyr/fw.rs | 26 +++++++--------
> drivers/gpu/drm/tyr/gem.rs | 8 ++---
> drivers/gpu/drm/tyr/mmu.rs | 24 +++++++-------
> drivers/gpu/drm/tyr/mmu/address_space.rs | 30 ++++++++---------
> drivers/gpu/drm/tyr/vm.rs | 42 ++++++++++++------------
> 5 files changed, 65 insertions(+), 65 deletions(-)
>
> diff --git a/drivers/gpu/drm/tyr/fw.rs b/drivers/gpu/drm/tyr/fw.rs
> index aea151ff1f93..16c6aca3d3f1 100644
> --- a/drivers/gpu/drm/tyr/fw.rs
> +++ b/drivers/gpu/drm/tyr/fw.rs
> @@ -131,7 +131,7 @@ fn try_from_fw(value: u32) -> Result<Self> {
> }
>
> /// A parsed section of the firmware binary.
> -struct Section<'drm> {
> +struct Section<'sec> {
> // Raw firmware section data for reset purposes
> #[expect(dead_code)]
> data: KVec<u8>,
> @@ -139,23 +139,23 @@ struct Section<'drm> {
> // Keep the BO backing this firmware section so that both the
> // GPU mapping and CPU mapping remain valid until the Section is dropped.
> #[expect(dead_code)]
> - mem: gem::KernelBo<'drm>,
> + mem: gem::KernelBo<'sec>,
> }
>
> /// Loaded firmware with sections mapped into MCU VM.
> -pub(crate) struct Firmware<'drm> {
> +pub(crate) struct Firmware<'fw> {
> /// Iomem need to access registers.
> - iomem: Arc<IoMem<'drm>>,
> + iomem: Arc<IoMem<'fw>>,
>
> /// MCU VM.
> - vm: Arc<Vm<'drm>>,
> + vm: Arc<Vm<'fw>>,
>
> /// List of firmware sections.
> #[expect(dead_code)]
> - sections: KVec<Section<'drm>>,
> + sections: KVec<Section<'fw>>,
> }
>
> -impl<'drm> Drop for Firmware<'drm> {
> +impl<'fw> Drop for Firmware<'fw> {
> fn drop(&mut self) {
> // Stop the MCU before releasing its firmware mappings and memory.
> let _ = self.stop();
> @@ -165,8 +165,8 @@ fn drop(&mut self) {
> }
> }
next prev parent reply other threads:[~2026-11-19 2:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 23:37 [PATCH 0/4] drm/tyr: use pin-init self-referential support Danilo Krummrich
2026-11-18 23:37 ` [PATCH 1/4] drm/tyr: name resource lifetimes after their types Danilo Krummrich
2026-11-19 2:08 ` Gary Guo [this message]
2026-11-18 23:37 ` [PATCH 2/4] rust: pin-init: internal: suppress multiple_bound_locations Danilo Krummrich
2026-11-19 2:23 ` Gary Guo
2026-11-18 23:37 ` [PATCH 3/4] drm/tyr: use pin-init self-referential support Danilo Krummrich
2026-11-18 23:37 ` [PATCH 4/4] drm/tyr: use ScopeGuard for firmware loading cleanup 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=DMYTKRS80NRC.18PBQHK9SZ8K9@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--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®