# Meeting 2023-08-23 <!-- Leave your topic starting with ### in the relevant sections below --> ## Critical None ## Status Reports ### Rustc 1.72 Update Miguel sent the patch to the mailing list. 1.72 is in pre-release: https://blog.rust-lang.org/inside-rust/2023/08/21/1.72.0-prerelease.html ### Bindgen Update John: tested evaluating a cursor on a char literal with clang API and it gets back an integer, and get back truncated integer with 128 bit numbers. Gary: Does the evaluation result gives a type? John: Signed/unsigned integer, and string. No way to tell apart different sized integers. ### Binder update Alice: Changed how worker thread gets selected when new transaction arrives. Alice: Now 12% worse than C. After turning on LTO gives 6% (?) compared to C. Alice: Reimplement helper methods in Rust gives 1% improvement. Andreas: Put `__always_inline` to the helper should allow cross-language LTO. Andreas: How did you enable LTO? I have to patch the build system quite alot. Alice: I just add `-Clto` Bjorn: `-Clinker-plugin-lto` is needed for cross language. Gary: How would `-Clto` improves perf without LLVM IR in object file? Bjorn: It allows more inlining from kernel and core crates. Andreas: Will share my branch that allows more LTO. Alice: The change that I made: ```diff diff --git a/rust/Makefile b/rust/Makefile index 7c9ab0d1cde4..5164e81fab3c 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -32,6 +32,14 @@ ifdef CONFIG_RUST rust_flags += -C linker-flavor=gcc -C linker=$(CC) +ifdef CONFIG_LTO_CLANG +ifdef CONFIG_LTO_CLANG_THIN +rust_flags += -C lto=thin +else +rust_flags += -C lto +endif +endif + # `$(rust_flags)` is passed in case the user added `--sysroot`. rustc_sysroot := $(shell $(RUSTC) $(rust_flags) --print sysroot) rustc_host_target := $(shell $(RUSTC) --version --verbose | grep -F 'host: ' | cut -d' ' -f2) ``` Andreas: This is enough if you don't use modules ```diff cb460bc8ab807faf5dddc925f1266d27d2204db8 Author: Andreas Hindborg <a.hindborg@samsung.com> AuthorDate: Wed Apr 12 20:11:40 2023 +0200 Commit: Andreas Hindborg <a.hindborg@samsung.com> CommitDate: Wed Apr 12 20:11:40 2023 +0200 Parent: 2c68c86584af rust-nullblk: Add teardown Merged: nvme rust Contained: null_blk Follows: v6.2 (1549) wip: Enable cross language lto 1 file changed, 2 insertions(+) Makefile | 2 ++ modified Makefile @@ -585,6 +585,7 @@ KBUILD_RUSTFLAGS := $(rust_common_flags) \ -Zfunction-sections=n \ -Dclippy::float_arithmetic + KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_RUSTFLAGS_KERNEL := @@ -988,6 +989,7 @@ export CC_FLAGS_SCS endif ifdef CONFIG_LTO_CLANG +KBUILD_RUSTFLAGS += -Clinker_plugin_lto ifdef CONFIG_LTO_CLANG_THIN CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod_prefix).thinlto-cache ``` Bjorn: `rust/Makefile` doesn't apply to Rust modules, right? Gary: Yeah, that's just for `core`, `alloc`, `kernel`. Andreas: helpers stay in kernel image and not inlined into a module. Andreas: something about bytecode (?) and module Gary: spinlock is inlined? `INLINE_SPIN_LOCK` defaults to true. Andreas: How do you perf? Alice: Magic Google tool ![](https://hackmd.io/_uploads/By1owC7a2.png) ## Discussion Questions ### ARM64 support Boqun: Maintainer does not have objection. Boqun: Some issue related to atomics. ARM64 have LSE atomics and LL/SC. Gary: There is also outlined atomics in ARM, might be useful for us. ### Talk on GOSIM Conference Gary: Josh Triplett invites me to give a talk on [GOSIM Conference](https://www.gosim.org/), 26 Sep, Shanghai. Topics to cover? Miguel: Preparing a status update for LPC Gary: From Josh: > (Topic is) Fairly open-ended, and it's a reasonably technical audience; you could go into more depth if you'd like. Status, future directions, upcoming targets, challenges you've encountered with Rust and how you overcame them, impedance mismatches between Rust and Linux... Miguel: Might want to talk about unstable features that we use. https://lore.kernel.org/ksummit/CANiq72nPJVa51zv+_5tTX_jC=WGf9qmFkAHSJxkU-Y=e-5A5XQ@mail.gmail.com/ Gary: Pinning, fallible allocations... would be interesting thing to cover. Boqun: Field projection (RCU and stuff) Miguel: Could share some slides. ### Rust MC (Gary needs to submit an abstract!) ### `rust` branch Miguel: `rust` and `rust-next` have diverged now, and we would need to keep two designs (pinned-init and non-pinned-init APIs) to avoid breaking existing code (and potential unexpected downstream users). It's hard to manage them. Andreas: rust shouldn't be the default branch. Miguel: A new empty branch with a README would take over as the default branch. Alice: We can have a rust-next-readme branch which just has a commit on top of rust-next. ## Miscellaneous <!-- stuff that does not fit into other categories -->