[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sechh8id.fsf@t14s.mail-host-address-is-not-set>
Date: Wed, 07 Jan 2026 14:12:10 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Miguel Ojeda <ojeda@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy
Baron <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>, Trevor
Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, Alexandre
Courbot <acourbot@...dia.com>, Will Deacon <will@...nel.org>, Mark Rutland
<mark.rutland@....com>, Nathan
Chancellor <nathan@...nel.org>, Nick Desaulniers
<nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, Nicolas Schier
<nicolas.schier@...ux.dev>, Andrew Morton <akpm@...ux-foundation.org>,
Uladzislau Rezki <urezki@...il.com>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
linux-kbuild@...r.kernel.org, linux-mm@...ck.org,
nouveau@...ts.freedesktop.org, Matthew Maurer <mmaurer@...gle.com>
Subject: Re: [PATCH 0/4] Inline helpers into Rust without full LTO
"Peter Zijlstra" <peterz@...radead.org> writes:
> On Wed, Jan 07, 2026 at 01:23:38PM +0100, Andreas Hindborg wrote:
>> Hi Alice,
>>
>> Alice Ryhl <aliceryhl@...gle.com> writes:
>>
>> > Currently the only way for Rust code to call a static inline function is
>> > to go through a helper in rust/helpers/. This introduces performance
>> > costs due to additional function calls and also clutters backtraces and
>> > flame graphs with helper symbols.
>> >
>> > To get rid of these helper symbols, provide functionality to inline
>> > helpers into Rust using llvm-link. This option complements full LTO, by
>> > being much cheaper and avoiding incompatibility with BTF.
>> >
>> > I ran a microbenchmark showing the benefit of this. All the benchmark
>> > does is call refcount_inc() in a loop. This was chosen since refcounting
>> > is quite hot in Binder. The results are that Rust spends 6.35 ns per
>> > call vs 5.73 ns per call in C. When enabling this option, the two
>> > languages become equally fast, and disassembly confirms the exact same
>> > machine code is used (in particular there is no call to
>> > rust_helper_refcount_inc). Benchmarking Binder also results in an
>> > improvement from this change.
>> >
>> > This patch is complementary to:
>> > https://lore.kernel.org/all/20251202-define-rust-helper-v1-0-a2e13cbc17a6@google.com/
>> >
>> > Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
>>
>> I get the following modpost errors when building with this applied on top
>> of v6.19-rc4:
>>
>> ERROR: modpost: "__SCK__WARN_trap" [drivers/gpu/drm/nova/nova.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [drivers/gpu/nova-core/nova_core.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [drivers/block/rnull/rnull_mod.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_minimal.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_misc_device.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_print.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_dma.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_driver_pci.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_driver_platform.ko] undefined!
>> ERROR: modpost: "__SCK__WARN_trap" [samples/rust/rust_driver_faux.ko] undefined!
>
> Looks like it used the wrong static_call_mod() version, was MODULE
> defined?
CONFIG_MODULES=y, yes
I built without the patch first, then applied the series, enabled the
option via menuconfig and ran the build. I thought maybe some dependency
check is messed up so I retried the build from a clean state. Same
result.
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists