← Back to context

Comment by amiga386

2 months ago

Does this mean that all architectures that Linux supports but Rust doesn't are straight in the bin?

No, Rust is in the kernel for driver subsystems. Core linux parts can't be written in Rust yet for the problem you mention. But new drivers *can* be written in Rust

Which ones would that be?

  • In order to figure this out I took the list of platforms supported by Rust from https://doc.rust-lang.org/nightly/rustc/platform-support.htm... and those supported by Linux from https://docs.kernel.org/arch/index.html, cleaned them up so they can be compared like for like and then put them into this python script:

      linux = { "alpha", "arc", "arm", "aarch64", "csky", "hexagon",
        "loongarch", "m68k", "microblaze", "mips", "mips64", "nios2",
        "openrisc", "parisc", "powerpc", "powerpc64", "riscv",
        "s390", "s390x", "sh", "sparc", "sparc64", "x86", "x86_64",
        "xtensa" }
      
      rust = { "arm", "aarch64", "amdcgn", "avr", "bpfeb", "bpfel",
        "csky", "hexagon", "x86", "x86_64", "loongarch", "m68k",
        "mips", "mips64", "msp430", "nvptx", "powerpc", "powerpc64",
        "riscv", "s390x", "sparc", "sparc64", "wasm32", "wasm64",
        "xtensa" }
      
      print(f"Both: {linux.intersection(rust)}")
      print(f"Linux, but not Rust: {linux.difference(rust)}")
      print(f"Rust, but not Linux: {rust.difference(linux)}")
    

    Which yields:

    Both: {'aarch64', 'xtensa', 'sparc', 'm68k', 'mips64', 'sparc64', 'csky', 'riscv', 'powerpc64', 's390x', 'x86', 'powerpc', 'loongarch', 'mips', 'hexagon', 'arm', 'x86_64'}

    Linux, but not Rust: {'nios2', 'microblaze', 'arc', 'openrisc', 'parisc', 's390', 'alpha', 'sh'}

    Rust, but not Linux: {'avr', 'bpfel', 'amdcgn', 'wasm32', 'msp430', 'bpfeb', 'nvptx', 'wasm64'}

    Personally, I've never used a computer from the "Linux, but not Rust" list, although I have gotten close to a DEC Alpha that was on display somewhere, and I know somebody who had a Sega Dreamcast (`sh`) at some point.

    • Well, GCC 15 already ended support for the nios2 soft-core. The successor to it is Nios V which runs RISC-V. If users want us update the kernel, they'll also need to update their FPGA.

      Microblaze also is a soft-core, based on RISC-V, presumably it could support actual RISC-V if anyone cared.

      All others haven't received new hardware within the last 10 years, everybody using these will already be running an LTS kernel on there.

      It looks like there really are no reasons not to require rust for new versions of the kernel from now on then!

      2 replies →

    • It’s an interesting list from the perspective of what kind of project Linux is. Things like PA-RISC and Alpha were dead even in the 90s (thanks to the successful Itanium marketing push convincing executives not to invest in their own architectures), and SuperH was only relevant in the 90s due to the Dreamcast pushing volume. That creates an interesting dynamic where Linux as a hobbyist OS has people who want to support those architectures, but Linux as the dominant server and mobile OS doesn’t want to hold back 99.999999+% of the running kernels in the world.

      5 replies →

    • You probably shouldn't include Rust's Tier 3 in this list. If you have to, at least make it separate.

    • some of the platforms on that list are not supported well enough to say they actually have usable rust, e.g m68k

  • https://lwn.net/Articles/1045363/

    > Rust, which has been cited as a cause for concern around ensuring continuing support for old architectures, supports 14 of the kernel's 20-ish architectures, the exceptions being Alpha, Nios II, OpenRISC, PARISC, and SuperH.

  • And more specifically which ones that anyone would use a new kernel on?

  • Some people talk about 68k not being supported being a problem

    • m68k Linux is supported by Rust, even in the LLVM backend.

      Rust also has an experimental GCC-based codegen backend (based on libgccjit (which isn't used as a JIT)).

      So platforms that don't have either LLVM nor recent GCC are screwed.

      3 replies →