|
|
Subscribe / Log in / New account

Linux-for-Rust or Rust-for-Linux

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 20:49 UTC (Thu) by atnot (subscriber, #124910)
In reply to: Linux-for-Rust or Rust-for-Linux by shironeko
Parent article: Rust-for-Linux developer Wedson Almeida Filho drops out

> The system self-select for people that share that mentality and as a result change is even harder.

I think this really gets to the core of it. But it's not just about angry emails and it's not really about being resistant to change.

Refactors like Folios are a significantly more invasive and far reaching than anything Rust has proposed so far. It's certainly more invasive than the 500 line (including docs) patch wrapping struct device that took years to merge. Yet folios have not faced the same degree of reaction. Yes, sure there's been a bunch of grumbling about whether this is really necessary. But I've never heard a kernel developer complaining about the "folio religion wanting to make us all learn folios" or grandstanding about how they will valiantly refuse to use them, or even implying it might be some sort of shadowy woke agenda of big bookbinding.

The difference is not really the amount of scope here. It's that while folios may be a big change, Rust is a change that, if successful, would prove some of those world views that as you point out the kernel self-selects for wrong or at least put them into question.

I think there's a number of these like:
- Believing good decisions can only be made by fiat of strong leaders and not collaboratively by community consensus.
- It is not worth it to design systems holistically to eliminate certain problems from the beginning.
- So-called "soft-skills" like writing documentation should not be treated as essential parts of programming. Someone else will come along and do those. That works for the dishwasher after all.
- The linux kernel is not just a piece of software like any other. Linux kernel developers are not just normal, average software developers. Learnings from outside the linux kernel, even from other kernels, are thus not applicable to us.
- Tools should be built primarily around purely technical concerns, not around the humans that use them. Acknowledging their fallability and flaws is an insult and leads to worse software.
- And let's not ignore the spicy one: Having sufficient visibly female and queer people that you can't just dismiss them as quota fillers will doom a project, as they are by their nature less meritable.

I'm sure you can think of more. Of course, the degree to which these beliefs are held in any one person will vary, and there are equally things that go the other way. But the general point is that views that extend far outside of the kernel and programming lead people to *really want* the project to either fail or succeed to prove or disprove those beliefs. Which makes things much harder than they need to be.

However I'm ultimately more positive about the outlook there. Between AGX and Nova, we're about to be in a situation where 2/4 desktop graphic card drivers will run on Rust. I think that, even with the resistance to Rust, the kernel will not be able to afford to keep these things out of tree forever if people keep maintaining them, just like PREEMT_RT. And just as Linux has selected for these things in the past, these things will change who it selects for in the future.


to post comments

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 21:28 UTC (Thu) by corbet (editor, #1) [Link] (150 responses)

So I know it is fun to insult kernel developers and make them all out to be cavemen, but perhaps some of the respectful dealings we are asking for should be directed that way too?

The Rust work has gone slowly — as did folios, which took over a year of work and endless discussions before anything was merged. Rust is in many ways a harder problem; how do you integrate a new language and new ways of doing things into a 30-year-old project that you cannot afford to break, and which needs to plan for the next 30 years as well? Many of the questions around Rust come down to that. See, for example, this article on filesystem APIs.

There is not much opposition to Rust in the kernel community — far less than I had expected, honestly. There is opposition to merging Rust code just because it's Rust, without ensuring that it fits well into the kernel and that the result will be maintainable over the long term. And so the Rust developers have run into the kinds of difficulties that many developers trying to make big changes have hit. It's hard, often harder than it really should be, but I do not believe it is driven by the factors you have described.

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 21:47 UTC (Thu) by SLi (subscriber, #53131) [Link] (20 responses)

Agreed, this is a good take on it. I'm not a fan of either being overly critical or uncritical about the Linux way of doing things, even when "already decided". But certainly the people involved seem to be doing their best in good faith; and just the success of Linux implies that they're not doing it that wrong. (While I think it was wrong to stick to C that far, I think it's important for me to recognize that I also might exceptionally be wrong about something ;))

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 7:31 UTC (Fri) by vasvir (subscriber, #92389) [Link] (19 responses)

When Linus took its public stance against C++ I didn't like it either.

However in the long run I believe it was the right decision.

C++ brings a lot in the table but it still requires a huge amount of discipline. In every C++ project I have seen a C++ subset is deemed as blessed but that also requires discipline to enforce. Tests can help but in reality are also a discipline enforcement mechanism beyond the compiler.

If Linux had gone the C++ way it would face now the possibility of adding a 3rd language or a double migration to Rust. The premise is that with Rust discipline is not required, the compiler will flag out incorrect usage of APIs etc. There are big ifs here like:

* Are the rules you want to be disciplined about possible to be encoded in Rust?
* What is the cost (pain) of the maintenance of such rules? Does it worth it?

I believe this exercise of integrating Rust to the Linux will answer these questions.

Disclaimer: I do not know Rust

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 10:53 UTC (Fri) by khim (subscriber, #9252) [Link] (2 responses)

> I believe this exercise of integrating Rust to the Linux will answer these questions.

No, it wouldn't. Because these specific questions can be answered easily and in negative fashion and that is what Ted's possibly-sabotage is using as base.

> Disclaimer: I do not know Rust

But you, presumably, know some C and some assember, right? And you know that Unix was written in assembler and then rewritten in C, right?

Well… assembler makes it possible to do amazing tricks, not really replicable in C. E.g. GEOS used very peculiar yet efficient way of passing arguments: just put them right after jsr instruction. Yes, without any stack or registers, just there, in the middle of code.

It's very efficient: it's very easy to traverse the call stack with such approach and you don't even need to move arguments around! You just know that if function X have arguments x1, y1 and it calls Y, then Y calls Z, Z calls some DrawLine function… you can shift three stack frames up and find all these parameters. No need to explicitly pass them around and you save both code and execution time. Perfect… except it's entirely incompatible with how C deals with stack!

If your drivers ABI is designed around such “extra-efficient” calling conventions then rewrite in C is, essentially, not possible. Or at least it would be quite inefficient.

You may say that your assembler is just fine and these new guys can go to hell with their C… or you may actually cooperate and design some solution. Develop some secondary set of functions “for these C guys”. Or ask them to develop them… but then you need to cooperate with them when you change you API.

Transition to Rust is very similar. You may ask Rust guys to develop API, sure, and they may keep it in such with C API, but…

  1. You my need to alter certain aspects of C API to better fit Rust, or, when that's unacceptable…
  2. You would have to cooperate with them to keep their alternate API working when you refector C API

Doing what Ted is doing… to put it extra-polite as one redditer put it: that's behavior externally undistinguishable from purposeful sabotage.

As in: while different explanations are possible but any guy hell-bent on sabotaging Rust-on-Linux effort and who is maintainer of some subsystem would find it logical to do precisely what Ted did.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 11:37 UTC (Fri) by vasvir (subscriber, #92389) [Link] (1 responses)

> No, it wouldn't. Because these specific questions can be answered easily and in negative fashion

I am sure there are more ifs than the one I listed here. I mean it's a very big C project that tries to incorporate Rust. Lots of lessons will be drawn for all people that are unbiased. I agree though that the C side will have to make changes to accommodate Rust API. The question is: Will these changes make for a better C API? or more enforceable even with an external tool? I would suggest to grab some pop corn...

> But you, presumably, know some C and some assember, right? And you know that Unix was written in assembler and then rewritten in C, right?

Yes, yes and yes.

> It's very efficient: it's very easy to traverse the call stack with such approach and you don't even need to move arguments around!

Crazy stuff!!! and *no* I have never done that or even thought to do something like that. Didn't know about GEOS. Thanks for the pointer.

I saw the video and I would agree that Ted looked to me very rude. However, LWN coverage was more mild and his arguments came across as logical points which require some thought, work andcollaboration to address them.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 12:02 UTC (Fri) by khim (subscriber, #9252) [Link]

> The question is: Will these changes make for a better C API? or more enforceable even with an external tool?

90% of time the answer is “yes”: C API have grown to be incompatible with Rust approach simply because no one cared about Rust and when you fix it you make it easier to use from C, too.

90% of the remaining 10% you can approach some compromise where Rust API doesn't look too awful and C API is not too crazy, either.

But there are always 1-2% of these crazy corner cases where sane Rust API just pushes you to rewrite large pieces of already working code and then you either have to rewrite C code that is very fragile and rewrite-hostile, or, more often, add another implementation of the same API just for Rust.

It's always a good idea to try to avoid that, but sometimes that's really the best approach.

And if that happens then maintainership of that functionality becomes tangled between many different parties. And you spend way more than 1-2% of your time dealing with these corner cases.

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 3:36 UTC (Tue) by anthm (guest, #173221) [Link] (15 responses)

how does C not require a huge amount of discipline?

If the cognitive load and discipline required for you to write C is lower than Rust I would question how correct your C code is. Rust requires you to work with a more difficult language but it gives you guarantees, C requires managing all those guarantees manually. Correct C code is extremely hard to write.

This is why I *hate* the "C is simple so it's good" argument. C is not simple. C just hides the complexity behind a language that's under-engineered.

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 4:27 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

> how does C not require a huge amount of discipline?

C++ has a huge number of features. So if you're using a subset of features, there's always pressure to use just one more feature just outside of the subset. U

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 7:34 UTC (Tue) by viro (subscriber, #7872) [Link] (10 responses)

Funny... I've caught quite a few bugs in C; memory safety problems were nowhere near the majority. And one thing that is really required is being able to reason about the program behaviour, which is where the simpler model helps a _lot_. What's your experience, if that's not a too tactless question?

Don't get me wrong - memory safety issues do happen and automated tools are useful; what's more, C type system is genuinely not strong. But that's only a part of the picture. Far more often is the case when you need to change existing code (as opposed to "write a replacement from scratch and pray that CI will catch any logical problems") and _that_ is where the things get painful. Again, being able to reason is an absolute must-have; you _can't_ just treat the compiler as an oracle that needs to be appeased and be done with that. In any language.

And frankly, I don't understand the idio^Wpeople who treat language as identity - _any_ language (natural ones included) is a set of tools. It does not determine how you think, for fuck sake! You really can write FORTRAN in any language - certainly so in Rust. Familiarity with more languages is a good thing - it widens your toolkit, and if you really understand a language you will be able to come up with equivalent idioms in another - provided that you *do* understand them in the original, and not just on the level of "it's a magical incantation". Whorf-Sapir hypothesis is garbage; mixing it with Herderian nonsense is completely insane. "Rust Culture", "C Culture"... get a life, already.

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 12:39 UTC (Tue) by Wol (subscriber, #4433) [Link]

> You really can write FORTRAN in any language

rofl ...

Most of my C code was probably just FORTRAN and DataBASIC in disguise ... for the most part I just didn't see any advantage in using unfamiliar C idioms when Fortran did just as well - eg malloc a chunk of memory and access it with [] rather than *. If the C idiom was better than Fortran then I learnt it and used it, if I couldn't see an advantage I stuck with what I knew.

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 12:46 UTC (Tue) by Wol (subscriber, #4433) [Link] (7 responses)

> It does not determine how you think, for fuck sake!

Well, how do you think about tense, if your language does not have tenses? Given that you NEED language to enable you to think, the two are completely intertwined.

Your comment about "learning multiple languages" underlines this point! By learning another language, you learn that other people think different to you, and it broadens your mind.

But it's pretty obvious from - let's say khim's posts - that his language determines the way he thinks. He can't even express himself in English some times because his language does not have the context to enable him to grasp ours! I get the impression that many of my spats with him are down to the fact that the GRAMMAR gets in the way and obstructs mutual understanding.

Sorry khim - no disrespect - I'm sure you'd say pretty much the same about me from the other side of the fence :-)

But sorry, yes, language DOES determine how you think. If you don't have the words/grammar to say it, then you don't have the words/grammar to think it.

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 15:49 UTC (Tue) by viro (subscriber, #7872) [Link] (6 responses)

Are you serious? "event X happened before event Y" can be expressed in a lot of ways; surface representation matters very little. The same goes for aspect and mood. Do you really think that learning Latin changes the thought process when you see several buggers who are already visibly plastered and keep switching between port and beer without bothering to eat anything? Just because Latin expresses the notion of "that bunch is going to be throwing up" with a single word while English uses several? The underlying notion will be the same; it can be approximated with words (some of them possibly even printable), but that's not how we are thinking.

As for the words... that's why we have mechanisms to introduce new words and expressions. There's a particularly debased form of Whorf-Sapir bollocks (to be fair, neither had been responsible for that bit of BS - that came from popularizers) that seriously claims that inhabitants of Caribbean in 1490s must've been unable to process what they were seeing and somehow developed a blind spot in place of caravels. I don't know how one could believe that, because we all know what really happens when there's no terms for what we are seeing. "Oi, what the fuck is that thing over there? Hadn't been there this morning... Looks like there's a bunch of wankers on it; are they wrapped in some strange shit? Seems rigid; some kinda shields strapped on, maybe? Don't like how that one is pointing our way whatever the hell he's holding, let's get out of the open and warn the blokes back in the village" is far more likely than ignoring the sight just because there's no proper term for caravel, cuirass, etc. More likely to get passed to offspring, anyway... Mind does not stop when running into the lack of proper terms; it cobbles something up (that's what the obscenity is for, often enough) and keeps going.

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 16:44 UTC (Tue) by Wol (subscriber, #4433) [Link] (5 responses)

> Are you serious? "event X happened before event Y" can be expressed in a lot of ways; surface representation matters very little.

Then why is it so hard to understand what khim is actually saying? I learnt the rules, I (think I) have a basic grasp of Russian grammar, I try to see it through his comprehension, and he STILL succeeds in saying something that is clearly not what he meant.

It's like double negatives. I know we Brits abuse it a lot, but a lot of other languages use an emphasised negative. Translate that naively into English, and you've just COMPLETELY changed the meaning. And it's hard to unlearn something. I can hear you perfectly, and still walk away with a completely wrong understanding of what you said.

Surface representation matters a LOT. It's behind many misunderstandings and wars.

Roosevelt: Let's table that idea.
Churchill: Oh no we can't!

And that's only the difference between English and American ...

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 18:23 UTC (Tue) by viro (subscriber, #7872) [Link]

Umm... Thinking as internal monologue is already somewhat questionable, but thinking as internal _dialogue_ with participants using different dialects... Ouch. I mean, DID exists, but it's not exactly common. IOW, examples you are giving are irrelevant to the way one thinks - grammatical differences between dialects would matter only if you switched the dialects halfway through thinking of something *and* forgot which one have you been using at earlier step. Not impossible, I guess, but that's hard to run into without recreational chemistry, which is likely to cause other problems...

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 20:57 UTC (Tue) by rschroev (subscriber, #4164) [Link]

> > Are you serious? "event X happened before event Y" can be expressed in a lot of ways; surface representation matters very little.

> Then why is it so hard to understand what khim is actually saying?

Because English is a foreign language for khim? Of course it's more difficult to express yourself clearly (and/or succinctly) in a language that's not your native language. I can express my thoughts pretty fluently in Dutch; English is significantly harder, even though both languages are pretty closely related. French is almost hopeless even though our education system tried pretty hard making us learn that language. German is closer related still, but while I can read it a bit I can't write or speak it at all (other than trivial things like "Zwei Bier bitte"). If I try to express something in French, chances are French-speaking people will think it's difficult to understand too. And it's more difficult for things that are expressed differently in native versus foreign language.

How much study of Russian would you or I need before we are as proficient in it as khim is in English? Will khim wonder why he can't always understand our reasoning expressed in Russian?

I think you're thinking of the linguistic relativity, also known as the Sapir–Whorf hypothesis (and other terms), and more specifically it seems you're thinking of the strong form which says that language determines thought and that linguistic categories limit and restrict cognitive categories. Modern linguists don't accept that hypothesis anymore (or at least that stronger form).

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 21:04 UTC (Tue) by rschroev (subscriber, #4164) [Link] (2 responses)

> Surface representation matters a LOT. It's behind many misunderstandings and wars.

You can express repetition in different programming languages in different ways.

What you're saying is: The representation matters, because different compilers/interpreters/programmers will understand different ways of representation.

What viro was saying (or at the very least, how I interpreted it): The representation doesn't matter, in the sense that any programming language can express repetition, and the choice is a simple consequence of the choice of programming language. It doesn't influence what concepts can be expressed in the different languages.

Linux-for-Rust or Rust-for-Linux

Posted Sep 5, 2024 12:01 UTC (Thu) by taladar (subscriber, #68407) [Link] (1 responses)

The flaw in that line of reasoning is that how easily something is expressed matters a whole lot more in programming, maintainability, readability,... than how possible it is to express it at all.

Linux-for-Rust or Rust-for-Linux

Posted Nov 28, 2024 18:32 UTC (Thu) by deepfire (guest, #26138) [Link]

Thank you for saying the obvious!

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 18:53 UTC (Tue) by SLi (subscriber, #53131) [Link]

> Funny... I've caught quite a few bugs in C; memory safety problems were nowhere near the majority. And one thing that is really required is being able to reason about the program behaviour, which is where the simpler model helps a _lot_.

A serious question. Do you think you could reason equally well about high level behavior in C and assembly? Even if we ignore the memory safety aspect.

I find this idea surprising. In my experience, the language you work in significantly shapes your thinking.

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 8:25 UTC (Tue) by SLi (subscriber, #53131) [Link] (2 responses)

Because it's a simple language. It makes it easy to make mistakes in ways that can be only somewhat be mitigated by discipline. The set of generally useful rules is much smaller, and less controversial, than in C++.

And because you are unlikely to be tempted to write complex template machinery that nobody will ever quite understand, for the sinple reason that the language does not support anything that complex. That certainly also means you won't get the major benefits of templates. You can write macro hacks that are much more horrible, but there's no way to make them as insanely complex as modern C++ is (and I say this as someone who both loves and hates the language for that).

Linux-for-Rust or Rust-for-Linux

Posted Sep 5, 2024 12:04 UTC (Thu) by taladar (subscriber, #68407) [Link] (1 responses)

The "simplicity" also makes it incredibly hard to write abstractions that actually fully take care of a problem so you don't need to waste mental capacity on it every time it comes up.

Linux-for-Rust or Rust-for-Linux

Posted Sep 5, 2024 16:04 UTC (Thu) by SLi (subscriber, #53131) [Link]

Yes, this is a good way to put it. A lot of the template machinery in e.g. C++ is there precisely to support you in doing things safely. Sometimes it's a delicate balance between the maintainability of the machinery and usability of it.

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 23:05 UTC (Thu) by gerdesj (subscriber, #5446) [Link] (1 responses)

Folios ... pah! What about the big kernel lock - https://kernelnewbies.org/BigKernelLock ?

Now, that was a project and a half. Conducted when Mr Shouty was at peak shouty. Mind you, LWN discussions were a lot more civil or perhaps my specs have gone a bit rose tinted.

Linux-for-Rust or Rust-for-Linux

Posted Sep 11, 2024 1:05 UTC (Wed) by sammythesnake (guest, #17693) [Link]

"Rose Tinted Spectacles are often that colour from blood spilled in those earlier times"

- Mark Twain*

* Not Mark Twain - I just made it up

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 5:10 UTC (Fri) by pbonzini (subscriber, #60935) [Link] (50 responses)

> There is opposition to merging Rust code just because it's Rust, without ensuring that it fits well into the kernel and that the result will be maintainable over the long term.

Looking at the linked article and discussion, I see objections of this kind and "C-side" developers participating into constructive discussions; but "because I don't know Rust, I am not going to fix the Rust bindings" is not one of them.

The moment rust/ was added to the Linux tree, anyone would have reasonably guessed that sooner or later all core kernel developers would have to either learn Rust, or collaborate with Rust for Linux developers whenever a tree-wide refactoring would happen.

The process of incorporating Rust bindings has been slow and sometimes tricky for several (mostly good) reasons, and when two teams with slightly different habits cross some attrition is expected (https://lwn.net/Articles/949270/). However, in the long term there is no sensible outcome other than people learning Rust, and in the long term people should realize that the ship has already sailed.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 11:50 UTC (Fri) by jgg (subscriber, #55211) [Link] (49 responses)

If the ship has already sailed then really we need someone like Linus & co to stand up and clearly say those words to everyone, and repeat it a few times.

I think there is a sizeable contingent that does not believe that to be the case, and Ted's remarks of effectively wanting nothing to do with rust are not unique or unreasonable given the cloudy situation. I know enough people betting on the failure of this experiment.

IMHO the current situation of Rust does not look like success. It is basically unusable except for unmerged toy projects and it is still not obvious when that will change. Can we rely on RH10 kernel having full baseline rust support? If yes then in 4 years maybe the server/enterprise industry could actually we can take rust seriously.. Can rust even support the OOT backporting stuff everyone does? Is there a strong enough preprocessor? What is the situation with Android? Can an Android device vendor write a driver in rust today?

I've pondered if I should consider rust for some of the greefield projects I've done recently. iommufd in rust? Generic PT? But at the end of the day that work is being "paid" for by people who intend to backport it to old kernels. I can't write it in rust and meet that need. I bet a lot of people are in the same boat.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 13:29 UTC (Fri) by pbonzini (subscriber, #60935) [Link]

I am not going to be at maintainers summit but that would be a very good occasion for that to happen.

With a killer use case there's no doubt to me that RHEL 10 would be able to support Rust code. Right now as you point out there's none (the only non-toy one in the air is binder), but RHEL 10 will grow new functionality until 2028 so I wouldn't exclude that, especially for drm.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 15:21 UTC (Fri) by willy (subscriber, #9762) [Link] (32 responses)

I don't think we're at the point of "complete success" until the compilers catch up. I don't think, for example, that you can compile Rust for m68k or alpha at this point. I'd be happy to be told I'm mistaken.

Obviously, this is not a failure of the RustForLinux project. They have important work to do which is independent of code generation.

My biggest gripe is inline functions. It seems crazy to me that we have functions which are so performance critical that they must be inlined in C, and yet in Rust, we make function calls to an exported symbol.

And I haven't got very far through my Rust book. I did write a little userspace program (calculating Pascal's triangle) which went well enough, but most of what I was doing there was figuring out how to use the libraries rather than the kinds of things I'll need to do in the kernel.

And, yeah, I think what Ted did there was reprehensible. I'd've said so had I been in the room, but I was off in the MM track at the time.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 15:47 UTC (Fri) by jgg (subscriber, #55211) [Link] (22 responses)

I was in the room and sort of thought Ted was "capturing the mood" - lets be blunt - there are some loud voices in FS/Block that are very anti-rust.

As above, I think the Linux project needs to make a clear unambigous decision, or at least set a timeline to make it.

Either we are doing Rust and what Ted said is out of line, or we are not, and Ted's position is reasonable - do not burden busy people with a Rust experiment that is nobody is going to use.

I thought the point of this inbetween state was supposed to be doing experiments to decide if Rust is feasible. Is there a result yet? Your concern about inlines is news to me, that sounds kind of fatal honestly. What was the result of the nvme experiment? I saw some graphs that it was worse performance, that's not encouraging?? How much of the toolchain situation is sorted out? Last LPC they were saying constant upgrades required? GCC was working on a front end?

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 17:55 UTC (Fri) by Wol (subscriber, #4433) [Link] (5 responses)

> Your concern about inlines is news to me, that sounds kind of fatal honestly.

I was under the impression that - compiling huge monolithic blobs - Rust was quite capable of spotting and inlining functions like that all by itself. What's the point of an "inline" keyword if you can rely on the compiler to spot it?

(Dunno whether I like the downsides of huge blobs - it makes libraries more complicated - but it's horses for courses, or pick you poison, whichever suits ...)

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 20:12 UTC (Fri) by pbonzini (subscriber, #60935) [Link] (4 responses)

These are cross-language calls, so the call from Rust to C (say, to spin_lock()) will not be inlined.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:55 UTC (Fri) by roc (subscriber, #30627) [Link] (2 responses)

Mozilla has been inlining across the Rust-C++ boundary, using LTO, for five years: https://www.reddit.com/r/cpp/comments/ch7g6n/mozilla_just...

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 5:38 UTC (Sat) by pbonzini (subscriber, #60935) [Link] (1 responses)

Linux however it's typically compiled with GCC. I remember people working on LTO for Linux a few years ago but I think that's not particularly common.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 6:16 UTC (Sat) by roc (subscriber, #30627) [Link]

OK, but the important thing is that there's an obvious fix for cross-language inlining if that becomes important.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 18:02 UTC (Sat) by Cyberax (✭ supporter ✭, #52523) [Link]

Even without LTO, a simple practical solution might be to duplicate some of the hottest code (e.g. spin_lock) in Rust. It's not great, but most of such code has been stable for quite a while.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:46 UTC (Fri) by kees (subscriber, #27264) [Link] (15 responses)

We are doing Rust and what Ted said is out of line. :)

Yes, there continues to be technical issues to be worked out. This is no different from C. It's the nature of technology. We're always moving to new compiler versions, refactoring to get rid of bad APIs, etc.

And Rust has shown its strengths very well, IMO. The M1 GPU driver is excellent and in constant use by a large set of distro users. The Binder driver is a drop-in replacement for the C version and will be shipped in Android soon.

I think the characterization of these Rust drivers being "toy projects" is pretty wildly inaccurate, if not outright insulting.

It's just a big change that is taking time to get everything resolved. I don't understand the resistance to learning new languages, especially given the large developer community associated with Rust. Us kernel devs are always hoping to get more people involved in Linux... Why push people away like this, especially given how many problems Rust permanently solves?

But to answer your questions:

Yes, Rust is feasible.

The NVMe driver works fine and the interfaces needed for it are going through review, though it's an uphill battle politically: as you said there are a few very loud voices in FS/Block that seem to be overwhelmed by their work loads.

The NVMe performance graphs looked very encouraging to me! A proof-of-concept driver with no explicit optimizations is identical to the C performance, except in 2 cases: one where it's within roughly 2%, and in another was _faster_.

What do you consider "the toolchain situation"? It works fine for me. :)

Yes, the upgrade cycle is faster than for GCC and Clang currently, but this is already slowing as the language features needed for Linux are stabilizing, so now there is a minimum version needed, not an exact version.

Yes, GCC has, I think, 2 front-end projects for Rust. I haven't paid too much attention to this myself, though.

GCC and Rust

Posted Aug 30, 2024 22:53 UTC (Fri) by corbet (editor, #1) [Link] (12 responses)

I'm hoping to learn more about the state of gccrs at Cauldron soon. That is one of my biggest concerns with this whole thing... GCC support is needed to reach all of the targets supported by the kernel, but the gccrs project seems to be languishing with little effort going into it. Somehow, I think, we have to find a way to bring some resources to bear on that problem.

GCC and Rust

Posted Aug 31, 2024 18:43 UTC (Sat) by josh (subscriber, #17465) [Link]

> GCC support is needed to reach all of the targets supported by the kernel

rustc_codegen_gcc is making steady progress.

(That's leaving aside the question of how much value those targets provide.)

GCC and Rust

Posted Sep 1, 2024 11:38 UTC (Sun) by ralfj (subscriber, #172874) [Link] (10 responses)

I think the focus should be on rustc_codegen_gcc: reusing the entire Rust frontend and middle-end, and just replacing the codegen backend. That has a much higher chance of delivering a compiler that is able to keep up with Rust's development and access GCC's backends.

gccrs is attempting an entirely independent second Rust implementation -- that's orders of magnitude more work than rustc_codegen_gcc, and I don't think there are significant benefits that would justify the cost. (This is not to say the gccrs devs should stop, if they're having fun doing what they do then by all means continue, but in terms of where to allocate resources and where to watch for medium-term results, I think rustc_codegen_gcc is clearly the better choice.)

rustc_codegen_gcc is unfortunately held back by GCC's reluctance to provide a nice library API for accessing its backends, but it seems using the libgccjit library works reasonably well.

Standardization - two independent implementations are good.

Posted Sep 2, 2024 15:12 UTC (Mon) by jjs (guest, #10315) [Link] (9 responses)

gccrs being a second, independent implementation is good. It ensures that the specification is, in fact, clear. I've seen many projects (HW & SW) where the specifications seemed clear to the writers who did an implementation, but someone else followed the specifications, made something that matched the specifications, yet it was not interoperable with the original version. This is the nature of language - there's lots of places where the meaning of a word is not a singular, universally agreed meaning (check any dictionary).

Law dictionaries exist to help ensure legal language is precise & unambiguous. There's a reason IETF requires two, independent implementations before declaring something a Internet Standard - https://www.ietf.org/participate/runningcode/implementati.... If two implementations don't produce the same product, it's time to go back and fine tune the specification to clarify the ambiguities that arise. And the only way to check for ambiguities is via an independent implementation.

Standardization - two independent implementations are good.

Posted Sep 2, 2024 18:43 UTC (Mon) by ralfj (subscriber, #172874) [Link] (8 responses)

> gccrs being a second, independent implementation is good. It ensures that the specification is, in fact, clear.

It may do that. Or it may cause endless issues due to differences in behavior between implementations, as is the case in C. One reason why the standard leaves so many things as "Undefined Behavior" is that implementations happened to implement different behavior, and none of them wanted to change. It's easy for them to agree to make things UB, the consequences are beard by programmers... just look at the entire debacle with realloc-of-size-0 now being UB: https://queue.acm.org/detail.cfm?id=3588242

I don't deny that multiple independent implementations have advantages. But they also have serious disadvantages. And given the resources required to build and maintain them, I am not convinced that it's worth it overall. The fact that language implementations are typically open-source these days has removed one of the biggest arguments in favor of multiple implementations.

Standardization - two independent implementations are good.

Posted Sep 2, 2024 22:09 UTC (Mon) by jjs (guest, #10315) [Link] (2 responses)

Yes, they can define the behavior as UB -which means they've changed the spec. If you have a spec with defined behavior, and two implementations have different behavior, but meet the spec, you really have two choices, IMO -
1. Follow what appears to be the C way - declare it UB in the spec. Also, what I understand from this article & other things I've read about Rust that the Rust community is trying to avoid.
2. Clarify the spec. Choose which behavior is correct (or a third way), and rewrite the spec to clarify it.

In either case, the spec is changed. I suppose a 3rd way is to ignore the problem, but, IMO that's worse.

"The fact that language implementations are typically open-source these days has removed one of the biggest arguments in favor of multiple implementations."

I'll argue the opposite - it's the language implementations being open source is one of the biggest arguments in favor of multiple implementations. Look at what went on with Linux and GCC/LLVM as LLVM began to work to compile the kernel. More defined behavior, from what I can tell. And a huge advantage of open source is everyone can contribute.

Standardization - two independent implementations are good.

Posted Sep 5, 2024 11:40 UTC (Thu) by taladar (subscriber, #68407) [Link]

The C way was to declare it undefined behavior in the spec because the committee of representatives from multiple implementations that already implemented things differently failed to find a consensus whose code should change, not because there is ever any advantage at all in having undefined parts in a spec.

Standardization - two independent implementations are good.

Posted Sep 5, 2024 14:28 UTC (Thu) by ralfj (subscriber, #172874) [Link]

> If you have a spec with defined behavior, and two implementations have different behavior, but meet the spec, you really have two choices, IMO

That's not what happened here. In this case, the C standard was unambiguous since at least C89: "If size is zero and ptr is not a null pointer, the object it points to is freed". Some implementations violated the standard, and somehow it was deemed better to introduce UB into tons of existing code than to fix the buggy implementations.

Such a hypothetical case could of course happen, though. IMO in that case you have a buggy (unintentionally underdefined) standard -- which happens and which needs to be dealt with reasonably well. If you have multiple different implementations of the standard, they are very hard to fix (other than by making the standard so weak that it encompasses all implementations), and that explains some (but not all) of the oddities in C. If you only have a single implementation, it is a lot easier to fix such bugs in the standard/specification by adjusting either the spec (to still have a *defined* behavior! just maybe not the one that we'd ideally have liked to see) or the implementation. These kinds of things happen in Rust fairly regularly. A big part of what makes this possible is that we have the ability to add "future compatibility" lints to Rust so that there's many months or even years of advance notice to all code that might be affected by a compiler change. I worry that with multiple implementations, this kind of language evolution will become even harder than it already is due to the added friction of having to coordinate this across implementations.

Standardization - two independent implementations are good.

Posted Sep 2, 2024 22:40 UTC (Mon) by viro (subscriber, #7872) [Link] (4 responses)

When specification is "whatever the interpreter actually does", you get wonders like sh(1). Which is _not_ a good language to write in...

Standardization - two independent implementations are good.

Posted Sep 5, 2024 11:41 UTC (Thu) by taladar (subscriber, #68407) [Link] (3 responses)

Which is why there is an effort to develop a Rust spec but that still doesn't require a second implementation, just a test suite that checks if the one implementation conforms to the spec.

2nd Implementation tests the meaning of the specification

Posted Sep 7, 2024 17:10 UTC (Sat) by jjs (guest, #10315) [Link] (2 responses)

That test suite can determine if one implementation meets what the spec writers interpret the spec to mean. It can't detect if the spec always means what the spec writers think it means (the wonders of human language). The purpose of a second implementation is to check that the wording of the spec actually only means what the spec writers think it means. I.e. catch unseen errors in the spec. Again, there's a reason IETF requires two independent implementations of an RFC before they declare it a standard.

2nd Implementation tests the meaning of the specification

Posted Sep 7, 2024 17:40 UTC (Sat) by intelfx (subscriber, #130118) [Link]

Or you can simply have one team write the compiler (and maybe the spec) and some other team to write the tests using the spec.

2nd Implementation tests the meaning of the specification

Posted Sep 8, 2024 12:02 UTC (Sun) by farnz (subscriber, #17727) [Link]

That's where two implementations of the test suite comes in handy, since you now have two separate groups of people who've read the specification and agree on what it means; where one test suite fails and the other passes, you need to resolve that by either fixing the specification, or getting the passing test suite to agree that they had a gap in test coverage.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 2:03 UTC (Sat) by sam_c (subscriber, #139836) [Link] (1 responses)

> Yes, the upgrade cycle is faster than for GCC and Clang currently, but this is already slowing as the language features needed for Linux are stabilizing, so now there is a minimum version needed, not an exact version.

I think faster is being generous. Nightly crates are still being used and the minimum Rust version is still extremely recent and being cranked up regularly. I think it's inevitable that Rust will be used in the kernel, but I find it hard to accept it's mature enough to merit being there when so many unstable features are needed.

Rust also doesn't, AFAIK, have any LTS versions for its compiler.

Linux-for-Rust or Rust-for-Linux

Posted Sep 2, 2024 11:55 UTC (Mon) by taladar (subscriber, #68407) [Link]

What benefits do you expect from an LTS version for a compiler where the most recent version is supposed to compile all code previous versions compiled? Sure, there might be the occasional bug compromising that goal but that can (and does) happen with backports to LTS versions too.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 23:05 UTC (Fri) by roc (subscriber, #30627) [Link] (7 responses)

> I don't think, for example, that you can compile Rust for m68k or alpha at this point.

Museum architectures should use museum kernels. It would be madness to let a few hobbyists veto kernel improvements that would benefit all other users.

But also, Rust does support m68k: https://doc.rust-lang.org/rustc/platform-support/m68k-unk...
And hopefully gccrs will make these complaints go away for good.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 12:01 UTC (Sat) by pizza (subscriber, #46) [Link] (5 responses)

> Museum architectures should use museum kernels. It would be madness to let a few hobbyists veto kernel improvements that would benefit all other users.

Except for the little detail that "museum architectures" (and the long tail of old drivers/filesystems/etc) are part of the mainline kernel.

Where do you draw the popularity line? Currently it's at "someone is actively maintaining it."

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 21:25 UTC (Sat) by roc (subscriber, #30627) [Link] (4 responses)

I'm actually paraphrasing Linus: https://lkml.iu.edu/hypermail/linux/kernel/2210.2/08845.html
> At some point, people have them as museum pieces. They might as well run museum kernels.

If new hardware hasn't been sold for 20 years then I think that's probably a good enough line.

Linux-for-Rust or Rust-for-Linux

Posted Sep 1, 2024 18:01 UTC (Sun) by willy (subscriber, #9762) [Link] (3 responses)

The problem is that you can still @#$&%^= buy them!

https://www.nxp.com/products/processors-and-microcontroll...

I'm disappointed, mostly because I worked on a PowerQUICC board back in 2000 and the fact that they are still selling the 68360 24 years later makes me very sad.

Linux-for-Rust or Rust-for-Linux

Posted Sep 2, 2024 7:25 UTC (Mon) by roc (subscriber, #30627) [Link] (2 responses)

Rust actually supports M68K so the real problem is if you could buy new Alpha chips. I don't think you've been able to do that for a long time.

Linux-for-Rust or Rust-for-Linux

Posted Sep 2, 2024 16:03 UTC (Mon) by Wol (subscriber, #4433) [Link] (1 responses)

As I understood it (I never used them) the M68K chips had a sane design, unlike the x86 ones. Maybe the reason you can still buy them is people value them for their simplicity and "easy to understand"ness - that can be worth a lot.

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Sep 2, 2024 19:12 UTC (Mon) by pbonzini (subscriber, #60935) [Link]

The current m68k chips (ColdFire) are a reduced and simplified version of the original instruction set. I doubt that a backwards compatible 680x0 with the addition of SIMD, 64-bit support, CFI, virtualization and whatnot (for example system-wide innovation such as multiprocessor and a fast superscalar microarchitecture) would be overall any more manageable than x86.

Linux-for-Rust or Rust-for-Linux

Posted Sep 1, 2024 11:40 UTC (Sun) by ralfj (subscriber, #172874) [Link]

> And hopefully gccrs will make these complaints go away for good.

Or, (in my view) more likely, rustc_codegen_gcc. :)

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 18:40 UTC (Sat) by josh (subscriber, #17465) [Link]

> I don't think, for example, that you can compile Rust for m68k or alpha at this point. I'd be happy to be told I'm mistaken.

https://doc.rust-lang.org/nightly/rustc/platform-support/...

It's still tier 3, but it exists.

As for alpha, if people still want to keep it alive, rustc_codegen_gcc will handle that eventually.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 21:09 UTC (Fri) by asahilina (subscriber, #166071) [Link] (14 responses)

> It is basically unusable except for unmerged toy projects and it is still not obvious when that will change.

I guess my Apple AGX GPU driver, which is the kernel side to the world's first and only OpenGL and Vulkan certified conformant driver for Apple Silicon GPUs, and also the FOSS community's first fully reverse engineered driver to achieve OpenGL 4.6 conformance, and which is used by thousands of Asahi Linux users in production, and that literally has never had a reported oops bug in production systems not caused by shared C code (unlike basically every other Linux GPU driver), is "an unmerged toy project".

Since you work for Nvidia, I'm sure you've heard of Nova, the up-and-coming Nouveau replacement driver that is also written in Rust using my Rust DRM abstractions. Is that also going to be "an unmeged toy project"?

This kind of demeaning of our work is why us Rust developers are getting very, very tired of the kernel community.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:41 UTC (Fri) by jgg (subscriber, #55211) [Link] (13 responses)

You should be very proud of what AGX has accomplished, it is amazing software, and an incredible piece of work. In fact everyone I've talked to about it has shared that view.

However, that doesn't change today's facts - AGX is currently unmerged and serves a tiny and niche user base with no commercial relavance. That is an unmerged toy by my definition.

There is nothing wrong at all with working on toy software. Linux itself started out as a toy, this is not an attempt to be demeaning.

The point, as pbonzini elaborated on, is a lack of "killer use case" to motivate RH to seriously turn on kernel Rust in RHEL10. AGX will not alter RH's plans.

Nova is barely started, let's wait a few years to see what impact it has. I'm optimistic that a completed Nova would convince several distros to turn on kernel Rust support. I was actually thinking primarily about the Rust NVMe driver.

Unmerged toy

Posted Aug 30, 2024 22:48 UTC (Fri) by corbet (editor, #1) [Link] (3 responses)

Honestly, "unmerged toy" seems like an unnecessarily dismissive term for something like this. How about "out-of-tree useful driver" - a term that we could apply to things like fwctl as well, perhaps :)

The story of why it is unmerged is something I've never quite managed to dig into, but would like to.

Unmerged toy

Posted Aug 31, 2024 20:32 UTC (Sat) by jgg (subscriber, #55211) [Link] (2 responses)

That's for the feedback John. It is admittedly hard to know where colourful language stops being entertaining and people are offended. For instance down below someone was calling m68k/etc a "museum architecture" which is a phrase I've seen many times before. It seems like a popular and accurate term to describe it, yet I would also think that is dismissive to the consistent work Geert and others put in.

Unmerged toy

Posted Sep 2, 2024 7:34 UTC (Mon) by roc (subscriber, #30627) [Link] (1 responses)

Feel free to popularize a different term to describe such architectures. We do need a term for the situation where the effort of supporting an architecture (across the entire project, so including the costs of vetoing changes that would benefit other architectures) exceeds the practical benefits of being able to run the latest kernels on machines of that architecture.

Unmerged toy

Posted Sep 6, 2024 7:36 UTC (Fri) by da4089 (subscriber, #1195) [Link]

> Feel free to popularize a different term to describe such architectures.

"Heritage" is the usual respectful euphemism, I think?

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:49 UTC (Fri) by Ashton (guest, #158330) [Link]

Boy, the existing contributor base of Linux is not covering itself in glory today.

“Toy project”? Can you please try and not be so petty and rude?

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 23:56 UTC (Fri) by airlied (subscriber, #9104) [Link] (2 responses)

Throwing out toy without defining what you mean(even with a definition, it's still not a great word choice), is not exactly a great look here.

Like do we consider the open-gpu-kernel driver from NVIDIA a toy because it isn't upstream?

Asahi is not a driver on the enterprise radar, it won't make RHEL sit up and notice but in does that make it a toy.

I count asahi as a very successful fact finding mission, that in the end is very hard to upstream in a reasonable manner. It's why nova is approaching this from the other end, and building a driver upstream, where we fix the interactions with other subsystems in order as we go, building the ecosystem upstream rather than having it done in a private fork.

The main current focus is driver model and Greg at the moment, next after that will probbaly be getting pci, platform and drm device bindings into shape, KMS modesetting (which Asahi didn't have to tackle), and then the actual nova project.

I've already written a rust implementation that talks to NVIDIA's GSP firmwares and encapsulate the unstable ABI in a similiar form to the Asahi work, and the advantages of this over a C project to do the same are immense. Like night and day difference in how much code had to be written.

I think Linus has said at last year maintainers summit that he was supportive of this, and he thinks it will happen, I think if people start acting as active roadblocks to work, rather than sideline commentators who we can ignore, then I will ask Linus to step in and remove roadblocks, but so far we haven't faced actual problems that education and patience can't solve.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 9:21 UTC (Sat) by Wol (subscriber, #4433) [Link] (1 responses)

> The main current focus is driver model and Greg at the moment, next after that will probbaly be getting pci, platform and drm device bindings into shape, KMS modesetting (which Asahi didn't have to tackle), and th

Given that is at least one (Christoff Hellwig) big developer (you make it sound like two - Greg KH) is throwing a lot of effort into cleaning up the kernel, sounds like they need to be brought on-side if they aren't already.

I'm picking up a lot about Rust-kernel bindings, and how the end result is much cleaner for both the C and Rust sides. So even if the resulting Rust work isn't merged, actually the effort spent creating the Rust interface would be a great help to both of them.

So you now have clean Rust interfaces for anybody who is interested ... and any "I'm not learning Rust" developers who tamper with those interfaces will get shouted at "don't you dare create any (C) bugs that this would have automatically caught!"

Cheers,
Wol

Two implementations - another benefit

Posted Sep 6, 2024 11:46 UTC (Fri) by jjs (guest, #10315) [Link]

Seen it in other projects. You get something that works. Someone else builds a clean implementation - and you start seeing the cleanup in the design/specs as you make the two compatible. Which, in the long term, helps both teams.

Not familiar with Rust, but it sounds like the efforts are having good benefits even without Rust being fully integrated.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 3:30 UTC (Sat) by asahilina (subscriber, #166071) [Link] (4 responses)

> The point, as pbonzini elaborated on, is a lack of "killer use case" to motivate RH to seriously turn on kernel Rust in RHEL10. AGX will not alter RH's plans.

You are aware that the AGX driver is in fact the reason why Fedora is turning on Rust support in upstream kernels, right? I'm pretty sure that is doing more to push RHEL to eventually do the same than anything else, today.

https://gitlab.com/cki-project/kernel-ark/-/merge_request...

Neal is part of the Fedora Asahi SIG.

(Won't comment on your insistence on the "toy" designation since other replies have already done so.)

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 7:38 UTC (Sat) by airlied (subscriber, #9104) [Link] (3 responses)

Red Hat will not turn on rust prior to nova if I had to guess, I'm not seeing any other motivator, I don't see any other motivator.

Don't confuse Fedora, CentOS or ARK with Red Hat here. RHEL is the boss level here, but I don't really care about that, I only care about getting things upstream lined up.

I think a lot of the complaints about rust will evolve away once there is an interesting in-tree consumer, toolchain versions will stabilise, better toolchain support for things upstream needs etc

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 11:11 UTC (Sat) by Conan_Kudo (subscriber, #103240) [Link] (2 responses)

No. Rust is getting turned on because drm_panic is written in Rust. I started working on this for enablement because of AGX, but we need it turned on ASAP because drm_panic is approved for Fedora Linux 42.

Nova is on literally nobody's radar right now because it doesn't exist beyond scaffold. There is no code that does anything yet, to the best of my knowledge, and there will not be any for a long while.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 12:10 UTC (Sat) by airlied (subscriber, #9104) [Link] (1 responses)

DRM panic in Fedora is not a Red Hat commitment to rust in RHEL. I think directly said not to confuse Fedora and Red Hat here.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 12:31 UTC (Sat) by Conan_Kudo (subscriber, #103240) [Link]

Based on the conversations I've had with the RHEL kernel team so far, the main blocker for RHEL is the lack of modversions support for Rust, which is being worked on. I do think it'll get enabled before Nova is in a useful state, because there are other little drivers in-tree where there are C and Rust versions and the Rust versions are better than the C versions.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 10:55 UTC (Fri) by Deleted user 129183 (guest, #129183) [Link] (6 responses)

> There is opposition to merging Rust code just because it's Rust

Which is completely opposite to the predominating attitude of Rustbros, who think that their code is already superior just because it is In Rust. But no, it still has to be up to the standards, regardless of the programming language used.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 13:37 UTC (Fri) by corbet (editor, #1) [Link] (4 responses)

This attitude actually doesn't help either. I don't think we have a problem with "Rustbros" in the kernel community. The Rust-for-Linux developers are doing their best to work within the kernel process and have been making progress, even if slower than they would like. Tossing insults around doesn't help, maybe we can stop that?

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 19:58 UTC (Fri) by Deleted user 129183 (guest, #129183) [Link] (3 responses)

> I don't think we have a problem with "Rustbros" in the kernel community.

So those people with the expectation of ‘merging Rust code just because it's Rust, without ensuring that it fits well into the kernel’ are outside of the ‘kernel community’? Sorry, I’m confused now. But anyway, even if there are no such people now, they will definitely come later and make a mess. Because the Rust culture is broken, for example few days ago, we’ve had a guy in the LWN comments calling another person a ‘bigot’ and ‘Nazi’ just because the latter person wanted to see less Rust content here. And this is not a sign of a healthy attitude inside the Rust community.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 20:38 UTC (Fri) by viro (subscriber, #7872) [Link]

Advocates != developers. I'm not particularly fond of Rust (and IMO the notion of "$LANGUAGE Culture" is among the more ridiculous variations of Whorf-Sapir bollocks, anyway), but confusing Rust advocates with Rust developers is fundamentally unfair.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 21:18 UTC (Fri) by pbonzini (subscriber, #60935) [Link]

> Because the Rust culture is broken, for example few days ago, we’ve had a guy in the LWN comments calling another person a ‘bigot’ and ‘Nazi’ just because the latter person wanted to see less Rust content here. And this is not a sign of a healthy attitude inside the Rust community.

I am not sure why you'd think that he's a member of the Rust community as opposed to a bystander. And the attitude of Rust-for-Linux developers has always been all but professional and respectful. They absolutely don't want their code merged just because it's Rust, though of course they believe the language to be superior in certain ways, especially in how it encodes safe semantics as part of the types.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:36 UTC (Fri) by intelfx (subscriber, #130118) [Link]

> we’ve had a guy in the LWN comments calling another person a ‘bigot’ and ‘Nazi’ just because the latter person wanted to see less Rust content here

No, it was not not because "he wanted to see less Rust content here", but because of his shitty and entitled attitude towards LWN editors and audience. And I'm fairly sure you do understand that.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 16:53 UTC (Fri) by viro (subscriber, #7872) [Link]

Objection: you are using the wrong pronoun in there. In that kind of relative clause 'their' refers to the antecedent. IOW, your syntax conflates the authors of (hypothetical) code with the advocates claiming that code to be superior for no better reason than the language it might use. IMO insults of that magnitude ought to be spelled out explicitly, _especially_ considering the technics used by the specimen (atnot) who'd started that subthread.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 12:21 UTC (Fri) by b7j0c (guest, #27559) [Link] (63 responses)

> So I know it is fun to insult kernel developers and make them all out to be cavemen

cavemen make the world go round

nothing Ted said in the related video snippet is remotely problematic; he doesn't raise his voice, he doesn't insult anyone...he just states his position directly.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 13:22 UTC (Fri) by mb (subscriber, #50428) [Link] (62 responses)

Yes. His *position* is what is problematic.

And that does not surprise me at all.

He doesn't think it's a big problem that crafted filesystem images can cause Undefined Behavior via out of bounds accesses in the kernel.
So I'm not surprised that he refuses to learn Rust.
That's really the same thinking. Let's focus on making the existing C code better instead.

Well. We have tried that for *decades*. And we all failed miserably at it.

The biggest step with accepting a transition to Rust is accepting the failure of C first.
That is a social problem.

It's natural that people defend things they had been doing for decades.

And besides that, stating that "you will not force me to learn Rust" in a talk about Rust *is* insulting. Nobody is forcing anybody.

Refactoring of such cross language interfaces is no different than refactoring cross subsystem interfaces.
If you want to do that, get help from the developers of the other side!
Yes, you need to lean about the other side *OR* ask the people on the other side for help.

There will always be situations where a big refactoring hits areas unknown to the developer doing it.
That is completely unrelated to the language.
It's not a technical problem. It's a social problem. Ask for help.

I'm sure the Rust people would not refuse to work together with Ted to find a good solution.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 20:57 UTC (Fri) by jgg (subscriber, #55211) [Link] (60 responses)

> And besides that, stating that "you will not force me to learn Rust" in a talk about Rust *is* insulting. Nobody is forcing anybody.

The logical end game here is in 10 years the kernel will have a mixture of Rust and C. If you want to be a senior kernel contributor you will need to be a master of both. The idea you can work on the core kernel and be unable to touch large swaths of it is not realistic. People need to be honest about this! The idea that there will always be rust helping hands willing to do whatever the historical C maintainer wants is not reasonable, that might exist for a few years but not over the long haul.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 21:12 UTC (Fri) by johill (subscriber, #25196) [Link] (59 responses)

Maybe it's all just trying to go too fast?

I for one would really like to learn and use rust e.g. for cfg80211's scan handling. That code is awfully complex, with all the lists for hidden, multi-bssid, etc. cases, and I'd think it might be possible to express certain restrictions etc. in rust to make working on it safer.
(Actually we know it has bugs, we just don't know why, and where they are.)
But I can't do that, because I can't well break wifi for everyone on platforms rust doesn't support.

That also means rust currently remains restricted to something that need not work on all platforms, like certain (sometimes duplicate?) drivers, or drivers for special hardware that's only available on some platforms (like the graphics driver people keep talking about).

So I'm probably not going to learn it any time soon unless I change jobs, because realistically there isn't much _else_ I (want to) work on that would warrant learning rust, and I don't have time to RIIR something.

So while I don't necessarily think Ted is right about just breaking rust stuff left and right, there currently isn't even a large opening where as a kernel developer concerned with pretty much _all_ architectures (ok s390 doesn't have wifi, I think) can really even start thinking about it.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:10 UTC (Fri) by mb (subscriber, #50428) [Link] (35 responses)

Yes, it doesn't make sense to integrate Rust into core kernel code that other C code depends on, yet.
But I think Ted's argument came from a slightly different direction.

Let's suppose mac80211 had a Rust driver interface.
That would be a totally valid and good thing to have today.

It would mean that mac80211 maintainers would either have to know Rust (good enough) to maintain that interface themselves or talk to somebody who knows.

I don't see a problem either way.
This is not rocket science.

To me this is a tempest in a teacup.

Learning Rust is not a multi-month approach. Not even multi-week if done seriously.
And most of the learnt things can even be applied to C and C++ programs.
And the best thing is that people get their invested time back from the debugger by being able to write less buggy code.

WHAT?

Posted Aug 31, 2024 0:21 UTC (Sat) by rc00 (guest, #164740) [Link] (32 responses)

> Learning Rust is not a multi-month approach. Not even multi-week if done seriously.

This is a bold-faced lie. An experienced engineer won't learn Rust in under a year. Someone with the talent level of the Primeagen took two years to learn Rust and he is arguably better than the average. The language and their proponents literally pride themselves on the complexity. Do you already forget the "skill issues" toxic posts that sprung up? It was quite similar to the crypto bros and their "ngmi" nonsense.

At best, a senior programmer could reach an *intermediate* level for Rust. Ownership, borrowing, immutable variables by default (the name is an oxymoron), lifetimes (and their annotation syntax), the complex type system, traits, error handling, concurrency/async (`Arc`, `Mutex`, `RwLock`), procedural macros, and unsafe Rust. How do you navigate that list and come away with "not even multi-week"? Anything beyond helloworld.rs is at best a multi-month affair and the inexperience and/or below average programmers are easily multi-year range.

WHAT?

Posted Aug 31, 2024 0:38 UTC (Sat) by Cyberax (✭ supporter ✭, #52523) [Link] (8 responses)

> An experienced engineer won't learn Rust in under a year.

This particular engineer learned Rust in about 2 weeks back around 2018 (IIRC). If you know C++, then it's a fairly straightforward process.

WHAT?

Posted Aug 31, 2024 0:44 UTC (Sat) by rc00 (guest, #164740) [Link] (7 responses)

> This particular engineer learned Rust in about 2 weeks back around 2018 (IIRC). If you know C++, then it's a fairly straightforward process.

Are you suggesting that a sample size of one that can't be corroborated is statistically or otherwise relevant?

Professors I engage with don't even think the language could be taught in a full academic year to upperclassmen.

Which sample size is more relevant when extrapolating to the general programmer?

WHAT?

Posted Aug 31, 2024 0:59 UTC (Sat) by Cyberax (✭ supporter ✭, #52523) [Link] (3 responses)

We're not talking about general programmers, but about kernel developers, who have to intimately understand all the low-level complexities of programming. I just don't buy that it's going to take them significant time to learn Rust on a good enough level.

WHAT?

Posted Aug 31, 2024 11:49 UTC (Sat) by pizza (subscriber, #46) [Link] (2 responses)

> We're not talking about general programmers, but about kernel developers, who have to intimately understand all the low-level complexities of programming. I just don't buy that it's going to take them significant time to learn Rust on a good enough level.

Sure, except for the minor detail that "good enough level" _currently_ means "expert level in bleeding-edge Rust" on top of already being an expert in kernel-C and one or more subsystems. That isn't something you just pick up in a few weeks, even if you had no other demands of your time.

WHAT?

Posted Aug 31, 2024 18:07 UTC (Sat) by Cyberax (✭ supporter ✭, #52523) [Link] (1 responses)

> Sure, except for the minor detail that "good enough level" _currently_ means "expert level in bleeding-edge Rust"

You don't need to be a bleeding-edge expert in Rust to program for Linux. Just as you don't need to be Paul McKenney level of parallel-savvy to use the RCU mechanism.

WHAT?

Posted Sep 2, 2024 12:10 UTC (Mon) by taladar (subscriber, #68407) [Link]

You also don't need to be an expert in a language to fix some bindings you already changed and semantically understand in another language. Most of those changes are just things like an added field of a type that is already in use elsewhere or some extra parameter to some function, not a complete re-evaluation of every invariant in the system and how it is affected by advanced optimizations on obscure platforms.

WHAT?

Posted Aug 31, 2024 1:32 UTC (Sat) by roc (subscriber, #30627) [Link] (1 responses)

What it means to "teach a language" is quite ambiguous.

When you "teach" C and C++ to undergraduates they don't learn the full language and they don't learn to write reliable code. They just learn enough to get code that runs and which is likely chock-full of undefined behavior unless you run sanitizers as part of your grading process.

Teaching Rust would be harder, I agree, but the resulting code will be a lot more robust and I think the students will have actually learned a lot more and will probably be better programmers as a result, even if they end up using C++. Just like learning Hoare logic makes you a better programmer even if you never use it.

WHAT?

Posted Aug 31, 2024 2:30 UTC (Sat) by roc (subscriber, #30627) [Link]

Actually an interesting exercise would be to try to teach undergraduates to write a significant chunk of code for the kernel, some in C and some in Rust, up to the standards the kernel aspires to --- something you can throw fuzzers and sanitizers at. If the fuzzing and sanitizing finds a bug, don't tell them what the bug was, just tell them to try again.

I would bet good money that it is much easier to get the Rust group over this bar than the C group.

WHAT?

Posted Aug 31, 2024 1:40 UTC (Sat) by mussell (subscriber, #170320) [Link]

And how many of those professors have tried teaching Rust? From the way you're phrasing things, it sounds like 0.

Besides professors are probably the worst people to ask as, from my personal experience, they only tend to teach what that have been taught themselves. The C++ course at my university doesn't teach smart pointers, or really anything after C++98 since the prof never had to use them herself. Professors also don't tend to help out students struggling to debug their C code, nor do they mark the final code, that is of course well below their pay grade and is the job of humble student TAs.

And if you want to know just how well professors are teaching C today, go run `git log -i --grep='null pointer deref' --no-merges v6.10..HEAD` in your kernel source tree.

WHAT?

Posted Aug 31, 2024 1:23 UTC (Sat) by roc (subscriber, #30627) [Link] (9 responses)

In 2016, starting with a strong C++ background and some knowledge of the ideas of Rust, but never having written any Rust code, I was productive with Rust in under a week. Looking back at the code I wrote then, it's still fine. I didn't need to know concurrency, async, macros or unsafe right away (async didn't even exist). A few weeks in I started messing with threads, but it was months before I had to use unsafe and years before I wrote a proc-macro or used async.

The situation should be similar now; you're more likely to encounter 'async' early, but OTOH across the board the tools are better (rust-analyzer!) and LLMs can be helpful.

WHAT?

Posted Aug 31, 2024 2:24 UTC (Sat) by rc00 (guest, #164740) [Link] (2 responses)

And yet, in the same timeframe of a few months, I can fit the majority, if not the entirety, of Go, Odin, or Zig in my head. As can many more programmers than those that could do the same with Rust or even C++. I would rather spend my programming time debugging my application and not debugging my knowledge of the language. By your own admission, years into writing Rust, you were still debugging your knowledge of the language. I would consider that counterproductive.

I want to dive into this notion of "productive" and other philosophical tangents another time and another place but I want to leave this anchor out there:

How can you be productive in a language while at the same time, avoiding most of the features? Is that "productive"? Or is that, "I learned conditionals, assignment, and control flow" which is fundamental to operating in any language? It wouldn't take long to be "productive" in any sane language using those criteria and remaining within those confines. At what point can you say you've actually used a language? Can we measure this by percentage of the language that has actually been used? (This would clearly bias smaller languages like Lua but still.)

WHAT?

Posted Aug 31, 2024 2:40 UTC (Sat) by roc (subscriber, #30627) [Link]

> By your own admission, years into writing Rust, you were still debugging your knowledge of the language. I would consider that counterproductive.
> How can you be productive in a language while at the same time, avoiding most of the features?

I didn't avoid "most" of the features. I didn't deliberately avoid any features. The reality is that for most programming tasks you don't need to write "unsafe" or macros. Of course you will use libraries that use those features, and in particular you will use #[derive] to apply proc-macros to your code, but that doesn't require you to understand them.

I do think there is value in a small language that you can thoroughly learn --- that's why C++ is such a disaster and getting steadily worse. The main reason is that when you dig into an existing project you want to be able to understand their code and they might be using any features of the language. But this is a different kind of problem --- e.g. you generally don't need to understand much about how type inference or borrow checking works to understand someone else's code. And for code understanding, the strong isolation that Rust generics give you compared to Zig's comptime is actually in Rust's favour.

WHAT?

Posted Sep 1, 2024 11:53 UTC (Sun) by ralfj (subscriber, #172874) [Link]

You might enjoy this talk https://www.youtube.com/watch?v=QrrH2lcl9ew by a Google employee reporting that they found in-boarding with Rust to be no harder than with Kotlin (around the 10 minute mark).

This is the result of an actual study they did, not just some anecdotes about professors you met. (And FWIW, as a professor, I think it is *much* easier to teach people correct concurrent programming with Rust than with C.)

WHAT?

Posted Aug 31, 2024 3:30 UTC (Sat) by mikebenden (guest, #74702) [Link] (5 responses)

> starting with a strong C++ background and some knowledge of the ideas of Rust, but never having written any Rust code, I was productive with Rust in under a week

You're the second data point (along with Cyberax elsewhere in the comments) who brings up "strong C++ background" as a precondition for "easily picking up Rust". That does make a lot of sense, actually.

As a C programmer with a good working familiarity on kernel and low level topics, I see both C++ and Rust as something that would take a LOT of getting used to, they are both heavily resistant to casual lecture of sources one didn't spend a lot of time and thought writing themselves :)

I don't see "know c++ well" as an obvious required skill for a kernel hacker, so the point that kernel hackers in general would all have to take lengthy detours in order to pick up Rust still stands (unless they're already C++ experts, which would help, but presuming they are is unreasonable, because they're *kernel* hackers, not high-level code monkeys :)

WHAT?

Posted Aug 31, 2024 4:17 UTC (Sat) by roc (subscriber, #30627) [Link]

You don't need to know C++ well to understand Rust. There is a huge amount of C++ machinery that is irrelevant to Rust (e.g. inheritance, overloading, advanced templates (SFINAE), exceptions). OTOH some things do carry over like move semantics (much simpler in Rust though), smart pointers, RAII, abstract base classes (similar to Rust traits), and template member types (Rust associated types).

Then there are other concepts like ownership and lifetimes that are central to Rust that actually exist in C++ (and C) but the language doesn't let you write them down.

So it's not so much that I'm a strong C++ programmer but that I've spent a lot of time working with large C and C++ programs, which means I already had to internalize many of the concepts of Rust and also appreciate its benefits.

WHAT?

Posted Aug 31, 2024 4:30 UTC (Sat) by roc (subscriber, #30627) [Link] (1 responses)

> so the point that kernel hackers in general would all have to take lengthy detours in order to pick up Rust still stands

The thing is, most of what people fear about Rust is already stuff you have to think about in C in the kernel, you just can't write it down. You have to think about ownership (who is responsible for freeing each thing in memory) and how that is transferred. You have to think about borrowed references (i.e. pointers) and lifetimes. You have to think about whether the data you're referencing is immutable or could change behind your back. Rust traits are very much like the manual vtables of file_operations etc. Rust's Result just codifies the distinction between normal results and error result. Rust's Option just lets you write down "this could be null".

I think probably the biggest issue is going to be Rust's generic type system. It's easy to understand how Rust types like Vec<T> are similar to void*-based generic data structures in C (e.g. radix-tree), but in practice there's a lot more value and it takes a bit of experience to use well, especially when you're designing APIs.

Learning Rust vs C

Posted Aug 31, 2024 14:28 UTC (Sat) by kleptog (subscriber, #1183) [Link]

Anecdotally, for the junior developers I've had to help, Rust was way easier than C. C was just giving them segfaults all the time, because lifetimes and mutability are things you have to care about but C doesn't help you. When they were writing Rust however, the compiler basically trained them to think about these things, and how to structure programs while keeping object lifetimes in mind.

The end result is that after this experience with Rust, they can actually do C ok because they know what they need to look out for.

Why not C++? Well, because they needed to write things that worked with various C libraries, and C++ doesn't help you at all there, unless someone has written a C++ wrapper for those libraries. Fortunately, someone had written Rust wrappers for these libraries and cargo managed all the dependencies and installation. Managing C++ library dependencies is disaster in itself.

WHAT?

Posted Sep 1, 2024 1:49 UTC (Sun) by roc (subscriber, #30627) [Link] (1 responses)

Another datapoint, my son (second year university student) has been learning Rust and was able to produce useful code within a couple of weeks of work. He's smart but has very little C or C++ background. I answered a couple of his questions but didn't hold his hand. https://github.com/scrying-circle/nofi/blob/main/rust/src... Not the greatest Rust code, but not too bad. He felt the initial learning curve was steep but he feels like he's already surmounted it.

Learning Rust versus learning C

Posted Sep 1, 2024 9:29 UTC (Sun) by farnz (subscriber, #17727) [Link]

Ancedotally, one of the biggest things I see beginner programmers get wrong is the difference between "this code is correct" and "this code works for the test cases I give it on my machine". In this regard, C is a really painful language for beginners, because you can write code that is semantically meaningless C (IFNDR, UB etc), but that happens to work for the test cases the beginner gives it on their machine.

A language that enforces more rules is, paradoxically, easier for a beginner, because the enforcement means that the code does not work for the test cases they give it on their machine - it does not compile and run on their machine, so they have to fix it.

WHAT?

Posted Aug 31, 2024 5:29 UTC (Sat) by mb (subscriber, #50428) [Link] (6 responses)

>This is a bold-faced lie.

Welcome to my killfile.

WHAT?

Posted Sep 9, 2024 23:22 UTC (Mon) by rc00 (guest, #164740) [Link] (5 responses)

Editor, last Thursday, Go released two security updates and Clojure also released a major update. The only programming language release covered by LWN that day was Rust.

Combine that with idiotic echoes like the one above and you have the exit survey for why I am likely not to renew.

This isn't an indictment of you, your team, or your choices in coverage but it is clear that I am not your target audience. Best of luck.

WHAT?

Posted Sep 10, 2024 17:36 UTC (Tue) by rbtree (guest, #129790) [Link] (2 responses)

OK, I'm not the editor, but...

> Go ... and Clojure

Neither one is a good choice for system-level programming, nor a potential replacement for C in the most significant project this website is about ⇒ there's not much reason for LWN (formerly Linux Weekly News) to cover them.

Although they did cover PHP for a few months a couple of years ago, it seems there was not enough interest among readers to continue.

> idiotic echoes like the one above

You may have misunderstood mb. He blacklisted your future comments because the tone of that phrase is not appreciated; that is all. I see nothing "idiotic" in his comment.

(And yes, I did support LWN while I could, and would still be doing that if not for mindless carpet-bombing performed by certain individuals completely unrelated to this site. No hypocrisy on my end.)

WHAT?

Posted Sep 10, 2024 18:57 UTC (Tue) by rc00 (guest, #164740) [Link] (1 responses)

I didn't intend for this to become a long thread so I don't know how much more I'll reply but here goes.

> there's not much reason for LWN (formerly Linux Weekly News) to cover them.

There doesn't appear to be a clearly defined charter here and that's part of the issue. You've chosen to scope it to just systems-level programming languages despite the fact that the Linux ecosystem makes use of many higher-level and lower-level languages. Worse yet, there is plenty of coverage on this site for a programming language like Python so even the scope you've opted for is wildly off-base.

> it seems there was not enough interest among readers to continue.

And this is the modern challenge that content creation/distribution channels have to face. You either pander to a niche but terminally online vocal minority or you stick to some predefined ethos. The former strategy is a means for survival. The latter strategy means possibly ending up like AnandTech. I don't have the answer or any recommendations here. On my end, my attention and support are finite resources that I would rather focus where I deem they would have the most value.

> I see nothing "idiotic" in his comment.

Inane? Unsubstantial? Witless? We're just going to have to agree to disagree on this one. Maybe it's a problem on my end? I find myself having a shorter and shorter fuse with the pro-Rust crowd. Somehow, they managed to take the worst parts of the Apple fanboys and the Pythonista/Scala/Haskell hype phases and then exponentiated them into something far more toxic and all around worse. I cast aside any benefit of the doubt years ago. At this point, you can call it bias if you want. I would call it a defense mechanism, not unlike one I've developed for the crypto space. When something is off and off-putting, cutting through the chaff is a more than rational response to develop over time.

This ended up being much more than I intended to write so apologies are in order. I also can't see myself continuing this thread too much longer so apologies in advance for not carrying on with this as well.

WHAT?

Posted Sep 10, 2024 20:37 UTC (Tue) by Wol (subscriber, #4433) [Link]

> There doesn't appear to be a clearly defined charter here and that's part of the issue. You've chosen to scope it to just systems-level programming languages despite the fact that the Linux ecosystem makes use of many higher-level and lower-level languages. Worse yet, there is plenty of coverage on this site for a programming language like Python so even the scope you've opted for is wildly off-base.

It's Jon's site. He's part of the core linux kernel team (inasmuch as there is such a team). It's down to him what he cares to put in.

And that's why it's such a good site. I go on about PJ, but the charter for Groklaw was similar - if she wasn't happy with it, it got deleted. That's why it was such a damn good site.

Cheers,
Wol

WHAT?

Posted Sep 10, 2024 19:09 UTC (Tue) by intelfx (subscriber, #130118) [Link] (1 responses)

> why I am likely not to renew

Is this the point where we are supposed to bow our heads in shame?

Recalling some of your comments on the recent Ladybird article... I'd say good riddance.

WHAT?

Posted Sep 10, 2024 19:21 UTC (Tue) by corbet (editor, #1) [Link]

Regardless of the goodness of the riddance, this seems like a good place to stop this subthread, please.

WHAT?

Posted Aug 31, 2024 10:06 UTC (Sat) by hunger (subscriber, #36242) [Link] (1 responses)

Google collected some numbers converting dev teams from to Rust.

They claimed that 1/3 of the new Rust devs feel as productive as in Rust as in their previous language (whatever that was) in less than 3 month. The biggest advantage their devs reported was that code review became significant easier.

The biggest claim is that Rust devs are twice as productive as C++ devs.

https://youtu.be/QrrH2lcl9ew has the entire presentation. It has some details on howmthey collected their numbers.

WHAT?

Posted Aug 31, 2024 13:41 UTC (Sat) by rc00 (guest, #164740) [Link]

I saw this and it was pretty soundly rejected by more intelligent individuals. A common reaction to the absurdity of the asymmetric tests:

https://youtu.be/vB3ACXSesGo

Not that hard

Posted Sep 3, 2024 10:41 UTC (Tue) by tialaramex (subscriber, #21167) [Link] (3 responses)

Nah, it's not that hard. It happened to be especially easy for me because I have decades of experience in semi-colon languages, especially C, and then also the First Language for my CS degree was the Standard ML of New Jersey, so all of Rust makes sense as it's essentially an ML disguised as a semi-colon language. So I'm the easy case, I barely remember "learning" Rust, much of it was like I'd always known this language.

Some top CS graduates will have a similar experience because both Cambridge and Oxford still begin with an ML as First Language and I expect at least a few of the decent CS courses in the US do as well -- beginning with a language that doesn't even have a proper type system makes the initial work of a non-vocational CS course very difficult to motivate.

But even if you've got a more vocational background where you learned like C++ and Python, or Java and Go or something, Rust's adherence to its "Empowering Everyone" slogan makes this a much softer landing that it might be. When you screw up (and you will screw up in any language) Rust will say that you screwed up, why and possibly even explain how to fix that.

In Java or Go you get inscrutable error messages. In Python the program blows up at runtime. In C++ your program - despite being complete nonsense - still compiles, and executes but doesn't do what you expected because it's wrong. What Rust is doing here maybe shouldn't stand out, but it does, and for some programmers this makes a huge difference.

Not that hard

Posted Sep 3, 2024 14:48 UTC (Tue) by mb (subscriber, #50428) [Link] (2 responses)

That is correct.
Contrary to legacy languages the Rust compiler is your friend and guide when writing code and when learning to write code. It tells the programmer what is wrong, provides a hint and a link to detailed information about the problem and often also the actual fix for the problem.

And that process can even be turbocharged with tools like this:
https://crates.io/crates/bacon

Complicated and hard to understand compiler messages do exist in Rust, too. But they are very rare.

Yes, it takes a very long time to learn each and every detail of Rust.
But the same is true for C++ and even C itself.

But getting productive does not take weeks or months.

And learning Rust makes people better at programming in general.
Many concepts from Rust can be used in other languages, too. In fact, the kernel uses many of them already and many uses do predate Rust.
That reduces the step height for kernel developers even further.

I think it's much harder to come from the OOP-language side than from the C side when learning Rust, because OOP-thinking (inheritance) does not really work in Rust.

Not that hard

Posted Sep 5, 2024 12:09 UTC (Thu) by taladar (subscriber, #68407) [Link] (1 responses)

> Contrary to legacy languages the Rust compiler is your friend and guide when writing code and when learning to write code. It tells the programmer what is wrong, provides a hint and a link to detailed information about the problem and often also the actual fix for the problem.

Which is why, when someone claims that Rust is hard because you constantly have to "fight the compiler" you know they are doing something fundamentally wrong in their approach to the language, most likely not paying attention to what the compiler is trying to tell them because the transfer experience with other compilers to Rust where understanding most error messages requires significant effort.

Not that hard

Posted Sep 7, 2024 12:05 UTC (Sat) by khim (subscriber, #9252) [Link]

> most likely not paying attention to what the compiler is trying to tell them because the transfer experience with other compilers to Rust where understanding most error messages requires significant effort.

No, it's not that. Many (most?) developers these days act like “human ChatGPT”: they combine various pieces of code that look somewhat relevant to what they are trying to achieve (often with help of IDE or even, these days, LLMs), then they run the generated mess and when it, inevitably, explodes – they fix the most egregious bugs.

Rust blows that approach to smithereens: sure, compiler says that what you wrote is nonsense… and even shows some possible solutions… but you don't need all that, you need to make your program to run!

Disconnect can be pretty severe and both people who find Rust conceptually easy and people who find it hard often talk “past” each other.

P.S. Note: the fact that Rust is “conceptually” easy doesn't mean it's easy to learn to write programs in it. It's similar to snowboard, in some sense: incredibly easy and simple tool… yet one that requires quite a non-trivial amount of skill to use it. But linux kernel people are, actually, unique positioned to learn it, because many concepts that Rust enforces are, in reality, already in use in Linux kernel… only is come places there code that “violates it a tiny bit”… and Rust wants 100% compliance, not 99% compliance.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 15:37 UTC (Sat) by johill (subscriber, #25196) [Link] (1 responses)

Aside from the "learn it quickly" subthread here ...

Sorry, the example of using it there wasn't really my point.

But like you said, using the wifi example again, if someone were to add rust bindings to mac80211 (which in your view would be a good thing to have), the point is that I'm still going to have to maintain them once they're in the tree, but I get nothing out of it because I can't even use them. So I have to maintain something I can't even _use_ myself.

And I think that's similar for the filesystems: as long as you can't actually rely on rust in general, most stuff will have to be maintained in C.

And I think for me at least, the point is that for those of us working on sufficiently core things rust therefore just adds work, no value. And I can't even really learn rust in the context of the code I'm maintaining, because I can't actually use it there myself! I'd totally be at the mercy of whoever adds the rust bindings, and then try to figure out what that does, but I don't think there'd be much of a chance if I'm not going to use it.

Do I think it's possible to learn rust? Sure. But I don't think it'll happen overnight (nor within a couple of weeks), but more importantly I don't think I'm going to learn rust and how to apply it to mac80211 without even being able to use it there.

(Given enough time I could of course write a toy driver for it or something, but in reality I don't see where to find the time for that. Most maintainers are already overworked. There's probably some promise in rust actually making that better, but that only applies when you can actually use rust for the work you need to do, which is nowhere near true yet for most of us.)

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 18:03 UTC (Sat) by mb (subscriber, #50428) [Link]

>So I have to maintain something I can't even _use_ myself.

What does "use" mean?
Does it mean "what the Intel driver uses"?

If one Rust Wifi driver were added, it would be used. Of course, the interface would not be added without a driver that uses it.

>Most maintainers are already overworked.

Yes. That is true.

But scaring away people with a hostile environment doesn't help that.

It has been a hostile environment 20 years ago and apparently (according to the article) it's still hostile today.
That doesn't improve things and doesn't relieve maintainers.

I'm quite happy that the code I'm still officially a maintainer of has basically become obsolete.
I won't jump in again to new areas as long as there are people potentially shouting at me for no reason.
No thanks.
I guess I'm not the only one.

(Just to avoid misunderstandings: I don't mean you personally. I like you and it was a lot of fun to work together with you. Most of what I am uncomfortable with is outside of the Wifi world)

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 22:45 UTC (Fri) by jgg (subscriber, #55211) [Link] (17 responses)

Bingo, I feel exactly the same way. I could have done iommufd in rust (and security justified it too!), but that is totally impractical. If I can't write any projects in Rust how am I expected to learn the language?

What?

Posted Aug 31, 2024 0:10 UTC (Sat) by rc00 (guest, #164740) [Link] (16 responses)

> If I can't write any projects in Rust how am I expected to learn the language?

Rustlings? But seriously, how would you learn any other programming language? Making demands of it to be supported in the Linux kernel? Or on your own time with your own resources and learning material. There are plenty of Rust projects that only want to do Rust, why not use one of those for a proving ground? Make the same argument with Nim or Odin or C3. These logical blind spots for a programming language are severe and very problematic.

What?

Posted Aug 31, 2024 21:57 UTC (Sat) by jgg (subscriber, #55211) [Link] (15 responses)

I've learned alot of languages in the past, they have all be hand in hand with a productive project. Today my full focus is on kernel work, I actually can't just stop and take a month off to go do something else. Other people depend on me to get their work done too!

If Linus were to declare that Janurary has no releases - a "learn rust month long holiday" and we could all get off the treadmill and get a head start on learning then sure maybe?

I understand the chicken and egg situation, but understanding it doesn't mean it is solved.

What?

Posted Sep 1, 2024 0:58 UTC (Sun) by rc00 (guest, #164740) [Link] (13 responses)

I can sympathize. Doesn't that add fuel to the bear case for Rust though? A language that is known for a steep learning curve and people who have limited reserves of extra time don't bode well for the long-term and probably don't mix well. I could see the argument for a different language that was simpler (especially with a better toolchain) but for the present, it seems like there's much more momentum in the opposition party to this experiment.

Either way, best of luck with all the work! We're all thankful for what you do! IOMMUFD is neat!

What?

Posted Sep 1, 2024 11:43 UTC (Sun) by jgg (subscriber, #55211) [Link] (12 responses)

I would be much more comfortable with the kernel rust project if I could see path from A -> B where myself and my hundred team mates could learn rust and *start using* it in a definable time frame. I don't see it, and I don't see people even talking about it yet.

FWIW, after sleeping on it, I really like the idea of a "Rust Holiday" declared by Linus. Not only does it help give people space to do something productive it is also a clear, but still soft, endorsement and message of the project's intent and direction. Might be a great rallying point.

Yes, I agree with your assesment. I think there is alot of energy in the "opposition party", and I'm not optimistic this can be overcome with the current approach. I'm am quite surprised by the forceful statements from Dave and Kees that this is done and decided. Definately not going to get involved in that fight when it comes. Let me know when it is over and we have a clear decision and workable plan please!

I'm glad you enjoy the projects! Thanks!

What?

Posted Sep 1, 2024 13:08 UTC (Sun) by rc00 (guest, #164740) [Link] (1 responses)

I can sense your enthusiasm but I struggle with the viability of the concept as useful for Rust. The main issue is that there are still many other challenges with the tooling, not just the language.* When there is adequate plumbing, then it makes sense to learn how to be a plumber. This experiment highlights much of what was already known: Rust and C are very different and incompatible languages, ignoring some of the community challenges as well. Rust is more often grouped with C++ even though there is a misnomer of it being an alternative to C. (To me, a viable alternative to C, should it ever exist, should embody C's simplicity and spirit of empowerment, but I digress.)

I do think there is value in the overall concept though! If some other language(s) were to prove viable and compatible with the Linux kernel project and effective (read: stable) infrastructure could be established, a development hiatus for upskilling and on-boarding would be tremendous for progress. To me, this as a takeaway could be the most valuable part of the Rust experimentation process.

* https://www.youtube.com/watch?v=OdMQwDtumJ8

What?

Posted Nov 28, 2024 20:06 UTC (Thu) by deepfire (guest, #26138) [Link]

> To me, a viable alternative to C, should it ever exist, should embody C's simplicity and spirit of empowerment

This makes me think that you still don't "get it" -- as mentioned by many, "C's simplicity" doesn't exist.

Tongue in cheek -- according to your definition of simplicity -- is assembly simpler or more complex?

If you agree, then why is your definition of simplicity a desirable goal?

If you disagree, then you must also disagree that C is simple.

What?

Posted Sep 1, 2024 20:35 UTC (Sun) by airlied (subscriber, #9104) [Link] (9 responses)

What do you think is missing from a workable plan?

You've been in the industry long enough to know how these things work, I find it unusal that anyone with so much industry experience can't see the writing on the wall.

You've described so many chicken/egg situations that just go away once the ball starts rolling down the hill, and often won't be solved in advance of getting over the top of the hill.

Objections like, rust in the kernel needs unstable toolchain features, will go away as people start to rely on rust in the kernel, not before. Of course as long as it is out of tree and has no hard deps in the tree, devs will push for newer toolchain features etc. Once the tree has a reason to lock down and not experiment that will all become harder.

Same for the we need support for ancient architectures, if it matters, someone will get to it, if it doesn't nobody will. I don't see the nvidia open driver supporting m68k for instance.

I would say the ball is 90% rolled up a hill, the big problem is the whole no code in the kernel without users, and we are solving it, but until that big first user lands in the kernel and people want to enable it in distros I don't think momentum will be achieved. Once all the basics for writing a driver and bindings to all the common things are in, then I expect people will have a lot happier time. I also only expect to have to drag Linus in when we get Ted style pushback from someone who matters.

I realised a year ago the value here for bringing on new developers, easier driver development and memory safety, before I'd even learned the language, I've only just seriously started writing code in rust in the past few weeks and I've brought up a bunch of nova in userspace across a lot of unstable firmware interfaces and it's much nicer than any C code I could have written.

What?

Posted Sep 2, 2024 0:50 UTC (Mon) by jgg (subscriber, #55211) [Link] (2 responses)

I don't know maybe I talk to different people than you? I've seen enough smaller fights to be sufficiently worried about of what is coming. This is *different*. The politics and discussions have a dangerous feel to them, reminds me of the code of conduct debate in some ways, IMHO.

So, I think, the tehnical side will reach 90% at some point and that will be the starting gun for the real fight. This is going to be chaotic and wild. Just look at the people who are already on-record being pretty significantly anti-rust. I think you see the same thing "Drag Linus in" is not exactly something you say when you anticipate a cordial walk in the park discussion. Seriously, count me out, call me when it is done.

We have rarely (ever?) seen the kernel community competently handle the choice of breaking someone's stuff vs allowing someone else's work, and it has very frequently leaned on the theme of "no regressions" for these kinds of arguments. Causally saying someone else will fix m68k, or not, is dangerously similar to what Ted suggested in that video, I don't see there will be alot of support for that idea.

So, a workable plan, is figure out some way to avoid or minimize the fighting! Come up with rules and agreement, in advance with timelines on when things will be allowed. There is a huge practical difference between merging something like drm_panic, or binder, and, say, me changing the iommu subsystem to require Rust. Figure out some kind of agreed framework for making these decisions.

For example, if we are at 90% today then that is enough to let things that can be disabled with minimal user impact be in Rust. It kind of feels like that is what we are doing informally today anyhow.

The next gate may be that Android has completed a full release cycle at 100% Rust support, then anything that is principally for Android/embedded can be in Rust.

Then maybe the next gate is RHEL/etc/etc have also completed a full cycle with 100% Rust support. Then Rust is fair game to use for general drivers.

And finally when we have full and complete support in all toolchains, architectures and distros for a year, then Rust is fair game to use anywhere.

Include some plan for training, etc. I like my Linus Rust Holiday idea quite a bit.

Have guidelines for rewriting/replacing existing code.

It needs to be written down, like the COC situation, where all kinds of people sign up to agree to it, and it needs to be on a *slow* timeline because we have a huge ecosystem that will take ages to swallow something this big.. Then, maybe, the fights would be small enough.. Communication is so important here.

I'm just making stuff up, to illustrate what I think a plan may sort of look like - I don't want to debate any of this (seriously, count me out). I really just want to read about the outcome in LWN :P

(I don't know anything about it, but I heard a story that someone sent obscure arch enablement patches to the NVIDIA driver's github. Since they are not part of the kernel community they have no obligation to act in any particular way, but if someone sent me m68k enablement patches for RDMA I would be expected to accept them as the duty of a maintainer)

What?

Posted Sep 3, 2024 19:36 UTC (Tue) by airlied (subscriber, #9104) [Link] (1 responses)

I really don't think we need to overthink this. We roll out the upstream support for a few things, see how it goes. Find where there is value in adding the next thing see how it goes. Creating a plan means a lot of people will expend a lot of time/energy on not doing the work of making rust work well in the kernel, for the benefit of very few people.

I'd rather stick with, "people who do the work, decide the plan" and let the plan evolve. I've never seen any plans for the Linux kernel either internally at companies or upstream work out in any fashion.

We do evolution really well, we should stick to our strengths.

I don't think we'll be taking "just because" rust rewrites, but again each maintainer needs to determine their own comfort level here. If we had a component with a history of memory safety issues then a rust rewrite might make it worth the investment. But from a point of view of upstreaming, I think we need novel drivers and features to start bringing in rust, not just virtual and ext2 rewrites, which are useful for finding a path, but not for driving upstream change.

What?

Posted Sep 4, 2024 18:32 UTC (Wed) by jgg (subscriber, #55211) [Link]

A plan is all about getting people on board to try to avoid so much fighting. It doesn't matter if the plan works out or not, it is the discussion and getting buy-in that is important here.

This isn't evolution. It is a step change, and it has built into it ongoing demands to other peoples time, not just "people who do the work pay the cost".

I don't think you will get novel drivers like this. People with a commercial interest will not get involved with this much uncertainty and backporting problems standing in the way. It is already hard to get C stuff merged, 'be the first rust in X' is 10x harder and more unpredictable.

What?

Posted Sep 2, 2024 10:13 UTC (Mon) by nim-nim (subscriber, #34454) [Link] (5 responses)

IMHO (which does not count for much) there are technical and infrastructural points (which are being addressed) and there are cultural points. It’s very hard to change collective behaviours once they have crystallised.

For Rust to be successful in the kernel Rust code writers need to interact well with C code writers because the C core is not going anywhere in the short term. Your legacy language sucks look how much better mine is let’s rewrite all your unsafe code is not a good template for (human) interaction. Some better customs needs to emerge.

Unfortunately all this is more easily said than done.

What?

Posted Sep 2, 2024 16:08 UTC (Mon) by Wol (subscriber, #4433) [Link] (4 responses)

> Rust code writers need to interact well with C code writers because the C core is not going anywhere in the short term.

> Unfortunately all this is more easily said than done.

And the majority of the problem seems to be that the C code writers don't want to interact :-(

Cheers,
Wol

What?

Posted Sep 2, 2024 16:59 UTC (Mon) by pizza (subscriber, #46) [Link] (3 responses)

> And the majority of the problem seems to be that the C code writers don't want to interact :-(

No, the majority of the problem is that the "C camp" and the "Rust camp" have (fundamentally?) different priorities, and there's no "higher authority" to disabuse one or both parties of their sense of self-importance.

What?

Posted Sep 3, 2024 4:53 UTC (Tue) by marcH (subscriber, #57642) [Link] (2 responses)

> disabuse one or both parties of their sense of self-importance.

Don't forget loud voices on the Internet are NOT representative.

It's really hard not to forget. I forget it every day. Everyone looking at TV news and social media does too. Every participant in this thread does.

What?

Posted Sep 3, 2024 11:20 UTC (Tue) by ms-tg (subscriber, #89231) [Link] (1 responses)

> Don't forget loud voices on the Internet are NOT representative.

While undoubtedly a good point and useful reminder, I have a follow-up question.

Are Ted T’so’s comments not representative of a set of kernel *maintainers*?

Wondering if, to address the question of representativeness directly, Linux might eventually need a list of (subsystem, maintainer, open to working with Rust for Linux Team to define interface semantics Y/N) tuples?

What?

Posted Sep 3, 2024 15:12 UTC (Tue) by marcH (subscriber, #57642) [Link]

How representative are maintainers? That sounds like a very interesting question but quite different from "people shout at and don't understand each other". You can have extremely polite maintainers that are not representative at all.

Like any other volunteer work, being a maintainer has an element of "trade": trading the work against dictating how it's done to some extent. This is summarized in the "BDFL" acronym. Again, all such "dictatorship" can be done very quietly and politely.

Of course this works only up to a point: no one wants a totally disconnected volunteer. But then:
1. How do you measure the disconnection?
2. Do you even have someone else to take over?

To measure 1. you could organize... a shouting match? Could not resist sorry :-)

What?

Posted Sep 1, 2024 1:35 UTC (Sun) by Cyberax (✭ supporter ✭, #52523) [Link]

> If Linus were to declare that Janurary has no releases - a "learn rust month long holiday" and we could all get off the treadmill and get a head start on learning then sure maybe?

That actually might be a great idea. He had one of this pauses during the introduction of git, after the BitKeeper fiasco.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 23:39 UTC (Fri) by roc (subscriber, #30627) [Link] (4 responses)

It's a chicken and egg problem. You don't want to learn Rust because you can't use it in the kernel. Meanwhile, you can't use it in the kernel because kernel developers don't know Rust.

Linux-for-Rust or Rust-for-Linux

Posted Aug 31, 2024 15:39 UTC (Sat) by johill (subscriber, #25196) [Link] (3 responses)

It's not really _want_ though, it's more like ... how many hours are there in a day. If I could use it for the job I need to do, great. But I can't.

And no, the reason I can't use it in the kernel is that it can't be in sufficiently core parts of the kernel, given the tools and architecture support story.

How could Rust improve?

Posted Sep 1, 2024 15:10 UTC (Sun) by gmatht (subscriber, #58961) [Link] (2 responses)

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?

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.

Linux-for-Rust or Rust-for-Linux

Posted Sep 4, 2024 6:31 UTC (Wed) by ebiederm (subscriber, #35028) [Link]

In my experience Ted Tso in maintaining ext4 has been the most serious of the filesystem developers in dealing with crafted images.

He has previously promised to fix all problems that are clearly identified. Finding all of them is the issue. Last I looked it was an open problem on how to do that.

I looked because it was a roadblock to my work.

Of course this was before the recent crop of fuzzers.

Linux-for-Rust or Rust-for-Linux

Posted Sep 2, 2024 23:38 UTC (Mon) by anthm (guest, #173221) [Link] (4 responses)

> There is not much opposition to Rust in the kernel community — far less than I had expected, honestly

But there is opposition, and it's loud and aggressive as evidenced by the video.

Loud aggressive and seemingly not particularly caring about the technical merit of their arguments.

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 0:32 UTC (Tue) by pizza (subscriber, #46) [Link] (3 responses)

> But there is opposition, and it's loud and aggressive as evidenced by the video.

There is "opposition" to nearly everything that is submitted for inclusion in Linux, for any number of reasons, technical or otherwise. Historically this opinionated maintainer gatekeeping activity has been lauded as a GoodThing(tm), and has been one of the primary contributors to steadily raising the overall quality bar for the past 30-odd years.

Meanwhile, on what basis do you assume that video is representative? Or is it just an example of confirmation bias?

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 7:24 UTC (Tue) by Wol (subscriber, #4433) [Link] (2 responses)

> Historically this opinionated maintainer gatekeeping activity has been lauded as a GoodThing(tm), and has been one of the primary contributors to steadily raising the overall quality bar for the past 30-odd years.

The problem, and history will also tell you this, is that "opinionated gatekeeping" from the "young turks" can be a damn good thing. The problem is when they become "old turks", they are a damn liability!!!

Robert Hooke (or was it Boyle?) is, iirc, a particularly good example, but it seems to be the norm. "Science advances one funeral at a time" or whatever the quote is. Why should Computer Science (and linux) be any exception?

Unfortunately, all the serious pushback from opinionated maintainers seems to be of the form "I don't like it so it's not going in". That's a VERY strong indicator that the maintainer in question should step down and retire! If the reaction was "I don't like this - I don't understand it but it's ringing alarm bells" then fair enough. That at least opens the door for dialog.

I'm afraid (hoping?) things could easily start going the way someone else suggested. All it will take is for Asahi to do what she's threatened - rewrite drmbuf or whatever it was. Linus then says "okay, it looks good, it's going in" - as he should if it lives up to its promises, and next minute all new graphic drivers will be in Rust.

At which point, all those opinionated gatekeeper maintainers will find their fiefdoms deprecated to "legacy" as new people come in with Rust versions and shove them aside. That, imho, would be an extremely successful manoeuvre for linux, even if tragic for the likes of Ted. (And there's plenty of alternative disk formats. No reason why it should always be ext2/3/4. The momentum for change already seems to have been building for a while ...)

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Sep 3, 2024 13:17 UTC (Tue) by pizza (subscriber, #46) [Link] (1 responses)

> Linus then says "okay, it looks good, it's going in" - as he should if it lives up to its promises, and next minute all new graphic drivers will be in Rust.

Linus has a lot of "soft power" but at the end of the day, he can't actually _force_ anyone to do anything. Other than enforcing the "Linux" trademark, anyway.

> Unfortunately, all the serious pushback from opinionated maintainers seems to be of the form "I don't like it so it's not going in".

Their objections have considerably more meat than that. Even Ted Tso's.

(And I recall numerous Rust folks having strong opinions about what should or shouldn't go in to stuff they maintain. So let's not pretend that opinionated maintainers are okay for me, but not for thee!)

> as new people come in with Rust versions and shove them aside.

(1) there isn't a legion of "Rust developers" just waiting at the gates, and (2) nearly everyone seems to vastly, vastly underestimate just how much _work_ these core maintainers actually do, day in and day out. Rust doesn't magically make most (if any) of that ongoing work become unnecessary.

Linux-for-Rust or Rust-for-Linux

Posted Sep 5, 2024 1:16 UTC (Thu) by raven667 (subscriber, #5198) [Link]

> nearly everyone seems to vastly, vastly underestimate just how much _work_ these core maintainers actually do, day in and day out

this seems to be a major sticking point, for someone who learned a Rust, understands the code and is past that experience it can be hard to understand the fear and trepidation from a maintainer who may feel like they are burnt out and just hanging on at the edge of their competence and time, who are told that they need to stretch and grow and spend even more mental effort learning when they don't feel like their current workload will take a holiday to let their brain relax and absorb new thoughts. It just looks like pain. Like being at mile 20 in a marathon and having someone start jogging alongside saying "what's wrong with you,why are you breathing so hard, can't you go faster".

The Rust design seems to do what it was designed to do well, which can clear up whole classes of hard to find bugs, but being right isn't the same as winning hearts and minds and its supremely frustrating to be right and still lose. It's one thing to be confident you are technically correct, it's another to make changes which affect millions of people when you are nagged by doubt that the house of cards will topple of you touch it wrong, from somewhere outside your awareness

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 21:41 UTC (Thu) by pizza (subscriber, #46) [Link] (3 responses)

> Refactors like Folios are a significantly more invasive and far reaching than anything Rust has proposed so far.

It was also _incremental_ and didn't require fundamentally changing your tooling, workflows, and cognitive load.

> - Believing good decisions can only be made by fiat of strong leaders and not collaboratively by community consensus.

Both of those have some pathological failure conditions -- eg the first makes "wrong" decisions, and the latter never actually decides anything at all. Debian is a great example of this. (Meanwhile, there are other models, incluidng "those that do the _work_ make the decisions" and "you've earned your place as a leader by showing up to do the work consistently for a decade")

> - It is not worth it to design systems holistically to eliminate certain problems from the beginning.

Meanwhile, you can't make an omelette without breaking some eggs. Your original design is _always_ wrong. But you won't know how/what is wrong until it encounters the real world.

- So-called "soft-skills" like writing documentation should not be treated as essential parts of programming. Someone else will come along and do those. That works for the dishwasher after all.

You can "should" all you want, but at the end of the day, this won't change as long as folks paid to produce code, not documentation. (And if we're not paid at all, then what gives you any say what we should or shouldn't do?)

- The linux kernel is not just a piece of software like any other. Linux kernel developers are not just normal, average software developers. Learnings from outside the linux kernel, even from other kernels, are thus not applicable to us.

Yes, Yes, and very-much Yes. Objectively so, in both scope and scale.

And why do you presume that learnings can only go one way? Hubris, indeed.

- Tools should be built primarily around purely technical concerns, not around the humans that use them. Acknowledging their fallability and flaws is an insult and leads to worse software.

How about "different tools have different purposes"? (And a tool that cannot solve the technical problem doesn't even merit consideration!)

- And let's not ignore the spicy one: Having sufficient visibly female and queer people that you can't just dismiss them as quota fillers will doom a project, as they are by their nature less meritable.

WTF is this bullshit?

> However I'm ultimately more positive about the outlook there. Between AGX and Nova, we're about to be in a situation where 2/4 desktop graphic card drivers will run on Rust. I think that, even with the resistance to Rust, the kernel will not be able to afford to keep these things out of tree forever if people keep maintaining them.

...Just like Linux was unable to afford to keep the ginormous vendor Android trees (and their GPU drivers) out? How well did that work out?

...Again, Rust is only optional if nothing you need depends on it. And once you need it, that's a flag day, and you might as well make other stuff depend on it too because you're already paying the price, so you might as well maximize your benefits.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 0:52 UTC (Fri) by gerdesj (subscriber, #5446) [Link]

"- So-called "soft-skills" like writing documentation should not be treated as essential parts of programming. Someone else will come along and do those. That works for the dishwasher after all."

You are aware that big Jon is the kernel documenter-in-chief? ... and he runs LWN.

Describing LWN and #1 as "soft-skills" and hence non essential is not going to endear you to anyone. The Linux kernel is not a dishwasher and a lot of people spend a lot of time and effort documenting it.

I'll leave it there.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 9:26 UTC (Fri) by amacater (subscriber, #790) [Link] (1 responses)

Your comment on the community approach never doing anything at all and citing Debian - that may be a fair viewpoint from a long way out, but in practice Debian is a "do-ocracy" and the people that do the work get to make (the vast majority) of decisions.

Even when things get really protracted and discussions go on for years (systemd), it ends up that the people that do the work get to decide the technical and practical implementations of any ridiculously long debate. The number of huge discussions is decreasing and flamewars are largely out of fashion.

On visible diversity in any project - that's a problem in any significant project which doesn't reflect that talent is found in the widest community and actively seek it out.

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 11:51 UTC (Fri) by pizza (subscriber, #46) [Link]

> Your comment on the community approach never doing anything at all and citing Debian - that may be a fair viewpoint from a long way out, but in practice Debian is a "do-ocracy" and the people that do the work get to make (the vast majority) of decisions.

That my exact (if poorly-expressed) point -- It's the "strong leaders" that actually make the decisions by virtue of actually doing the damn work while "the community" endlessly bikesheds. This is pretty much true in all "communities".

> On visible diversity in any project - that's a problem in any significant project which doesn't reflect that talent is found in the widest community and actively seek it out.

At some point, one has to accept that "Individual talent" and "Individual interest" are not synonymous, especially in volunteer settings where a paycheck isn't involved.

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 22:11 UTC (Thu) by rcampos (subscriber, #59737) [Link]

I do remember Mathew sending an email saying something like: fuck it, I can't take this anymore, don't merge this if you don't want.

(Not quoting, something along those lines is what I recall).

And not so much longer after that, they were merged.

Linux-for-Rust or Rust-for-Linux

Posted Aug 29, 2024 22:25 UTC (Thu) by Wol (subscriber, #4433) [Link] (1 responses)

> I'm sure you can think of more. Of course, the degree to which these beliefs are held in any one person will vary, and there are equally things that go the other way. But the general point is that views that extend far outside of the kernel and programming lead people to *really want* the project to either fail or succeed to prove or disprove those beliefs. Which makes things much harder than they need to be.

Focusing on the wrong metric?

My recent exchange has shown me that database designers focus far too heavily on worst case access. Because MultiValue cannot (and makes no attempt to) guarantee fast worst case response, it's dismissed. But in order to guarantee a worst case of O(log(n)), relational pretty much also guarantees a best case of O(log(n)).

So let's take a database with 100,000 rows. Relational pretty much guarantees *all* accesses are O(5). Compare that to MultiValue which guarantees (absent a pathological mess) 95,000 rows will be accessed O(1). It also guarantees to five 9s that all accesses will be O(5) or better! (which is why I picked 100K :-)

And then, assuming the relational database is First Normal Form it gets even worse - because MultiValue is 4th Normal Form, 100K records in MV are probably the same as half a mill FNF rows ...

Which would you prefer - a database that is slow and leaves you waiting forever (unless it's running on the latest and greatest electricity-guzzling monster), or a database that's maybe ten times faster, but has a slight risk of the odd query taking for ever? I would have thought a five 9s guarantee that MV is faster than relational would at least earn SOME interest...

Plus MV doesn't protect database designers from crap decisions - at least relational is an equal opportunities slowcoach :-) It peanalises novice and expert designers alike. What MV does have is plenty of tools to say "your worst case will be order X". And I've personally had experience of accidentally pathological tables - they're still damn fast.

Cheers,
Wol

Linux-for-Rust or Rust-for-Linux

Posted Aug 30, 2024 15:19 UTC (Fri) by ma4ris8 (subscriber, #170509) [Link]

C compiler is a tool, to convert source code into executable program.
Rust compiler is a tool, to convert source code into executable program.

Languages differ quite a bit. There is a common set of erroneous code that
are detected at compiler time. Other set of erroneous code is detected with linters.

Some programming models are shared with C and Rust.
Some programming models are C specific, some are Rust specific.

So both tools improve productivity, and prevent various incorrect programs.
Finding more error cases, might consume a bit more CPU time.

To take advantage of Rust's ability to detect more classes of errors at compile and lint time,
perhaps it could be that C code doesn't have to be changed,
or then to make life easier to both C and Rust developers, some
engineered solution might be needed to keep the implementation simple as a whole.


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