* [PATCH] rust/kernel/faux: mark Registration methods inline
@ 2025-03-10 2:14 Ethan Carter Edwards
2025-03-10 8:47 ` Charalampos Mitrodimas
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ethan Carter Edwards @ 2025-03-10 2:14 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn 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 Carter Edwards
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>
---
rust/kernel/faux.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
index 5acc0c02d451f6d5a26b837d509374d508f26368..5fdd85ea64398130066d38e42f7c7485673f290c 100644
--- a/rust/kernel/faux.rs
+++ b/rust/kernel/faux.rs
@@ -24,6 +24,7 @@
impl Registration {
/// Create and register a new faux device with the given name.
+ #[inline]
pub fn new(name: &CStr) -> Result<Self> {
// SAFETY:
// - `name` is copied by this function into its own storage
@@ -50,6 +51,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()) }
---
base-commit: fc2f191f850d9a2fb1b78c51d49076e60fb42c49
change-id: 20250309-faux-inline-6c8eead1bcd0
Best regards,
--
Ethan Carter Edwards <ethan@ethancedwards.com>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/kernel/faux: mark Registration methods inline
2025-03-10 2:14 [PATCH] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
@ 2025-03-10 8:47 ` Charalampos Mitrodimas
2025-03-10 13:15 ` Alice Ryhl
2025-03-10 18:19 ` Greg Kroah-Hartman
2 siblings, 0 replies; 6+ messages in thread
From: Charalampos Mitrodimas @ 2025-03-10 8:47 UTC (permalink / raw)
To: Ethan Carter Edwards
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, rust-for-linux, linux-kernel, llvm
Ethan Carter Edwards <ethan@ethancedwards.com> writes:
> 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)
Hi Ethan,
I think stating your Cargo version is unnecessary, we don't use cargo
(atleast not anymore).
> $ 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>
> ---
> rust/kernel/faux.rs | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
> index 5acc0c02d451f6d5a26b837d509374d508f26368..5fdd85ea64398130066d38e42f7c7485673f290c 100644
> --- a/rust/kernel/faux.rs
> +++ b/rust/kernel/faux.rs
> @@ -24,6 +24,7 @@
>
> impl Registration {
> /// Create and register a new faux device with the given name.
> + #[inline]
> pub fn new(name: &CStr) -> Result<Self> {
> // SAFETY:
> // - `name` is copied by this function into its own storage
> @@ -50,6 +51,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()) }
>
> ---
> base-commit: fc2f191f850d9a2fb1b78c51d49076e60fb42c49
> change-id: 20250309-faux-inline-6c8eead1bcd0
>
> Best regards,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/kernel/faux: mark Registration methods inline
2025-03-10 2:14 [PATCH] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
2025-03-10 8:47 ` Charalampos Mitrodimas
@ 2025-03-10 13:15 ` Alice Ryhl
2025-03-10 18:19 ` Greg Kroah-Hartman
2 siblings, 0 replies; 6+ messages in thread
From: Alice Ryhl @ 2025-03-10 13:15 UTC (permalink / raw)
To: Ethan Carter Edwards
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, rust-for-linux, linux-kernel, llvm
On Sun, Mar 09, 2025 at 10:14:36PM -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>
LGTM to me.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/kernel/faux: mark Registration methods inline
2025-03-10 2:14 [PATCH] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
2025-03-10 8:47 ` Charalampos Mitrodimas
2025-03-10 13:15 ` Alice Ryhl
@ 2025-03-10 18:19 ` Greg Kroah-Hartman
2025-03-10 19:07 ` Miguel Ojeda
2025-03-10 19:43 ` Ethan Carter Edwards
2 siblings, 2 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-03-10 18:19 UTC (permalink / raw)
To: Ethan Carter Edwards
Cc: Rafael J. Wysocki, Danilo Krummrich, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn 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 Sun, Mar 09, 2025 at 10:14:36PM -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>
> ---
> rust/kernel/faux.rs | 2 ++
> 1 file changed, 2 insertions(+)
This does not apply to my tree. Can you regenerate it against either
the driver-core.git driver-core-next branch, or the linux-next tree and
resend it?
What release/branch did you make this against?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/kernel/faux: mark Registration methods inline
2025-03-10 18:19 ` Greg Kroah-Hartman
@ 2025-03-10 19:07 ` Miguel Ojeda
2025-03-10 19:43 ` Ethan Carter Edwards
1 sibling, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-03-10 19:07 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Ethan Carter Edwards, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn 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 7:24 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> What release/branch did you make this against?
That hash comes from `rust-next`.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust/kernel/faux: mark Registration methods inline
2025-03-10 18:19 ` Greg Kroah-Hartman
2025-03-10 19:07 ` Miguel Ojeda
@ 2025-03-10 19:43 ` Ethan Carter Edwards
1 sibling, 0 replies; 6+ messages in thread
From: Ethan Carter Edwards @ 2025-03-10 19:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Rafael J. Wysocki, Danilo Krummrich, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn 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 25/03/10 07:19PM, Greg Kroah-Hartman wrote:
> On Sun, Mar 09, 2025 at 10:14:36PM -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>
> > ---
> > rust/kernel/faux.rs | 2 ++
> > 1 file changed, 2 insertions(+)
>
> This does not apply to my tree. Can you regenerate it against either
> the driver-core.git driver-core-next branch, or the linux-next tree and
> resend it?
Will do. My apologies, I based this patch off linux-next. I thought it
was customary to use the -next tree for whatever subsystem one is
developing against. I'll do it off of linux-next and send a v2.
>
> What release/branch did you make this against?
Tree: https://github.com/rust-for-linux/linux
Branch: rust-next
>
> thanks,
>
> greg k-h
Thanks,
Ethan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-03-10 19:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 2:14 [PATCH] rust/kernel/faux: mark Registration methods inline Ethan Carter Edwards
2025-03-10 8:47 ` Charalampos Mitrodimas
2025-03-10 13:15 ` Alice Ryhl
2025-03-10 18:19 ` Greg Kroah-Hartman
2025-03-10 19:07 ` Miguel Ojeda
2025-03-10 19:43 ` 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).