Rust for Linux Kernel

Hi,

I am currently going through GitHub - Rust-for-Linux/linux: Adding support for the Rust language to the Linux kernel.. Currently the Linux kernel is written in C Programming Language. I read that Rust Programming Language will be introduced as a second language to Linux kernel 6.1 version

Does it mean Rust will be used to write new drivers for Linux Kernel? Is it possible to invoke Linux Kernel written in C from Rust Programming Language? Any examples? Please guide. Thanks in Advance.

Best Regards,

Kaushal

1 Like

Check out the videos called "mentorship session" by Wedson Almeida Filho on the Linux foundation youtube channel.

2 Likes

There are some drivers written and writing drivers is the eventual goal, but the first merges are taking things slowly (6.1 is just the infrastructure with a "hello world" example). Linux Weekly News is giving the blow-by-blow status updates:

Keep in mind that Rust is “conditionally merged” into Linux.

People want to see drivers written in Rust, but hardware companies, understandably, don't want to write any drivers in Rust if they couldn't be included in the official kernel.

To resolve that dilemma Rust was added to the Linux provisionally, if experiment wouldn't pan out it would be ripped out (similar story to what happened to devfs).

People were asking Linus about when that “provisional inclusion” would turn into “unconditional inclusion”, but he refused to answer.

IMHO he does the right thing: either Rust-in-kernel would be an obvious success (because people would love and embrace it) or it would be a clear failure (because people wouldn't use it much), I don't think middle ground where it wouldn't be obvious whether it's success or failure is all that probable.

1 Like

Do they? People want to see drivers. They don't care what language they're written in; they're barely aware that there's a programming language behind them.

By “people” here I mean Linux developers. They definitely care about what program languages would be used for drivers.

Lots of features much smaller than Rust support were sitting outside of kernel for years because no one would show the benefit of merging them (in comparison to possible disruption).

It would have been natural to first ask for some new drivers in Rust and while there are some it's not really obvious that it's Rust is a net win.

But Linus known to take responsibility for bold decisions when he feels they are needed. It doesn't happen often but when it does happen it affects the whole industry.

Just recall the time when he lost access to Bitkeeper and decided do cobble together his own tool to quickly apply patches to the Linux kernel sources.

1 Like