From: Petr Pavlu <petr.pavlu@suse.com>
To: Matthew Wood <thepacketgeek@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Daniel Gomez" <da.gomez@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Aaron Tomlin" <atomlin@atomlin.com>,
"Boqun Feng" <boqun@kernel.org>, "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>,
"Tamir Duberstein" <tamird@kernel.org>,
"David Gow" <davidgow@google.com>,
"José Expósito" <jose.exposito89@gmail.com>,
linux-modules@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] rust: macros: add early_param support to module! macro
Date: Fri, 6 Mar 2026 18:22:21 +0100 [thread overview]
Message-ID: <488d93b9-d13c-4269-b7d5-ede1536f5701@suse.com> (raw)
In-Reply-To: <20260226234736.428341-7-thepacketgeek@gmail.com>
On 2/27/26 12:47 AM, Matthew Wood wrote:
> Allow module parameters to be registered as early boot command-line
> parameters via the existing __setup infrastructure.
>
> Add an optional `early_param` field to the parameter block in the
> module! macro. When specified, the macro generates:
>
> - A setup callback that calls ModuleParam::from_setup_arg() and
> stores the result via ModuleParamAccess::set_value().
> - A static string in .init.rodata with the command-line prefix.
> - An ObsKernelParam entry in the .init.setup section linking the
> two together.
The early_param() macro on the C side creates an obs_kernel_param entry
with early=1. However, this patch handles the new early_param setting in
Rust by creating an obs_kernel_param with early=0. Non-early
obs_kernel_params are processed by obsolete_checksetup() during the
parse_args("Booting kernel") call in start_kernel(), which also handles
regular kernel_params.
Actual early parameters are handled by parse_early_param(). Note that
the command line parsed in this case is marked as __initdata, so it
would not be available for the kernel's entire lifetime, as the previous
patches assume.
So I'm somewhat confused by this patch, or perhaps I misunderstood
something?
> diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
> index 0c36194d9971..83dcc89a425a 100644
> --- a/rust/macros/lib.rs
> +++ b/rust/macros/lib.rs
[...]
> + #[link_section = ".init.setup"]
> + #[used(compiler)]
> + static #setup_name: ::kernel::module_param::ObsKernelParam =
> + ::kernel::module_param::ObsKernelParam {
> + str_: #setup_str_name.as_ptr().cast(),
> + setup_func: ::core::option::Option::Some(#setup_fn_name),
> + early: 0,
> + };
--
Thanks,
Petr
next prev parent reply other threads:[~2026-03-06 17:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 23:47 [PATCH 0/8] rust: module parameter extensions Matthew Wood
2026-02-26 23:47 ` [PATCH 1/8] rust: module_param: add StringParam type for C string parameters Matthew Wood
2026-02-28 1:32 ` Miguel Ojeda
2026-03-05 12:47 ` Petr Pavlu
2026-02-26 23:47 ` [PATCH 2/8] rust: module_param: wire StringParam into the module! macro Matthew Wood
2026-03-04 8:13 ` Petr Pavlu
2026-03-09 2:24 ` Matthew Wood
2026-03-06 19:27 ` Sami Tolvanen
2026-03-09 2:27 ` Matthew Wood
2026-02-26 23:47 ` [PATCH 3/8] samples: rust_minimal: demonstrate string module parameter Matthew Wood
2026-02-26 23:47 ` [PATCH 4/8] rust: module_param: add ObsKernelParam type Matthew Wood
2026-02-26 23:47 ` [PATCH 5/8] rust: module_param: add from_setup_arg() to ModuleParam trait Matthew Wood
2026-02-26 23:47 ` [PATCH 6/8] rust: macros: add early_param support to module! macro Matthew Wood
2026-03-06 17:22 ` Petr Pavlu [this message]
2026-02-26 23:47 ` [PATCH 7/8] samples: rust_minimal: demonstrate early_param usage Matthew Wood
2026-02-26 23:47 ` [PATCH 8/8] rust: macros: add configurable initcall levels to module! macro Matthew Wood
2026-02-27 13:27 ` [PATCH 0/8] rust: module parameter extensions Matthew Wood
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=488d93b9-d13c-4269-b7d5-ede1536f5701@suse.com \
--to=petr.pavlu@suse.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=atomlin@atomlin.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=da.gomez@kernel.org \
--cc=dakr@kernel.org \
--cc=davidgow@google.com \
--cc=gary@garyguo.net \
--cc=jose.exposito89@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=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=tamird@kernel.org \
--cc=thepacketgeek@gmail.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
all inboxes | Powered by JetHome®