|
|
Subscribe / Log in / New account

How could Rust improve?

How could Rust improve?

Posted Sep 1, 2024 15:10 UTC (Sun) by gmatht (subscriber, #58961)
In reply to: Linux-for-Rust or Rust-for-Linux by johill
Parent article: Rust-for-Linux developer Wedson Almeida Filho drops out

Hi, I haven't found a description of how Rust limitations affect kernel adoption. I understand that Linux developers are not the only ones who want better arch support. Do you prefer gcc-rs or compiling Rust to C? I have found cargo, etc., to be decent. How could Rust tooling be improved?


to post comments

How could Rust improve?

Posted Sep 1, 2024 15:24 UTC (Sun) by johill (subscriber, #25196) [Link] (1 responses)

Well, honestly, I don't know all of the details. But it's clear that rust isn't there for all architectures, even LLVM isn't:

https://docs.kernel.org/kbuild/llvm.html#supported-archit...

And rust says:

https://docs.kernel.org/rust/arch-support.html

whereas the list of all architectures is currently

alpha, arc, arm, arm64, csky, hexagon, loongarch, m68k, microblaze, mips, nios2, openrisc, parisc, powerpc, riscv, s390, sh, sparc, um, x86, xtensa

So for something sufficiently core, you can't use rust.

I'm sure this will become better over time, but (IMHO) until it does there's a lot of stuff that's simply out of scope as I described.

Perhaps with the graphics driver(s?), NVMe driver and other things that have happened we should declare the rust experiment a success, and start focusing on the architecture story etc. (gccrs, code gen, whatever) so there can be hard dependencies. The extra dependency will probably still be hated by some (including some distributors perhaps), but at least it won't be a dependency that's literally impossible to satisfy.

I guess I just don't think it's fair to say it's all the fault of kernel maintainers, who are generally already overworked, have to support stuff on all architectures, have to (willing or not) learn a whole new thing, and then everyone says "oh but it works well for me so they're just being idiots." I mean, I guess we're used to being the scapegoats but still ... Both sides would do well with some empathy for the other side.

rustc_codegen_gcc announced it could compile Rust For Linux.

Posted Sep 3, 2024 13:14 UTC (Tue) by gmatht (subscriber, #58961) [Link]

I wasn't trying to criticize kernel developers. I was hoping that in addition to Linux better supporting Rust, Rust could better support Linux.

BTW, rustc_codegen_gcc announced just over a year ago that they can now compile Rust-for-Linux. Informal benchmarks suggest it is 3% slower than regular rust.

I also had a look at mrustc. I was impressed that it could compile my rust code without issues, but it doesn't seem to support some essential things like #![no_main]. The resulting C can be 200x the size of the input rust, but it seems to shrink during compiling, and the compiled executable was smaller than the rust executable. I guess that is rust's static linking for you. I am not sure if this means mrustc-generated C would introduce excessive overhead.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds