|
|
Subscribe / Log in / New account

Rust support hits linux-next

Rust support hits linux-next

Posted Mar 19, 2021 16:12 UTC (Fri) by darwi (subscriber, #131202)
Parent article: Rust support hits linux-next

There is also an example character driver at drivers/char/rust_example.rs

A lot of standard kernel abstractions and APIs are not yet "rustified" at all.

Having a character driver is also not the most encouraging of examples: adding new character drivers to the kernel is really frowned upon — real drivers need way much more functionality than just FileOperations, a Mutex, and an (incomplete) SpinLock API. Nonetheless, the merge to -next is of course a very encouraging sign.


to post comments

Rust support hits linux-next

Posted Mar 20, 2021 0:04 UTC (Sat) by ndesaulniers (subscriber, #110768) [Link]

I think kbuild support is more important. Those interfaces and abstractions will come over time as needed. Without build system support, you can't even try to write them. This initial patch set also attempts to put these interfaces in a single shared location in tree, so that drivers can be built in tree, and share code in tree.

Rust support hits linux-next

Posted Mar 20, 2021 2:33 UTC (Sat) by willy (subscriber, #9762) [Link] (2 responses)

I was asked what I thought of this by one of the people working on it, and I suggested they write an NVMe driver. The spec and hardware is readily available, it's relatively high performance hardware, it's something you'd actually want to have, and it doesn't have to depend on too much of the rest of the kernel (PCI services and block layer).

Maybe they're still working on it!

Rust support hits linux-next

Posted Mar 20, 2021 13:16 UTC (Sat) by atnot (subscriber, #124910) [Link] (1 responses)

I think this is intended to be an example driver, not a proof of concept driver. So it's main purpose is intended to be as a documentation reference. Requiring people to understand NVMe is kind of unhelpful for that purpose.

Rust support hits linux-next

Posted Mar 20, 2021 14:00 UTC (Sat) by willy (subscriber, #9762) [Link]

NVMe is pretty simple. The original driver was less than 2000 lines. It's only so complicated in the kernel now because some idiots decided to make the same driver support NVMoF instead of adding a separate driver for it.

The advantage of writing an actual driver for hardware that really exists is that you figure out what's missing from the kernel Rust API -- interrupts, PCI, DMA, locks that need to be shared with code written in C. That kind of thing.


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