* [PATCH v2] rust/kernel/faux: mark Registration methods inline
@ 2025-03-10 19:51 Ethan Carter Edwards
2025-03-10 20:03 ` Danilo Krummrich
2025-03-11 8:06 ` Alice Ryhl
0 siblings, 2 replies; 4+ messages in thread
From: Ethan Carter Edwards @ 2025-03-10 19:51 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: rust-for-linux, linux-kernel, llvm, ethan
When building the kernel on Arch Linux using on x86_64 with tools:
$ rustc --version
rustc 1.84.0 (9fc6b4312 2025-01-07)
$ cargo --version
cargo 1.84.0 (66221abde 2024-11-19)
$ clang --version
clang version 19.1.7
Target: x86_64-pc-linux-gnu
The following symbols are generated:
$ nm vmlinux | rg ' _R' | rustfilt | rg faux
ffffffff81959ae0 T <kernel::faux::Registration>::new
ffffffff81959b40 T <kernel::faux::Registration as core::ops::drop::Drop>::drop
However, these Rust symbols are wrappers around bindings in the C faux
code. Inlining these functions removes the middle-man wrapper function
After applying this patch, the above function signatures disappear.
Link: https://github.com/Rust-for-Linux/linux/issues/1145
Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
v2: rebase on linux-next-20250307
---
rust/kernel/faux.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
index 3277f35c3f79..8a50fcd4c9bb 100644
--- a/rust/kernel/faux.rs
+++ b/rust/kernel/faux.rs
@@ -23,6 +23,7 @@
impl Registration {
/// Create and register a new faux device with the given name.
+ #[inline]
pub fn new(name: &CStr, parent: Option<&device::Device>) -> Result<Self> {
// SAFETY:
// - `name` is copied by this function into its own storage
@@ -58,6 +59,7 @@ fn as_ref(&self) -> &device::Device {
}
impl Drop for Registration {
+ #[inline]
fn drop(&mut self) {
// SAFETY: `self.0` is a valid registered faux_device via our type invariants.
unsafe { bindings::faux_device_destroy(self.as_raw()) }
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rust/kernel/faux: mark Registration methods inline
2025-03-10 19:51 [PATCH v2] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
@ 2025-03-10 20:03 ` Danilo Krummrich
2025-03-11 8:06 ` Alice Ryhl
1 sibling, 0 replies; 4+ messages in thread
From: Danilo Krummrich @ 2025-03-10 20:03 UTC (permalink / raw)
To: Ethan Carter Edwards
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?=,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
rust-for-linux, linux-kernel, llvm
On Mon, Mar 10, 2025 at 03:51:38PM -0400, Ethan Carter Edwards wrote:
> When building the kernel on Arch Linux using on x86_64 with tools:
> $ rustc --version
> rustc 1.84.0 (9fc6b4312 2025-01-07)
> $ cargo --version
> cargo 1.84.0 (66221abde 2024-11-19)
> $ clang --version
> clang version 19.1.7
> Target: x86_64-pc-linux-gnu
>
> The following symbols are generated:
> $ nm vmlinux | rg ' _R' | rustfilt | rg faux
> ffffffff81959ae0 T <kernel::faux::Registration>::new
> ffffffff81959b40 T <kernel::faux::Registration as core::ops::drop::Drop>::drop
>
> However, these Rust symbols are wrappers around bindings in the C faux
> code. Inlining these functions removes the middle-man wrapper function
> After applying this patch, the above function signatures disappear.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rust/kernel/faux: mark Registration methods inline
2025-03-10 19:51 [PATCH v2] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
2025-03-10 20:03 ` Danilo Krummrich
@ 2025-03-11 8:06 ` Alice Ryhl
2025-03-12 2:16 ` Ethan Carter Edwards
1 sibling, 1 reply; 4+ messages in thread
From: Alice Ryhl @ 2025-03-11 8:06 UTC (permalink / raw)
To: Ethan Carter Edwards
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=, Benno Lossin, Andreas Hindborg,
Trevor Gross, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, rust-for-linux, linux-kernel, llvm
On Mon, Mar 10, 2025 at 03:51:38PM -0400, Ethan Carter Edwards wrote:
> When building the kernel on Arch Linux using on x86_64 with tools:
> $ rustc --version
> rustc 1.84.0 (9fc6b4312 2025-01-07)
> $ cargo --version
> cargo 1.84.0 (66221abde 2024-11-19)
Is there a reason you didn't drop this from the commit message?
> $ clang --version
> clang version 19.1.7
> Target: x86_64-pc-linux-gnu
>
> The following symbols are generated:
> $ nm vmlinux | rg ' _R' | rustfilt | rg faux
> ffffffff81959ae0 T <kernel::faux::Registration>::new
> ffffffff81959b40 T <kernel::faux::Registration as core::ops::drop::Drop>::drop
>
> However, these Rust symbols are wrappers around bindings in the C faux
> code. Inlining these functions removes the middle-man wrapper function
> After applying this patch, the above function signatures disappear.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
On v1 I replied with:
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
So you should add that to the commit message when you send a new
version. :)
(Unless there are changes that require me to review it again.)
Alice
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rust/kernel/faux: mark Registration methods inline
2025-03-11 8:06 ` Alice Ryhl
@ 2025-03-12 2:16 ` Ethan Carter Edwards
0 siblings, 0 replies; 4+ messages in thread
From: Ethan Carter Edwards @ 2025-03-12 2:16 UTC (permalink / raw)
To: Alice Ryhl
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=, Benno Lossin, Andreas Hindborg,
Trevor Gross, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, rust-for-linux, linux-kernel, llvm
On 25/03/11 08:06AM, Alice Ryhl wrote:
> On Mon, Mar 10, 2025 at 03:51:38PM -0400, Ethan Carter Edwards wrote:
> > When building the kernel on Arch Linux using on x86_64 with tools:
> > $ rustc --version
> > rustc 1.84.0 (9fc6b4312 2025-01-07)
> > $ cargo --version
> > cargo 1.84.0 (66221abde 2024-11-19)
>
> Is there a reason you didn't drop this from the commit message?
I wasn't sure if the authoritative answer was to drop it. I will not
include it from now on. Thanks.
>
> > $ clang --version
> > clang version 19.1.7
> > Target: x86_64-pc-linux-gnu
> >
> > The following symbols are generated:
> > $ nm vmlinux | rg ' _R' | rustfilt | rg faux
> > ffffffff81959ae0 T <kernel::faux::Registration>::new
> > ffffffff81959b40 T <kernel::faux::Registration as core::ops::drop::Drop>::drop
> >
> > However, these Rust symbols are wrappers around bindings in the C faux
> > code. Inlining these functions removes the middle-man wrapper function
> > After applying this patch, the above function signatures disappear.
> >
> > Link: https://github.com/Rust-for-Linux/linux/issues/1145
> > Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
>
> On v1 I replied with:
>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
>
> So you should add that to the commit message when you send a new
> version. :)
My apologies. I forgot to include it, as b4 usually pulls them down for
me and I was just using format-patch and mutt to send v2.
>
> (Unless there are changes that require me to review it again.)
>
> Alice
Thanks for applying the patch, Greg.
Thanks everyone for their help. Rust in the kernel isn't as scary as it
seems! I'll be back to help some more ;).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-12 2:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 19:51 [PATCH v2] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
2025-03-10 20:03 ` Danilo Krummrich
2025-03-11 8:06 ` Alice Ryhl
2025-03-12 2:16 ` Ethan Carter Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).