Re: [TECH TOPIC] Rust for Linux

Mike Rapoport
2021-07-06T16:09:21Z

On Tue, Jul 06, 2021 at 06:42:18PM +0300, Laurent Pinchart wrote:
> On Tue, Jul 06, 2021 at 05:33:42PM +0200, Miguel Ojeda wrote:
> > On Tue, Jul 6, 2021 at 5:03 PM Sasha Levin <sashal@kernel.org> wrote:
> > >
> > > Does this mean that anyone who wishes to modify these C APIs must also
> > > know Rust to fix up those abstractions too?
> >
> > Please see my answer to James and Leon, i.e. if we have abstractions
> > for a particular subsystem, it should mean somebody is happy to write,
> > use and maintain them.
>
> There are lots of core APIs that are used by most drivers and that are
> not subsystem-specific, so those will need to be considered too.
>
> Additionally, even if there's a subsystem maintainer willing to maintain
> a Rust abstraction, it also means that someone doing tree-wide or
> subsystem-wide refactoring will need to pull the maintainer(s) in and
> make it a team project. I really don't see how that can scale, tree-wide
> changes are already very painful.

It seems to me that refactoring of core APIs would be impossible without
Rust knowledge. If the change touches more that one subsystem, coordinating
between the developer doing the refactoring and the people who maintain the
Rust abstractions is not going to be easy.

> > That means that, yes, for subsystems that have Rust abstractions, if
> > you want to touch the C API, you also need to do so for the Rust
> > abstractions. But for any heavy refactor, I would expect maintainers
> > being the ones doing it, or at least helping to do so if somebody else
> > wants to change something in the C side and does not know how to
> > update the Rust side.
>
> I'm afraid that doesn't really match how development is done today :-)
> Lots of subsystem-wide refactoring is done by developers who are not
> subsystem maintainers.

Agree, many times people doing large refactoring are not subsystem
maintainers. And maintainers not necessary have time and/or desire to help.

That said, anybody doing tree-wide changes, even as relatively simple as
splitting several functions into a dedicated header, would need to learn
Rust.

--
Sincerely yours,
Mike.