From: "Gary Guo" <gary@garyguo.net>
To: "Aaron Tomlin" <atomlin@atomlin.com>,
"Petr Pavlu" <petr.pavlu@suse.com>, <gary@garyguo.net>
Cc: <arnd@arndb.de>, <mcgrof@kernel.org>, <da.gomez@kernel.org>,
<samitolvanen@google.com>, <peterz@infradead.org>,
<ojeda@kernel.org>, <akpm@linux-foundation.org>,
<mhiramat@kernel.org>, <boqun@kernel.org>, <neelx@suse.com>,
<da.anzani@gmail.com>, <sean@ashe.io>, <chjohnst@mail.com>,
<steve@abita.co>, <mproche@mail.com>, <nick.lane@mail.com>,
<linux-arch@vger.kernel.org>, <linux-modules@vger.kernel.org>,
<rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 1/2] module: Extend module_blacklist parameter to built-in modules
Date: Tue, 01 Sep 2026 02:21:29 +0100 [thread overview]
Message-ID: <DL3L3OUMSNKK.38L06NMJHH94U@garyguo.net> (raw)
In-Reply-To: <kfhhe7uxcygkomf2qnzuqpsdy5nqoful2viiqpfv2fdla4xcea@yh44pyc3yuza>
On Tue Sep 1, 2026 at 1:33 AM BST, Aaron Tomlin wrote:
> On Mon, Aug 17, 2026 at 04:51:58PM -0400, Aaron Tomlin wrote:
>> > > diff --git a/rust/macros/module.rs b/rust/macros/module.rs
>> > > index 06c18e207508..13353b43b38d 100644
>> > > --- a/rust/macros/module.rs
>> > > +++ b/rust/macros/module.rs
>> > > @@ -479,6 +479,7 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
>> > > let ident_init = format_ident!("__{ident}_init");
>> > > let ident_exit = format_ident!("__{ident}_exit");
>> > > let ident_initcall = format_ident!("__{ident}_initcall");
>> > > + let ident_modname = format_ident!("__{ident}_modname");
>> > > let initcall_section = ".initcall6.init";
>> > >
>> > > let global_asm = format!(
>> > > @@ -590,6 +591,21 @@ pub extern "C" fn cleanup_module() {
>> > > #[cfg(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS)]
>> > > ::core::arch::global_asm!(#global_asm);
>> > >
>> > > + #[cfg(not(MODULE))]
>> > > + #[repr(C)]
>> > > + struct InitcallModname {
>> > > + initcall_fn: extern "C" fn() -> ::kernel::ffi::c_int,
>> > > + modname: *const ::kernel::ffi::c_char,
>> > > + }
>> > > +
>> > > + #[cfg(not(MODULE))]
>> > > + #[used(compiler)]
>> > > + #[link_section = ".initcall.modnames"]
>> > > + static #ident_modname: InitcallModname = InitcallModname {
>> >
>> > Can Rust directly use the C definition of initcall_modname via
>> > ::kernel::bindings::initcall_modname?
>>
>> Well, defining the local '#[repr(C)] struct InitcallModname' follows the
>> existing precedents and avoids expanding the bindgen surface with
>> <linux/init.h>. I think this is preferred, no? Gary, any thoughts?
>>
>> In rust/macros/module.rs the existing built-in initcall pointers are
>> defined directly within the macro rather than pulling in initcall_t from
>> bindings, keeping module.rs self-contained.
>
> Hi Gary,
>
> A gentle ping on this, to avoid holding up the series, shall we stick with
> this approach (i.e., keeping the local struct definition in the macro
> rather than expanding bindgen bindings)?
>
> If there are no objections, I'll proceed with this for the next revision.
Adding linux/init.h to the list of headers exported by bindgen is fine. Given
that this is a struct, I think Petr's suggestion to use generated bindings makes
sense.
Best,
Gary
next prev parent reply other threads:[~2026-09-01 1:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 1:25 [PATCH v9 0/2] module: Extend module_blacklist parameter to built-in modules Aaron Tomlin
2026-08-07 1:26 ` [PATCH v9 1/2] " Aaron Tomlin
2026-08-13 14:15 ` Petr Pavlu
2026-08-13 14:56 ` Gary Guo
2026-08-14 9:38 ` Petr Pavlu
2026-08-17 20:51 ` Aaron Tomlin
2026-09-01 0:33 ` Aaron Tomlin
2026-09-01 1:21 ` Gary Guo [this message]
2026-08-07 1:26 ` [PATCH v9 2/2] module: Rename module_blacklist to module_denylist Aaron Tomlin
2026-08-13 14:50 ` [PATCH v9 0/2] module: Extend module_blacklist parameter to built-in modules Gary Guo
2026-08-14 11:16 ` Petr Pavlu
2026-08-17 20:01 ` Aaron Tomlin
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=DL3L3OUMSNKK.38L06NMJHH94U@garyguo.net \
--to=gary@garyguo.net \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=atomlin@atomlin.com \
--cc=boqun@kernel.org \
--cc=chjohnst@mail.com \
--cc=da.anzani@gmail.com \
--cc=da.gomez@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mproche@mail.com \
--cc=neelx@suse.com \
--cc=nick.lane@mail.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=petr.pavlu@suse.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=sean@ashe.io \
--cc=steve@abita.co \
/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