Re: [PATCH 0/6] Initial Rust V4L2 support

From: Miguel Ojeda
Date: Tue Apr 11 2023 - 08:36:18 EST


On Tue, Apr 11, 2023 at 11:52 AM Hans Petter Selasky <hps@xxxxxxxxxxx> wrote:
>
> Assume you need to update both the kernel and the rust compiler at the
> same time. How do you do that? In the binary download case you have two
> machines. One to build rust and one to build the kernel, so it is
> technically not possible?

I don't understand the problem -- you can build (or download) new
toolchains without changing the kernel, and you can keep several
kernels and several toolchains installed, too.

> I'll give you a real-life example to emphasis this. Apple and Microsoft
> has done something very bad in the file system area. They mistreat what
> happens to be the Norwegian character "å" (0xE5). Norway is where I
> live. Their solution is to split the "å" character into the "a"
> character (0x61) and the combining ring-over character (0x30A).

Sorry, but I don't see how all that relates to the current discussion (kernel).

> Daniel and Miguel: By saying it is not a good thing to build systems
> completely from source,

I haven't said that at all. I regularly build from source myself, in fact.

> For people that build stuff on their laptops it still matters. If you
> have a beefy machine, it is a different case.

I don't follow. You said you are downloading 100s of GiB for XCode,
but you are not OK with 100s of MiBs for Rust?

Anyway, both the Rust toolchain and the kernel can be built on laptops
(I do so), and they don't need to be the highest end ones at all.

> I thought that Rust didn't allow you to write outside the bounds of
> arrays, similarly to the old Turbo Pascal language?

It avoids all UB, including data races, not just out-of-bounds
accesses, as long as the unsafe parts are sound (and there are no
compiler bugs etc.). Which is one of the main reasons we want it in
the kernel.

> If there could be one base compiler and toolchain, I would be happy.

If you mean a single vendor, then it may be interesting for you that
GCC will include Rust support in future releases. It remains to be
seen when their compiler is ready for building the kernel parts, but
it is one of their goals as far as I understand.

> Right, so think about where that slowness may end up one day, if you
> suddenly need to re-build everything from sources so to say :-)

If you want to build everything from source, then you will need some
CPU time to do so. That is just how things work. Most people will just
use the toolchain from their distribution.

> Thanks for your input!

Not at all, thanks for your input too :)

Cheers,
Miguel