From: "Gary Guo" <gary@garyguo.net>
To: "Kari Argillander" <kari.argillander@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
<rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-modules@vger.kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Petr Pavlu" <petr.pavlu@suse.com>,
"Daniel Gomez" <da.gomez@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Aaron Tomlin" <atomlin@atomlin.com>,
"Youseok Yang" <ileixe@gmail.com>,
"Yuheng Su" <gipsyh.icu@gmail.com>
Subject: Re: [PATCH RFC v3 00/15] rust: Reimplement ThisModule to fix ownership problems
Date: Tue, 27 Jan 2026 14:53:24 +0000 [thread overview]
Message-ID: <DFZGH4IMZEE8.2NG4D64BPM9N0@garyguo.net> (raw)
In-Reply-To: <20260110-this_module_fix-v3-0-97a3d9c14e8b@gmail.com>
On Sat Jan 10, 2026 at 3:07 PM GMT, Kari Argillander wrote:
> Still RFC. Not all people for each subsystems are not included yet as
> this touch quite lot of things. I would like to get feed back is this
> resonable seperation and how we will land this. I have tried my best so
> that it can be applied in multiple staged if needed. I have not receive
> any feedback on this series and that is little bit worrying.
>
> Introduce new ThisModule trait and THIS_MODULE impl.
>
> So currently we have problem that we are not always filling .owner field
> example for file_operations. I think we can enable const_refs_to_static
> already as that is in 1.78 and is stable in 1.83. So that fits perfecly
> for us. This also seems to be quite request feature but I did not found
> that no one has ever suggested that we just enable this.
>
> So basic idea is that we will have ThisModule trait which is used kernel
> side. Module side we will always use THIS_MODULE. That is completly
> private for modules and kernel crate cannot use it. Currently we have
> THIS_MODULE, LocalModule and
Why is trait needed? Couldn't this just be a `const THIS_MODULE` required for
vtable?
Best,
Gary
>
> module: &' static ThisModule
>
> on init functions. As we anyway need THIS_MODULE just use that for all
> of these things.
>
> Patches 1-2 introduce THIS_MODULE and ThisModule trait.
> Patches 3-12 can be applied any order after 1-2.
> Patch 13 depends on patches 11-12.
> Patches 14-15 are clean up patches and depends 1-13.
>
> Argillander
>
> To: Miguel Ojeda <ojeda@kernel.org>
> To: Boqun Feng <boqun.feng@gmail.com>
> To: Gary Guo <gary@garyguo.net>
> To: Björn Roy Baron <bjorn3_gh@protonmail.com>
> To: Benno Lossin <lossin@kernel.org>
> To: Andreas Hindborg <a.hindborg@kernel.org>
> To: Alice Ryhl <aliceryhl@google.com>
> To: Trevor Gross <tmgross@umich.edu>
> To: Danilo Krummrich <dakr@kernel.org>
>
> To: Alexandre Courbot <acourbot@nvidia.com>
>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Petr Pavlu <petr.pavlu@suse.com>
> Cc: Daniel Gomez <da.gomez@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Aaron Tomlin <atomlin@atomlin.com>
>
> Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
> ---
> Changes in v3:
> - Edit cover.
> - Seperate module name changes to seperate patches.
> - Rebase top of next 20260109
> - Seperate configfs changes to own commit.
> - Fix one place still used M over TM for ThisModule.
> - Link to v2: https://lore.kernel.org/r/20260106-this_module_fix-v2-0-842ac026f00b@gmail.com
>
> Changes in v2:
> - Patches are now sepereted properly.
> - Removed debugfs changes as that is not so clear to me.
> - Remove module parameter and just used THIS_MODULE everywhere.
> - Made macro to make THIS_MODULE.
> - Doc tests also have THIS_MODULE.
> - Link to v1: https://lore.kernel.org/r/20260101-this_module_fix-v1-0-46ae3e5605a0@gmail.com
>
> ---
> Kari Argillander (15):
> rust: enable const_refs_to_static feature
> rust: add new ThisModule trait and THIS_MODULE impl
> rust: miscdevice: fix use after free because missing .owner
> rust: block: fix missing owner field in block_device_operations
> rust: drm: fix missing owner in file_operations
> rust: configfs: use new THIS_MODULE
> rust: binder: use new THIS_MODULE
> rust: firmware: use THIS_MODULE over LocalModule for name
> gpu: nova-core: use THIS_MODULE over LocalModule for name
> samples: rust: auxiliary: use THIS_MODULE over LocalModule for name
> rust: driver: make RegistrationOps::register() to use new ThisModule
> rust: phy: make Registration::register() use new ThisModule
> rust: remove module argument from InPlaceModule::init()
> rust: remove kernel::ModuleMetadata
> rust: remove old version of ThisModule
>
> drivers/android/binder/rust_binder_main.rs | 5 +-
> drivers/block/rnull/configfs.rs | 2 +-
> drivers/block/rnull/rnull.rs | 3 +-
> drivers/gpu/drm/nova/driver.rs | 2 +
> drivers/gpu/drm/tyr/driver.rs | 2 +
> drivers/gpu/nova-core/nova_core.rs | 2 +-
> lib/find_bit_benchmark_rust.rs | 3 +-
> rust/kernel/auxiliary.rs | 16 +--
> rust/kernel/block/mq.rs | 1 +
> rust/kernel/block/mq/gen_disk.rs | 30 +-----
> rust/kernel/block/mq/operations.rs | 30 ++++++
> rust/kernel/configfs.rs | 49 ++++-----
> rust/kernel/driver.rs | 31 +++---
> rust/kernel/drm/device.rs | 2 +-
> rust/kernel/drm/driver.rs | 4 +
> rust/kernel/drm/gem/mod.rs | 5 +-
> rust/kernel/firmware.rs | 4 +-
> rust/kernel/i2c.rs | 11 +-
> rust/kernel/lib.rs | 161 ++++++++++++++++++++++++-----
> rust/kernel/miscdevice.rs | 5 +
> rust/kernel/net/phy.rs | 29 ++++--
> rust/kernel/pci.rs | 15 +--
> rust/kernel/platform.rs | 12 +--
> rust/kernel/prelude.rs | 2 +-
> rust/kernel/sync/lock/global.rs | 4 +-
> rust/kernel/usb.rs | 13 +--
> rust/macros/lib.rs | 4 +-
> rust/macros/module.rs | 24 +----
> samples/rust/rust_configfs.rs | 2 +-
> samples/rust/rust_debugfs_scoped.rs | 2 +-
> samples/rust/rust_driver_auxiliary.rs | 8 +-
> samples/rust/rust_driver_faux.rs | 2 +-
> samples/rust/rust_minimal.rs | 2 +-
> samples/rust/rust_misc_device.rs | 3 +-
> samples/rust/rust_print_main.rs | 2 +-
> scripts/rustdoc_test_gen.rs | 2 +
> 36 files changed, 298 insertions(+), 196 deletions(-)
> ---
> base-commit: f417b7ffcbef7d76b0d8860518f50dae0e7e5eda
> change-id: 20251230-this_module_fix-a390bff24897
>
> Best regards,
prev parent reply other threads:[~2026-01-27 14:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-10 15:07 [PATCH RFC v3 00/15] rust: Reimplement ThisModule to fix ownership problems Kari Argillander
2026-01-10 15:07 ` [PATCH RFC v3 01/15] rust: enable const_refs_to_static feature Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 02/15] rust: add new ThisModule trait and THIS_MODULE impl Kari Argillander
2026-01-14 14:26 ` Petr Pavlu
2026-01-10 15:08 ` [PATCH RFC v3 03/15] rust: miscdevice: fix use after free because missing .owner Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 04/15] rust: block: fix missing owner field in block_device_operations Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 05/15] rust: drm: fix missing owner in file_operations Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 06/15] rust: configfs: use new THIS_MODULE Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 07/15] rust: binder: " Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 08/15] rust: firmware: use THIS_MODULE over LocalModule for name Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 09/15] gpu: nova-core: " Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 10/15] samples: rust: auxiliary: " Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 11/15] rust: driver: make RegistrationOps::register() to use new ThisModule Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 12/15] rust: phy: make Registration::register() " Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 13/15] rust: remove module argument from InPlaceModule::init() Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 14/15] rust: remove kernel::ModuleMetadata Kari Argillander
2026-01-10 15:08 ` [PATCH RFC v3 15/15] rust: remove old version of ThisModule Kari Argillander
2026-01-12 17:56 ` [PATCH RFC v3 00/15] rust: Reimplement ThisModule to fix ownership problems Christophe Leroy (CS GROUP)
2026-01-13 10:33 ` Miguel Ojeda
2026-01-14 14:37 ` Miguel Ojeda
2026-01-27 14:53 ` Gary Guo [this message]
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=DFZGH4IMZEE8.2NG4D64BPM9N0@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=atomlin@atomlin.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=da.gomez@kernel.org \
--cc=dakr@kernel.org \
--cc=gipsyh.icu@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ileixe@gmail.com \
--cc=kari.argillander@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mcgrof@kernel.org \
--cc=ojeda@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--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