WEBVTT

00:00:01.550 --> 00:00:05.590
<v Matthias>Welcome to another episode of Rust in Production, a podcast about companies

00:00:05.590 --> 00:00:07.990
<v Matthias>who use Rust to shape the future of infrastructure.

00:00:08.330 --> 00:00:12.670
<v Matthias>My name is Matthias Endler from corrode, and today I'm joined by Danilo Krummrich

00:00:12.670 --> 00:00:17.010
<v Matthias>from the Linux Kernel Project to talk about bringing Rust into the kernel.

00:00:19.310 --> 00:00:23.390
<v Matthias>Danilo, thanks so much for taking the time for the interview today.

00:00:23.650 --> 00:00:27.710
<v Matthias>Can you quickly say a few words about yourself and about Red Hat,

00:00:27.890 --> 00:00:28.730
<v Matthias>the company you work for?

00:00:28.730 --> 00:00:34.490
<v Danilo>Of course, thanks for the invitation. Yeah, so my name is Danilo and I'm a Linux

00:00:34.490 --> 00:00:39.170
<v Danilo>kernel engineer working at Red Hat in the accelerators and GPU group.

00:00:39.610 --> 00:00:44.270
<v Danilo>And I'm also a maintainer in the Linux kernel of various subsystems,

00:00:44.330 --> 00:00:48.110
<v Danilo>components and drivers and member of the Rust4Linux team.

00:00:48.730 --> 00:00:54.710
<v Matthias>It's almost intimidating to think that you work on such an important project

00:00:54.710 --> 00:00:57.290
<v Matthias>and also on such a low level.

00:00:57.470 --> 00:01:03.510
<v Matthias>I guess a lot of people that are listening in either use Linux or get in contact

00:01:03.510 --> 00:01:07.950
<v Matthias>with Linux on a daily basis because, you know, we use a ton of servers nowadays

00:01:07.950 --> 00:01:09.550
<v Matthias>and a lot of these run on Linux.

00:01:09.730 --> 00:01:14.170
<v Matthias>What does it feel like to work on that level and how did you even get started

00:01:14.170 --> 00:01:15.710
<v Matthias>with kernel development?

00:01:15.710 --> 00:01:20.310
<v Danilo>I don't think it necessarily feels different than working on any other software

00:01:20.310 --> 00:01:22.410
<v Danilo>project, I would guess. I cannot really tell.

00:01:22.630 --> 00:01:26.930
<v Danilo>I worked on a few other projects in the past 10 years ago. I worked a little

00:01:26.930 --> 00:01:29.610
<v Danilo>bit on the AOSP, so the Android open source project.

00:01:30.050 --> 00:01:35.170
<v Danilo>I worked there at kernel level as well, but also some user space portions.

00:01:36.270 --> 00:01:41.770
<v Danilo>So i was always interested in the kernel since i finished my exams at university

00:01:41.770 --> 00:01:47.610
<v Danilo>and when i joined the first company that i also worked at when i was a student

00:01:47.610 --> 00:01:52.050
<v Danilo>i i just told people hey i'm interested in the kernel i want to work at that

00:01:52.050 --> 00:01:54.730
<v Danilo>just get me to the just get me to the base layer team,

00:01:55.770 --> 00:02:01.170
<v Danilo>and then i just started working there and and especially i started learning

00:02:01.170 --> 00:02:05.330
<v Danilo>a lot the learning curve was very, very high.

00:02:05.610 --> 00:02:10.270
<v Matthias>When was the first time you personally heard of the Rust4Linux project?

00:02:10.830 --> 00:02:14.630
<v Matthias>When was the first time you heard about, I mean, discussions,

00:02:14.630 --> 00:02:16.770
<v Matthias>adding Rust to the Linux kernel?

00:02:17.010 --> 00:02:22.230
<v Danilo>I would say almost from the beginning, because I'm following what's going on

00:02:22.230 --> 00:02:24.890
<v Danilo>in the project, what's discussed in mailing lists.

00:02:25.330 --> 00:02:30.110
<v Danilo>But this was more reading along. It was not that I I was immediately,

00:02:30.530 --> 00:02:36.670
<v Danilo>okay, this is definitely something we need to, I need to get involved in. But I was aware.

00:02:37.150 --> 00:02:38.570
<v Matthias>Did you know Rust back then?

00:02:39.730 --> 00:02:42.910
<v Matthias>So this was all new for you, but how did it feel like?

00:02:43.210 --> 00:02:48.890
<v Matthias>Can you remember the time, the feeling that maybe thinking about the adoption

00:02:48.890 --> 00:02:53.630
<v Matthias>of Rust and was that the time when you also looked at the language for the first time?

00:02:54.390 --> 00:02:59.650
<v Matthias>Can you talk about your first impressions of the language coming from a mostly

00:02:59.650 --> 00:03:00.790
<v Matthias>C background, I'm guessing?

00:03:01.570 --> 00:03:05.730
<v Danilo>It was a bit intimidating, I would say. The C language is very, very simple.

00:03:05.810 --> 00:03:09.490
<v Danilo>And in the kernel, we are doing very, very complicated things.

00:03:09.490 --> 00:03:11.070
<v Danilo>With a very, very simple language.

00:03:12.070 --> 00:03:17.730
<v Danilo>With Rust, it's different. Rust is a very difficult language, I would say.

00:03:19.050 --> 00:03:25.130
<v Danilo>But at the same time, it makes some of the problems we have to solve much easier to solve.

00:03:25.330 --> 00:03:27.550
<v Danilo>So I guess that's a good trade-off.

00:03:27.910 --> 00:03:32.430
<v Matthias>Did you ever second-guess the adoption of Rust in a Linux kernel,

00:03:32.470 --> 00:03:36.430
<v Matthias>or was it always clear to you that there were very obvious benefits?

00:03:37.670 --> 00:03:44.150
<v Danilo>So after I got used to the concepts of Rust and understood what they are about

00:03:44.150 --> 00:03:48.950
<v Danilo>and understood how I can utilize them, I don't have any doubt.

00:03:49.680 --> 00:03:53.620
<v Danilo>This is really i'm very or let it say the other way around i'm very very convinced

00:03:53.620 --> 00:03:59.220
<v Danilo>that rust definitely has a big future in the kernel how.

00:03:59.220 --> 00:04:02.520
<v Matthias>Long did it take to build out the entire infrastructure infrastructure that

00:04:02.520 --> 00:04:09.340
<v Matthias>is needed for such a project inside the kernel and outside the kernel from the rust side i mean.

00:04:09.340 --> 00:04:12.240
<v Danilo>So i think a lot

00:04:12.240 --> 00:04:15.280
<v Danilo>of initial so a lot of the initial work was

00:04:15.280 --> 00:04:19.640
<v Danilo>and i cannot say a lot about that because that was not the time where i joined

00:04:19.640 --> 00:04:24.720
<v Danilo>the project this was before i joined the project but i think and if i'm forgetting

00:04:24.720 --> 00:04:28.840
<v Danilo>someone i'm very sorry about it but i i think it was mainly Miguel and and Wedson

00:04:28.840 --> 00:04:32.780
<v Danilo>so Miguel Ojeda and Wedson Almeida who,

00:04:34.240 --> 00:04:40.520
<v Danilo>started the Rust4Linux project and in a downstream branch worked out a lot

00:04:40.520 --> 00:04:41.460
<v Danilo>of infrastructure,

00:04:42.460 --> 00:04:47.700
<v Danilo>And the initial support in the Linux kernel, build system integration, and so on.

00:04:48.280 --> 00:04:51.320
<v Danilo>And I think the initial lift there

00:04:51.320 --> 00:04:55.780
<v Danilo>was to convince people that it's worth adding it to the Linux kernel.

00:04:55.940 --> 00:04:59.860
<v Danilo>There were approaches adding a second language into the kernel in the past.

00:05:00.060 --> 00:05:03.340
<v Danilo>I think C++ was tried a couple of times, and it failed badly.

00:05:03.920 --> 00:05:09.540
<v Danilo>So adding a new language to the Linux kernel is definitely not an easy thing to attempt.

00:05:09.960 --> 00:05:16.220
<v Danilo>And they were successful. So I think this milestone was really one of the big ones.

00:05:16.760 --> 00:05:22.460
<v Matthias>Why has Rust succeeded, quote unquote, to be adopted in the Linux kernel and C++ not?

00:05:23.120 --> 00:05:29.380
<v Danilo>So I think that a subset of C++ would have been a great addition to the kernel.

00:05:29.680 --> 00:05:33.220
<v Danilo>Just to name two examples, the first one being inheritance.

00:05:33.800 --> 00:05:40.960
<v Danilo>The C kernel code relies a lot on the inheritance pattern. So getting some language

00:05:40.960 --> 00:05:44.500
<v Danilo>support for that would definitely been a great improvement.

00:05:44.880 --> 00:05:54.140
<v Danilo>And the second one that I think is very, very useful is as simple as field visibilities of structures.

00:05:54.460 --> 00:06:01.780
<v Danilo>So we have the case in the kernel that generic components obviously have fields that are,

00:06:02.550 --> 00:06:05.830
<v Danilo>or should be accessed by design by

00:06:05.830 --> 00:06:11.190
<v Danilo>the users but there is also private fields and what we often end up is that

00:06:11.190 --> 00:06:17.110
<v Danilo>drivers instead of representing their needs by contributions to the common component

00:06:17.110 --> 00:06:25.710
<v Danilo>in the kernel instead abuse private fields of the structure and basically peek into component.

00:06:27.470 --> 00:06:32.590
<v Danilo>Internals, which obviously is not considered by the component maintainers in

00:06:32.590 --> 00:06:39.130
<v Danilo>the end and hence causes problems in maintainability and can actually lead to bugs in the kernel.

00:06:39.710 --> 00:06:43.450
<v Danilo>So those are problems that are solved by Rust as well.

00:06:43.850 --> 00:06:49.010
<v Danilo>And I think overall, Rust is just the much better fit for the kernel because

00:06:49.010 --> 00:06:53.550
<v Danilo>we have much less things that are not a good fit for the kernel.

00:06:53.810 --> 00:07:01.490
<v Danilo>Plus, it has all the additional features that help with memory safety that C++ does not have.

00:07:01.810 --> 00:07:07.590
<v Danilo>However, it also brings some disadvantages with it, which is the common practice

00:07:07.590 --> 00:07:16.330
<v Danilo>in Rust to just unwrap results or unwrap options. So basically operations that panic the program.

00:07:16.490 --> 00:07:21.050
<v Danilo>And in user space, that's the same option in a lot of cases.

00:07:21.050 --> 00:07:25.570
<v Danilo>But in the kernel, it almost never is a sane option because a panic in the kernel

00:07:25.570 --> 00:07:30.390
<v Danilo>is really just the last resort when the system is in a state where it's basically

00:07:30.390 --> 00:07:36.870
<v Danilo>non-recoverable and otherwise you would corrupt memory or in the worst case

00:07:36.870 --> 00:07:38.230
<v Danilo>even corrupt file systems.

00:07:38.610 --> 00:07:45.270
<v Danilo>So this is something that we have to take care of when using Rust in the kernel

00:07:45.270 --> 00:07:51.450
<v Danilo>that we're making it hard for people to accidentally trigger panics in the kernel.

00:07:52.520 --> 00:07:59.220
<v Matthias>So what was your first task when starting with Rust4Linux?

00:07:59.460 --> 00:08:04.520
<v Matthias>Was it a thing that you voluntarily picked up or was there a need at work where

00:08:04.520 --> 00:08:07.680
<v Matthias>you needed to start the Rust, where you needed to touch the Rust part?

00:08:09.000 --> 00:08:16.620
<v Danilo>I think it really started with me taking maintainership of the Nouveau driver.

00:08:16.620 --> 00:08:26.480
<v Danilo>And it's also a result out of the way forward with Nouveau and the introduction of Nova.

00:08:27.260 --> 00:08:33.760
<v Danilo>So with the Nouveau driver, we have a lot of issues which are...

00:08:33.760 --> 00:08:40.720
<v Danilo>So back then when I started at Red Hat, I started working on a component that's

00:08:40.720 --> 00:08:44.780
<v Danilo>named GPUVM for the DRM subsystem.

00:08:44.780 --> 00:08:50.180
<v Danilo>I mean, it's basically managing the GPU's virtual address space and doing some

00:08:50.180 --> 00:08:53.620
<v Danilo>more things in the context of providing

00:08:53.620 --> 00:08:58.280
<v Danilo>helpers for drivers to implement Vulkan-compatible user space APIs.

00:08:58.680 --> 00:09:05.080
<v Danilo>So APIs that are given out to user space drivers, for instance, Mesa.

00:09:07.280 --> 00:09:14.400
<v Danilo>So the work of GPU VM I did in the context of adding a new UAPI to Nouveau,

00:09:14.580 --> 00:09:16.260
<v Danilo>which is Vulkan-compatible.

00:09:16.860 --> 00:09:23.540
<v Danilo>And in order to get that going in Nouveau, we needed to do quite some changes

00:09:23.540 --> 00:09:27.060
<v Danilo>on how the page table management of the GPU itself works.

00:09:27.580 --> 00:09:32.640
<v Danilo>But it was never possible to do it to the full and correct extent.

00:09:32.640 --> 00:09:34.460
<v Danilo>We still have problems there.

00:09:34.600 --> 00:09:41.360
<v Danilo>And that's because the design of how Nouveau is written just doesn't really

00:09:41.360 --> 00:09:48.240
<v Danilo>work out well for this kind of requirements that we get from a Vulkan-compatible UAPI.

00:09:48.240 --> 00:09:53.500
<v Danilo>So those design reworks would be a lot of effort,

00:09:53.740 --> 00:09:57.460
<v Danilo>especially considering that Nouveau

00:09:57.460 --> 00:10:03.720
<v Danilo>supports a huge range of GPUs and GPU architectures and generations.

00:10:04.420 --> 00:10:11.740
<v Danilo>So you can basically split them up into the generations before NVIDIA introduced

00:10:11.740 --> 00:10:14.520
<v Danilo>GSP and after NVIDIA introduced GSP.

00:10:14.520 --> 00:10:21.260
<v Danilo>So GSP means GPU system processor, and it's a firmware processor that lives within the GPU.

00:10:21.760 --> 00:10:26.800
<v Danilo>And instead of programming the hardware directly, if you have a GSP GPU,

00:10:27.060 --> 00:10:34.340
<v Danilo>you can just talk to the firmware through a ring buffer and a firmware-specific

00:10:34.340 --> 00:10:36.700
<v Danilo>protocol and instruct the firmware

00:10:36.700 --> 00:10:40.600
<v Danilo>to do the things that you would usually program through registers.

00:10:42.620 --> 00:10:50.680
<v Danilo>And by reworking all those layers to get a Vulkan compatible UAPI we would need

00:10:50.680 --> 00:10:57.220
<v Danilo>to consider the whole range of GPUs, the ones pre-GSP and the ones since GSP introduction,

00:10:58.320 --> 00:11:03.900
<v Danilo>so that would be a lot of effort just to rework something we also have other

00:11:03.900 --> 00:11:08.440
<v Danilo>problems with and the other problems we have in Nouveau are.

00:11:09.920 --> 00:11:12.640
<v Danilo>How well it's documented and how

00:11:12.640 --> 00:11:15.960
<v Danilo>it's designed so Nouveau consists out of lots

00:11:15.960 --> 00:11:19.600
<v Danilo>and lots of v tables with callbacks that

00:11:19.600 --> 00:11:22.740
<v Danilo>are not really documented in terms of ownership

00:11:22.740 --> 00:11:26.160
<v Danilo>and lifetimes of the objects that are allocated returned and

00:11:26.160 --> 00:11:29.220
<v Danilo>and handled which is which

00:11:29.220 --> 00:11:32.380
<v Danilo>is one of the huge problems and one problem

00:11:32.380 --> 00:11:35.600
<v Danilo>that is really important to me personally to

00:11:35.600 --> 00:11:38.620
<v Danilo>address is that Nouveau

00:11:38.620 --> 00:11:42.880
<v Danilo>is just not really accessible to users we don't

00:11:42.880 --> 00:11:46.120
<v Danilo>have a lot of contributors and i

00:11:46.120 --> 00:11:51.120
<v Danilo>think the reason for that is because just no one really understands how it works

00:11:51.120 --> 00:11:57.500
<v Danilo>and doesn't get comfortable working with that driver and for an open source

00:11:57.500 --> 00:12:03.720
<v Danilo>project that's not really what you want so what we,

00:12:04.420 --> 00:12:09.500
<v Danilo>there ended up with was to decide at a certain point we should do a new driver

00:12:09.500 --> 00:12:16.000
<v Danilo>we should do a driver that is gsp only and if we do a new driver now we saw

00:12:16.000 --> 00:12:17.980
<v Danilo>that Rust4Linux is progressing.

00:12:19.180 --> 00:12:24.860
<v Danilo>We thought okay if we do a new driver now we have the choice do we do another c driver,

00:12:25.520 --> 00:12:37.140
<v Danilo>or do we do a Rust driver where the language solves a lot of problems for us that DRM drivers have.

00:12:37.300 --> 00:12:40.480
<v Danilo>So DRM drivers, GPU drivers are usually very, very complicated,

00:12:41.360 --> 00:12:47.600
<v Danilo>suffer from race conditions, suffer from memory issues and just because they're

00:12:47.600 --> 00:12:49.760
<v Danilo>complicated and it's hard to get it right.

00:12:50.060 --> 00:12:56.420
<v Danilo>And Rust helps a lot with that. So we decided to go for a Rust driver and or

00:12:56.420 --> 00:13:00.420
<v Danilo>actually first step evaluate if we want to do a rust drive and this is where

00:13:00.420 --> 00:13:06.120
<v Danilo>i got in touch with rust in the kernel the first time because i started doing this

00:13:06.120 --> 00:13:08.920
<v Danilo>evaluation of is a rust driver,

00:13:10.040 --> 00:13:17.780
<v Danilo>for the successor of Nouveau doable is it is it reasonable and what are the

00:13:17.780 --> 00:13:21.280
<v Danilo>things that we need to consider what are the things that we need to do to get it going.

00:13:21.280 --> 00:13:24.440
<v Matthias>And so at this point in time you're

00:13:24.440 --> 00:13:30.100
<v Matthias>thinking is rust a better choice for writing a completely new driver for nvidia

00:13:30.100 --> 00:13:36.260
<v Matthias>graphics cards for the linux kernel and moving away from the legacy codebase which

00:13:36.260 --> 00:13:40.960
<v Matthias>was Nouveau back in the day i think Nouveau not even sure when it started but

00:13:40.960 --> 00:13:42.380
<v Matthias>it's been around for a while right.

00:13:43.060 --> 00:13:47.880
<v Danilo>Yeah i think it's it's around for 15 20 years.

00:13:47.880 --> 00:13:51.220
<v Matthias>Yeah okay so that

00:13:51.220 --> 00:13:56.880
<v Matthias>must mean the code base is relatively evolved it has evolved and it's probably

00:13:56.880 --> 00:14:02.300
<v Matthias>complicated to maintain i'm not sure about the status but i'm just guessing

00:14:02.300 --> 00:14:07.860
<v Matthias>that with 15 years or 20 years of development time it might not be the easiest

00:14:07.860 --> 00:14:10.940
<v Matthias>codebase to work with especially for beginners yeah.

00:14:10.940 --> 00:14:13.660
<v Danilo>It absolutely grew over a long period of

00:14:13.660 --> 00:14:19.760
<v Danilo>time and yeah so the lack of documentation and the fact that Nouveau was maintained

00:14:19.760 --> 00:14:26.780
<v Danilo>for a long time by a single person and all the knowledge about how things are

00:14:26.780 --> 00:14:31.500
<v Danilo>meant to work within the driver only really exists in the head of this person

00:14:31.500 --> 00:14:32.940
<v Danilo>doesn't really help either.

00:14:33.920 --> 00:14:37.560
<v Matthias>Okay, but when you describe it like that, it sounds really daunting to start

00:14:37.560 --> 00:14:42.320
<v Matthias>a new driver because you kind of need to get that business logic,

00:14:42.520 --> 00:14:45.260
<v Matthias>port it over first to a new language,

00:14:45.560 --> 00:14:51.520
<v Matthias>second from an older code base, which maybe you are not 100% familiar with.

00:14:51.660 --> 00:14:53.920
<v Matthias>I'm not sure. Maybe you were. Yeah.

00:14:54.870 --> 00:15:00.890
<v Matthias>There might be a lot of internals or assumptions or implications in the code,

00:15:00.890 --> 00:15:03.750
<v Matthias>which will make that port harder as well.

00:15:04.070 --> 00:15:08.650
<v Matthias>And on top of it, you also have to understand the structure of the Linux kernel

00:15:08.650 --> 00:15:13.530
<v Matthias>itself and how subsystems and drivers interact and so on.

00:15:13.610 --> 00:15:16.490
<v Matthias>So it sounds like a very challenging task.

00:15:16.690 --> 00:15:21.930
<v Danilo>Oh yeah, it is challenging, no question. But it's not like we're potting over the logic.

00:15:21.930 --> 00:15:26.610
<v Danilo>The good thing is that we're starting from GSP only,

00:15:27.070 --> 00:15:35.290
<v Danilo>which means that not only, but to a large extent, we really have to understand

00:15:35.290 --> 00:15:37.130
<v Danilo>how the firmware interface works.

00:15:37.370 --> 00:15:43.030
<v Danilo>And this is absolutely doable and doesn't really require to understand every

00:15:43.030 --> 00:15:45.910
<v Danilo>single bit of what the Nouveau code does.

00:15:46.110 --> 00:15:51.670
<v Matthias>And so you can start to port over that part alone in isolation.

00:15:51.930 --> 00:15:57.770
<v Danilo>Yeah, so what we went for is we basically split the Nova driver into two separate drivers.

00:15:58.270 --> 00:16:02.570
<v Danilo>One of them basically provides, which we call NovaCore,

00:16:02.970 --> 00:16:09.250
<v Danilo>provides the hardware and firmware abstraction layer, which is needed not only

00:16:09.250 --> 00:16:15.930
<v Danilo>by Nova DRM, which is the second Nova driver, basically, and implements all the DRM parts.

00:16:15.930 --> 00:16:22.170
<v Danilo>So where DRM is direct rendering manager, it's the subsystem in the kernel that

00:16:22.170 --> 00:16:24.410
<v Danilo>handles GPUs and accelerators.

00:16:25.770 --> 00:16:31.010
<v Danilo>So this is then the second driver and it sits on top of NovaCore and it's,

00:16:32.060 --> 00:16:36.140
<v Danilo>utilizes the hardware through this abstraction layer this

00:16:36.140 --> 00:16:39.720
<v Danilo>is necessary for two reasons the first is that

00:16:39.720 --> 00:16:43.340
<v Danilo>there is also the nvidia vgpu

00:16:43.340 --> 00:16:47.220
<v Danilo>driver which is currently making its way upstream which

00:16:47.220 --> 00:16:50.140
<v Danilo>is a virtualization layer or actually it's

00:16:50.140 --> 00:16:53.780
<v Danilo>only really the manager of the virtualization layer because

00:16:53.780 --> 00:16:57.700
<v Danilo>it manages the pci virtual

00:16:57.700 --> 00:17:01.220
<v Danilo>functions so the gpu has has one

00:17:01.220 --> 00:17:04.260
<v Danilo>physical function that is exposed through

00:17:04.260 --> 00:17:07.960
<v Danilo>to the system to the host kernel which is

00:17:07.960 --> 00:17:11.220
<v Danilo>where a normal driver would sit on top of but additionally

00:17:11.220 --> 00:17:14.240
<v Danilo>there are protocols in the pci layer that allow

00:17:14.240 --> 00:17:17.280
<v Danilo>the gpu to expose also

00:17:17.280 --> 00:17:20.220
<v Danilo>virtual functions which looks like as if

00:17:20.220 --> 00:17:23.180
<v Danilo>they were additional gpus but actually they

00:17:23.180 --> 00:17:28.020
<v Danilo>are virtualized within the graphics card and vgpu

00:17:28.020 --> 00:17:34.640
<v Danilo>manages those through nova core by utilizing nova core to expose those virtual

00:17:34.640 --> 00:17:39.360
<v Danilo>functions to virtual machines and then virtual machines can run nova core again

00:17:39.360 --> 00:17:44.680
<v Danilo>and then Nova DRM on top to actually expose the full graphics stack.

00:17:45.800 --> 00:17:51.580
<v Danilo>So that's one reason why we have this driver split, because we have basically

00:17:51.580 --> 00:17:55.380
<v Danilo>multiple clients for the firmware and hardware abstraction layer that lives within NovaCore.

00:17:56.340 --> 00:18:02.660
<v Danilo>The second reason is the firmware API that is exposed by the GPU,

00:18:03.660 --> 00:18:09.620
<v Danilo>is not stable, or at least we cannot rely on this API to be stable.

00:18:10.240 --> 00:18:13.860
<v Danilo>And that's one of the things where Rust helps a lot as well,

00:18:14.040 --> 00:18:20.480
<v Danilo>because abstracting the firmware API is much easier with the powerful Rust type

00:18:20.480 --> 00:18:25.380
<v Danilo>system and things like PROC macros compared to C where we,

00:18:25.640 --> 00:18:31.220
<v Danilo>in the end, would need to build endless VTables to differentiate between the

00:18:31.220 --> 00:18:35.820
<v Danilo>different firmware versions And then you can build more VTables to gather the

00:18:35.820 --> 00:18:39.100
<v Danilo>common code that's maybe similar between certain versions,

00:18:39.100 --> 00:18:44.520
<v Danilo>which becomes a huge mess and is one of the reasons why Nouveau is also not sustainable.

00:18:46.600 --> 00:18:51.500
<v Matthias>And in Rust, that would be a proc macro, which could be expanded,

00:18:51.860 --> 00:18:55.420
<v Matthias>which might end up being the same Vtable, but you don't have to write it yourself.

00:18:55.820 --> 00:18:57.000
<v Danilo>Yes. Yes.

00:18:57.900 --> 00:19:01.000
<v Matthias>Now, a bit of a silly question, but bear with me for a second.

00:19:02.000 --> 00:19:06.780
<v Matthias>How do you even start with developing such a driver in the kernel?

00:19:06.920 --> 00:19:08.960
<v Matthias>You can't just possibly say cargo new.

00:19:10.140 --> 00:19:12.560
<v Matthias>How do you initiate a new driver?

00:19:12.560 --> 00:19:18.540
<v Danilo>From the technical side of things, it's very easy because the major work of

00:19:18.540 --> 00:19:23.260
<v Danilo>integrating the Rust compiler into the Linux kernel has already been done before

00:19:23.260 --> 00:19:24.780
<v Danilo>I joined the Rust4Linux project.

00:19:25.100 --> 00:19:28.900
<v Danilo>And this is also what the Rust tree in the kernel is actually about.

00:19:29.060 --> 00:19:31.500
<v Danilo>It's about compiler and build system support.

00:19:31.700 --> 00:19:35.340
<v Danilo>It carries a lot of other things and carries a lot of other base infrastructure

00:19:35.340 --> 00:19:36.780
<v Danilo>that we have in the kernel as well.

00:19:37.080 --> 00:19:40.660
<v Danilo>But its main focus is compiler and build system.

00:19:41.400 --> 00:19:44.820
<v Danilo>So you basically create a

00:19:44.820 --> 00:19:47.620
<v Danilo>new driver the exact same way as you would create

00:19:47.620 --> 00:19:50.500
<v Danilo>a new driver in c in the kernel which

00:19:50.500 --> 00:19:53.860
<v Danilo>is you create a kconfig file create a

00:19:53.860 --> 00:19:56.600
<v Danilo>new config option for the kernel to include this new

00:19:56.600 --> 00:19:59.580
<v Danilo>component which is i don't know 10

00:19:59.580 --> 00:20:02.480
<v Danilo>15 20 lines of of code most of

00:20:02.480 --> 00:20:05.340
<v Danilo>that being just module description and then

00:20:05.340 --> 00:20:10.300
<v Danilo>you have a make file where you add the the

00:20:10.300 --> 00:20:17.780
<v Danilo>core rs file which then pulls in all other modules to the global variable that

00:20:17.780 --> 00:20:23.720
<v Danilo>grabs all the all the source files for the cabled build system and that's it

00:20:23.720 --> 00:20:29.920
<v Danilo>and then it builds so this part is is actually pretty easy We're not using Cargo.

00:20:30.040 --> 00:20:32.980
<v Danilo>So we're integrating the Rust compiler into kbuild.

00:20:33.970 --> 00:20:36.610
<v Matthias>Okay, but then you have a driver which does essentially nothing.

00:20:36.610 --> 00:20:40.330
<v Matthias>You still have to communicate with the outside world. How does that look like?

00:20:40.690 --> 00:20:43.650
<v Danilo>Exactly. So then you basically have a driver stub.

00:20:43.930 --> 00:20:47.450
<v Danilo>Actually, you don't even have a driver stub. The only thing you really have

00:20:47.450 --> 00:20:52.690
<v Danilo>is a so-called kernel module, which has an entry point and an exit point,

00:20:52.870 --> 00:20:55.950
<v Danilo>which is the init function and the exit function.

00:20:56.150 --> 00:21:01.170
<v Danilo>That's it. In the Rust abstraction, it's basically an init function and the

00:21:01.170 --> 00:21:04.270
<v Danilo>exit function is basically just drop off the module structure.

00:21:05.450 --> 00:21:09.150
<v Danilo>But that's all you got. Now you need some driver infrastructure.

00:21:09.150 --> 00:21:15.850
<v Danilo>And that's where the first challenge was for the Nova project because a lot

00:21:15.850 --> 00:21:19.130
<v Danilo>of work has been done before I joined the Rust4Linux project.

00:21:19.130 --> 00:21:25.250
<v Danilo>Like the initial integration of the Rust compiler into the build system,

00:21:25.590 --> 00:21:30.610
<v Danilo>module support, lots of generic infrastructure that you need.

00:21:30.830 --> 00:21:38.770
<v Danilo>So abstractions for handling C reference counted structures on the Rust side, for instance.

00:21:39.190 --> 00:21:44.310
<v Danilo>Some locking stuff was there. So really just the absolute fundamental basics.

00:21:44.830 --> 00:21:49.330
<v Danilo>But there was no driver infrastructure. So you weren't able to write drivers.

00:21:49.610 --> 00:21:55.230
<v Danilo>So the first thing that we actually needed to come up with was core driver infrastructure,

00:21:55.230 --> 00:22:04.210
<v Danilo>which is the representation of a device, representation of a driver,

00:22:04.850 --> 00:22:10.570
<v Danilo>representation of a bus, and all the glue code to connect things together.

00:22:11.560 --> 00:22:14.420
<v Danilo>But i think before i talk more about that we would

00:22:14.420 --> 00:22:17.480
<v Danilo>need to go one step back and

00:22:17.480 --> 00:22:20.620
<v Danilo>talk about what we call abstractions in

00:22:20.620 --> 00:22:24.460
<v Danilo>Rust4Linux right yeah so the

00:22:24.460 --> 00:22:27.820
<v Danilo>approach we we take and what rust focuses on

00:22:27.820 --> 00:22:31.200
<v Danilo>in the kernel is really drivers this is

00:22:31.200 --> 00:22:34.280
<v Danilo>where we can get most of the value of the language in

00:22:34.280 --> 00:22:37.180
<v Danilo>the short term i think also because

00:22:37.180 --> 00:22:40.460
<v Danilo>of the architecture of Linux. Linux is a monolithic kernel

00:22:40.460 --> 00:22:43.920
<v Danilo>and therefore all drivers also

00:22:43.920 --> 00:22:47.200
<v Danilo>run in kernel space and if a driver messes things

00:22:47.200 --> 00:22:50.160
<v Danilo>up it breaks the whole machine right

00:22:50.160 --> 00:22:59.940
<v Danilo>so if we are able to provide support for writing drivers in rust a huge part

00:22:59.940 --> 00:23:09.880
<v Danilo>for safety and and reliability of the kernel is is is achieved also if we consider that.

00:23:10.760 --> 00:23:18.660
<v Danilo>Subsystem code, so really kernel core code, is reviewed and tested much more

00:23:18.660 --> 00:23:20.620
<v Danilo>thoroughly than driver code is.

00:23:21.080 --> 00:23:26.900
<v Danilo>So the most value in the shortest time really get from drivers.

00:23:27.700 --> 00:23:33.440
<v Danilo>And the mechanism that people have worked out to interface with C infrastructure

00:23:33.440 --> 00:23:38.620
<v Danilo>is to write so-called abstractions. So we're not directly calling C functions

00:23:38.620 --> 00:23:41.100
<v Danilo>from Rust because that would be fundamentally unsafe.

00:23:42.220 --> 00:23:45.760
<v Danilo>Because then we would need to deal with raw pointers all the time.

00:23:45.900 --> 00:23:48.960
<v Danilo>And then we wouldn't really get a lot of the benefits from Rust.

00:23:49.140 --> 00:23:54.120
<v Danilo>So what we're doing instead is we're building abstractions, which means that

00:23:54.120 --> 00:23:59.900
<v Danilo>for a C structure and its corresponding functions to Rust.

00:24:02.260 --> 00:24:06.580
<v Danilo>Achieve the functionality that's intended by the structure.

00:24:06.580 --> 00:24:13.660
<v Danilo>We write a Rust structure that in some way embeds the C structure or embeds

00:24:13.660 --> 00:24:19.640
<v Danilo>a pointer to the C structure. It really depends on the actual case.

00:24:20.100 --> 00:24:28.980
<v Danilo>And then we write some Rust code around that API. So you can only use that API in a way that is safe.

00:24:29.880 --> 00:24:35.980
<v Danilo>So, for instance, if you obtain a device, a representation of a device in the

00:24:35.980 --> 00:24:41.600
<v Danilo>system, you would not get a pointer, but rather a reference to the device.

00:24:42.040 --> 00:24:46.200
<v Danilo>And instead of now dealing with only the reference of the device,

00:24:46.380 --> 00:24:50.740
<v Danilo>you also have certain device states. So, in Rust, that's just type states.

00:24:51.120 --> 00:24:54.360
<v Danilo>And in the kernel, a device can be in multiple states,

00:24:54.380 --> 00:24:58.300
<v Danilo>and we represent that by type states, and then only allow the functions that

00:24:58.300 --> 00:25:04.300
<v Danilo>are applicable for a certain state if the user can or if the user calls it on

00:25:04.300 --> 00:25:09.440
<v Danilo>the abstraction type with the corresponding type state.

00:25:11.260 --> 00:25:19.860
<v Matthias>Okay, that sounds super cool because type state is a very nice way to model state machines,

00:25:19.980 --> 00:25:25.540
<v Matthias>obviously, but I don't know if you had an equivalent on the C side before or

00:25:25.540 --> 00:25:32.220
<v Matthias>if that was a new integration or if that was a new abstraction that you added in that process.

00:25:33.430 --> 00:25:39.610
<v Danilo>So on the C side, if we stay at the device example, that's not existent on the C side.

00:25:39.710 --> 00:25:42.390
<v Danilo>On the C side, it's really just a raw struct device pointer,

00:25:42.790 --> 00:25:50.670
<v Danilo>and it's on the user to use it in the correct way.

00:25:51.150 --> 00:25:55.650
<v Matthias>Okay. Well, I made it sound like it was an obviously good idea,

00:25:55.690 --> 00:26:00.970
<v Matthias>but maybe we can also take a step back here and maybe describe what is the benefit

00:26:00.970 --> 00:26:05.510
<v Matthias>of the type state pattern, and maybe even what is it in the first place.

00:26:06.270 --> 00:26:15.490
<v Danilo>Yeah. So let me explain real quick how device, driver, and bus fits into the bigger picture.

00:26:15.770 --> 00:26:23.410
<v Danilo>So if you want to write a driver in the kernel, you have to implement the driver

00:26:23.410 --> 00:26:26.850
<v Danilo>structure of the particular subsystem. Let's say PCI.

00:26:27.170 --> 00:26:33.570
<v Danilo>So you implement the PCI structure, which requires you to implement a couple of callbacks.

00:26:33.770 --> 00:26:36.290
<v Danilo>Lots of them are optional. Some of them are mandatory.

00:26:37.050 --> 00:26:40.810
<v Danilo>The two most interesting callbacks are probe and remove.

00:26:41.530 --> 00:26:47.070
<v Danilo>The probe callback of the driver is called once the bus, in this case the PCI

00:26:47.070 --> 00:26:51.150
<v Danilo>bus, detects a device in the system that matches the driver.

00:26:51.350 --> 00:26:56.190
<v Danilo>So the bus basically detects there is a new device and then it checks what is

00:26:56.190 --> 00:27:00.570
<v Danilo>the vendor ID of the PCI device, What is the device ID of the PCI device?

00:27:00.850 --> 00:27:03.670
<v Danilo>It checks a couple more things, of course. This is a bit oversimplified.

00:27:04.390 --> 00:27:11.030
<v Danilo>But then it looks for a driver in the system that is registered that matches those attributes.

00:27:11.310 --> 00:27:14.790
<v Danilo>And if it finds a driver in the system that matches the attributes,

00:27:15.010 --> 00:27:22.770
<v Danilo>it calls the probe function that the driver registered and passes in the PCI

00:27:22.770 --> 00:27:25.850
<v Danilo>device structure in the probe function.

00:27:25.850 --> 00:27:29.890
<v Danilo>And then the driver can start operating the device.

00:27:30.170 --> 00:27:36.410
<v Danilo>It can obtain device resources such as I.O. memory or interrupt handlers and

00:27:36.410 --> 00:27:37.810
<v Danilo>just do its business logic.

00:27:38.860 --> 00:27:44.060
<v Matthias>It gets a mutable pointer to that device, or what would be the input?

00:27:44.260 --> 00:27:52.100
<v Danilo>So in C, it's really just a pointer. If we're in Rust, it's a reference to a

00:27:52.100 --> 00:27:56.540
<v Danilo>PCI device structure with a certain type state.

00:27:56.900 --> 00:28:01.940
<v Danilo>So for probe, so actually for all the callbacks that come from a bus, so like probe, remove.

00:28:02.140 --> 00:28:05.640
<v Danilo>So remove is obviously when the driver is unbound from the device,

00:28:05.740 --> 00:28:08.100
<v Danilo>when the device is unbound from the driver this way around.

00:28:08.860 --> 00:28:14.420
<v Danilo>Um, but in the bus callbacks, it gets the type state core.

00:28:14.600 --> 00:28:20.140
<v Danilo>So then the device has the core type state, and then you have access to certain

00:28:20.140 --> 00:28:24.480
<v Danilo>functions of the PCI device that you would otherwise not have.

00:28:24.780 --> 00:28:31.340
<v Danilo>And that's important because in the bus callbacks, a global bus lock is taken,

00:28:31.360 --> 00:28:37.540
<v Danilo>and that allows you to modify certain fields within the device structure that

00:28:37.540 --> 00:28:39.560
<v Danilo>are needed for instance to,

00:28:40.420 --> 00:28:45.520
<v Danilo>enable i o memory in the first place or bus mastering and,

00:28:46.950 --> 00:28:53.790
<v Danilo>So by having this type state, we can ensure that those functions that are only

00:28:53.790 --> 00:28:58.470
<v Danilo>allowed to be called from bus callbacks are not called from anywhere else.

00:28:58.610 --> 00:29:02.510
<v Danilo>And the way they could be called from anywhere else is because device structures

00:29:02.510 --> 00:29:04.670
<v Danilo>are fundamentally reference counted in the kernel.

00:29:04.850 --> 00:29:08.070
<v Danilo>So everyone can hold on to a reference of that thing.

00:29:08.290 --> 00:29:11.830
<v Danilo>So it is theoretically possible, but in Rust, it's not.

00:29:13.630 --> 00:29:17.130
<v Matthias>Yeah so a simplified version of that would be you

00:29:17.130 --> 00:29:20.170
<v Matthias>get a device you are allowed to call a

00:29:20.170 --> 00:29:22.930
<v Matthias>couple of methods on it which give you a

00:29:22.930 --> 00:29:26.350
<v Matthias>new state of that device a thing that you

00:29:26.350 --> 00:29:29.190
<v Matthias>can hold on to but then crucially you cannot call

00:29:29.190 --> 00:29:32.130
<v Matthias>methods that would be invalid or you try

00:29:32.130 --> 00:29:34.950
<v Matthias>to make invalid state irrepresentable this way

00:29:34.950 --> 00:29:38.370
<v Matthias>yes that's pretty cool it feels

00:29:38.370 --> 00:29:42.870
<v Matthias>like the type state pattern is a very core part of the abstractions that you

00:29:42.870 --> 00:29:48.390
<v Matthias>needed for kernel development from rust are there any other components that

00:29:48.390 --> 00:29:50.570
<v Matthias>you needed to build out which come

00:29:50.570 --> 00:29:55.470
<v Matthias>to mind anything that other systems programmers could also learn from so.

00:29:55.470 --> 00:30:02.230
<v Danilo>I think one example may be how we deal with reference counted structures on the C side.

00:30:02.850 --> 00:30:10.330
<v Danilo>So in C, reference counting works that structures embed a struct kref,

00:30:10.610 --> 00:30:17.190
<v Danilo>which is in the end an atomic counter that gives you a release callback once

00:30:17.190 --> 00:30:21.010
<v Danilo>it drops to zero, and then you have to implement a release callback in a certain

00:30:21.010 --> 00:30:22.410
<v Danilo>way to clean up that structure.

00:30:23.710 --> 00:30:28.170
<v Danilo>And this is a pattern that we have very often. Things in the kernel are very

00:30:28.170 --> 00:30:29.190
<v Danilo>often reference counted.

00:30:30.240 --> 00:30:33.700
<v Danilo>And in C abstractions, we had to deal with that.

00:30:33.920 --> 00:30:38.300
<v Danilo>So what people did were writing a trait that is called always ref counted,

00:30:38.600 --> 00:30:46.500
<v Danilo>which implemented by the corresponding Rust structure representation of the

00:30:46.500 --> 00:30:47.820
<v Danilo>reference counted C struct,

00:30:48.140 --> 00:30:53.880
<v Danilo>just provides common helpers for reference counting and a common interface for reference counting,

00:30:53.880 --> 00:30:57.760
<v Danilo>which is the a ref type with

00:30:57.760 --> 00:31:00.700
<v Danilo>with a generic so you basically

00:31:00.700 --> 00:31:04.440
<v Danilo>have your rust abstraction structure let's say device and since

00:31:04.440 --> 00:31:09.260
<v Danilo>the device is fundamentally reference counted you then end up with an a ref

00:31:09.260 --> 00:31:16.860
<v Danilo>device and then this a ref knows that there's always reference counted implemented

00:31:16.860 --> 00:31:22.020
<v Danilo>for the device because it's a trade bound and then we can we can make those parts common.

00:31:23.180 --> 00:31:26.360
<v Matthias>Well typically in a pure rust

00:31:26.360 --> 00:31:30.960
<v Matthias>world you would probably lean into ownership a little more like a lot of things

00:31:30.960 --> 00:31:36.780
<v Matthias>just move between different components in rust but i'm assuming that that will

00:31:36.780 --> 00:31:41.680
<v Matthias>be very hard to do in an inux kernel because the rest of the code expects references

00:31:41.680 --> 00:31:46.180
<v Matthias>and passes references around or ref counted structures to be more precise.

00:31:46.180 --> 00:31:51.220
<v Danilo>We try to avoid reference counting if it's not absolutely necessary.

00:31:51.740 --> 00:31:56.140
<v Danilo>But if the C structure already does it, there's usually a very good reason for it.

00:31:56.780 --> 00:32:01.460
<v Danilo>Um, so this is something we didn't just have to adapt to.

00:32:02.240 --> 00:32:06.220
<v Danilo>I may have one other good example that is worth mentioning in this context,

00:32:06.220 --> 00:32:13.560
<v Danilo>which is you mentioned in Rust, you usually use move semantics and try to not

00:32:13.560 --> 00:32:17.040
<v Danilo>reference count things or put things on the heap, um, for that.

00:32:17.540 --> 00:32:23.720
<v Danilo>And this is another implication of writing abstractions to existing C code,

00:32:23.920 --> 00:32:31.860
<v Danilo>which is a lot of the C structures and a lot of C code is actually self-referential.

00:32:32.260 --> 00:32:34.280
<v Danilo>Linked lists in the kernel are self-referential.

00:32:34.800 --> 00:32:43.000
<v Danilo>Lots of logs are subsequently self-referential. So this is why one of the Rust4Linux

00:32:43.000 --> 00:32:47.360
<v Danilo>team members came up with a solution for that, which is called pin-init.

00:32:49.080 --> 00:32:53.280
<v Danilo>And it basically does what the name implies,

00:32:53.280 --> 00:32:57.620
<v Danilo>which is in place initialization and

00:32:57.620 --> 00:33:00.440
<v Danilo>pinning so i don't

00:33:00.440 --> 00:33:05.200
<v Danilo>know if you heard about pin-init but there is also a user space crate so so

00:33:05.200 --> 00:33:10.680
<v Danilo>it's actually his name is Benno and he maintains pin in it in a user space crate

00:33:10.680 --> 00:33:14.580
<v Danilo>that can be used there but also in the kernel but i think it originated from

00:33:14.580 --> 00:33:19.180
<v Danilo>the kernel so moving things around is oftentimes not a possibility because of that,

00:33:19.780 --> 00:33:26.100
<v Danilo>So pin in it is a great example of one of those common problems that had to be solved.

00:33:26.840 --> 00:33:32.120
<v Matthias>From what we discussed so far, it feels like you built very solid abstractions,

00:33:32.280 --> 00:33:35.880
<v Matthias>but mostly just to bridge the

00:33:35.880 --> 00:33:40.520
<v Matthias>world from Rust to sea and also bridging the safe and the unsafe world.

00:33:40.660 --> 00:33:43.940
<v Matthias>But I did wonder, was it worth it?

00:33:44.120 --> 00:33:52.220
<v Matthias>Are there any improvements now in working with kernel drivers now that we have Rust support?

00:33:53.160 --> 00:33:58.400
<v Matthias>And was all of the investment into Rust worth it? Is it more than just safety?

00:33:59.480 --> 00:34:04.420
<v Danilo>Absolutely. So maybe to go one step back to the abstractions first.

00:34:05.280 --> 00:34:10.100
<v Danilo>So writing those abstractions is really the absolute crucial part.

00:34:10.100 --> 00:34:11.540
<v Danilo>And it's very, very difficult.

00:34:11.560 --> 00:34:17.200
<v Danilo>And I see people who know the kernel very well, who start getting a good idea

00:34:17.200 --> 00:34:21.520
<v Danilo>of how Rust works, really having trouble to get those abstractions right.

00:34:21.520 --> 00:34:25.140
<v Danilo>Because this translation layer is really the hard part. now

00:34:25.140 --> 00:34:28.000
<v Danilo>for drivers it's still very very

00:34:28.000 --> 00:34:30.780
<v Danilo>worth because you get from the point where your

00:34:30.780 --> 00:34:34.440
<v Danilo>driver so multiple things the first is

00:34:34.440 --> 00:34:39.060
<v Danilo>where usually your development cycle

00:34:39.060 --> 00:34:44.160
<v Danilo>would look like i write a piece of new code in my driver i compile it i deploy

00:34:44.160 --> 00:34:48.740
<v Danilo>it to some test machine i boot the machine up and i get a kernel panic with

00:34:48.740 --> 00:34:55.080
<v Danilo>a random page fault and then i have to take the stack trace and try to figure out what happened.

00:34:55.720 --> 00:35:00.680
<v Danilo>That's what usually happens. Usually you don't write Z code that just works in a new driver.

00:35:01.660 --> 00:35:05.120
<v Danilo>This now went to, once it compiles...

00:35:07.010 --> 00:35:11.890
<v Danilo>Works in 99% of the cases to a point that it at least doesn't fold.

00:35:12.110 --> 00:35:16.490
<v Danilo>Maybe it doesn't work semantically as you intended it, but it doesn't give you

00:35:16.490 --> 00:35:21.990
<v Danilo>all the hard debug problems that you have when you do it and see in the first

00:35:21.990 --> 00:35:23.890
<v Danilo>place because the compiler would complain first.

00:35:24.010 --> 00:35:29.730
<v Danilo>So this is really the goal of the abstractions to get that away and to get the

00:35:29.730 --> 00:35:32.630
<v Danilo>memory safety here, which I mean, this is kind of the memory safety part,

00:35:32.770 --> 00:35:36.330
<v Danilo>but it's an implication of the memory safety part, Another aspect,

00:35:36.870 --> 00:35:42.050
<v Danilo>which is, I think, the second one that's very important is we can use the powerful

00:35:42.050 --> 00:35:50.270
<v Danilo>Rust type system not only to ensure additional safety and correctness to a certain kind,

00:35:50.430 --> 00:35:56.150
<v Danilo>but due to the limitations of an API we can also impose on users,

00:35:56.150 --> 00:36:01.910
<v Danilo>we can guide the user into the direction of using the API in the correct way.

00:36:02.530 --> 00:36:06.290
<v Danilo>Where in C, you're basically free to do whatever you want. You allocate a structure

00:36:06.290 --> 00:36:10.290
<v Danilo>and then you call random functions on it that you just find in a header file.

00:36:10.610 --> 00:36:15.710
<v Danilo>You can design things in Rust in a way that they are used in the right way,

00:36:15.830 --> 00:36:20.070
<v Danilo>that are used in a semantic way that makes sense. So you can encourage good

00:36:20.070 --> 00:36:23.410
<v Danilo>code just by designing your abstraction in that way.

00:36:23.610 --> 00:36:28.270
<v Danilo>And this is another big advantage that I really see from Rust.

00:36:28.270 --> 00:36:33.290
<v Danilo>There are a lot of other advantages, I think, as well, which makes everyday

00:36:33.290 --> 00:36:34.610
<v Danilo>work a little bit easier.

00:36:34.930 --> 00:36:39.750
<v Danilo>We have the Rust format tool, so you don't have to think about how to format

00:36:39.750 --> 00:36:43.370
<v Danilo>code anymore or run a tool that tells you how to do it.

00:36:43.490 --> 00:36:47.690
<v Danilo>It depends on your IDE. But having Rust format is really nice,

00:36:47.830 --> 00:36:52.150
<v Danilo>since a lot of kernel developers are just using Vim and nothing else,

00:36:52.330 --> 00:36:57.110
<v Danilo>and not a fancy IDE that already formats code in a way that you want it.

00:36:57.530 --> 00:36:59.830
<v Danilo>But it's just a minor thing. Another problem.

00:37:00.270 --> 00:37:04.790
<v Danilo>Less minor thing, I would say, is the possibility of writing doc tests.

00:37:05.630 --> 00:37:11.650
<v Danilo>So we have a unit test framework in the kernel that's called kUnit, which is pretty nice.

00:37:13.030 --> 00:37:17.490
<v Danilo>Yet, a lot of code that goes into the kernel does not come with unit tests.

00:37:17.730 --> 00:37:25.350
<v Danilo>Actually, I would say it's not common to send new kernel code with unit tests already.

00:37:26.870 --> 00:37:33.630
<v Danilo>But in rust we have those doc tests and we compile those doc tests that are really just,

00:37:34.650 --> 00:37:37.390
<v Danilo>small snippets of code right we compile them into

00:37:37.390 --> 00:37:40.610
<v Danilo>k-unit tests and then you can enable them with a kernel config option

00:37:40.610 --> 00:37:44.190
<v Danilo>when you boot the kernel and then they are running on boot and you get immediate

00:37:44.190 --> 00:37:49.110
<v Danilo>feedback if something broke your api which was previously only possible if you

00:37:49.110 --> 00:37:53.530
<v Danilo>really write a real k-unit test and insert the k-unit test module and run it

00:37:53.530 --> 00:37:58.090
<v Danilo>so it it is much more overhead than running those doc tests,

00:37:58.270 --> 00:38:03.370
<v Danilo>which give you some immediate sanity check of if your API still does the right thing.

00:38:03.530 --> 00:38:06.330
<v Danilo>So that's another advantage as well.

00:38:06.570 --> 00:38:11.750
<v Matthias>Now, the Rust standard library is split up into multiple subgrades,

00:38:12.130 --> 00:38:16.430
<v Matthias>obviously, and one of them is a no-std part.

00:38:16.810 --> 00:38:21.150
<v Matthias>Can you use the no-std module?

00:38:21.390 --> 00:38:27.390
<v Matthias>Can you make use of the Rust standard library and to what extent or do you really

00:38:27.390 --> 00:38:31.570
<v Matthias>have to use all of the kernel abstractions and you have to bring everything

00:38:31.570 --> 00:38:33.770
<v Matthias>like data structures yourself.

00:38:34.850 --> 00:38:41.970
<v Danilo>So we're using what Rust exposes as the core crate.

00:38:42.950 --> 00:38:46.610
<v Danilo>This is what we use. We don't use any other crates.

00:38:47.690 --> 00:38:53.610
<v Danilo>We had for a while, we had the alloc crate as well in the kernel.

00:38:54.210 --> 00:39:02.770
<v Danilo>But we removed that because it just didn't fulfill the requirements that we

00:39:02.770 --> 00:39:04.310
<v Danilo>needed for the kernel allocators.

00:39:04.310 --> 00:39:13.130
<v Danilo>So one and a half years ago, I wrote the kernel allocator trade and the allocator abstractions,

00:39:13.290 --> 00:39:20.370
<v Danilo>including all the stuff that you need as a basic allocation primitives like

00:39:20.370 --> 00:39:23.110
<v Danilo>you have in Rust's alloc crate.

00:39:23.490 --> 00:39:27.130
<v Danilo>Which is box and vec and those kind of things.

00:39:27.130 --> 00:39:33.930
<v Danilo>So in the kernel, we have kbox and kvec, vbox, kvbox, which is basically just

00:39:33.930 --> 00:39:41.010
<v Danilo>the approbations for the corresponding kernel allocators like kmalloc, vmalloc, kvmalloc.

00:39:41.230 --> 00:39:48.690
<v Danilo>And that was necessary because kernel allocators have more arguments than the

00:39:48.690 --> 00:39:54.830
<v Danilo>allocator API of the Rust allocate crate allows us to use.

00:39:54.830 --> 00:39:58.350
<v Danilo>We have specific allocation flags we have

00:39:58.350 --> 00:40:02.330
<v Danilo>to consider numa nodes and the upstream

00:40:02.330 --> 00:40:05.130
<v Danilo>trade just didn't fit so we had to had to do our

00:40:05.130 --> 00:40:08.590
<v Danilo>own thing so back then

00:40:08.590 --> 00:40:11.610
<v Danilo>when we only or when we had the alloc

00:40:11.610 --> 00:40:14.990
<v Danilo>crate used we only supported the kmalloc allocator

00:40:14.990 --> 00:40:18.390
<v Danilo>so just a symbol so just one allocator and

00:40:18.390 --> 00:40:25.670
<v Danilo>and had a flex extension for it no numa node support but long time it that's

00:40:25.670 --> 00:40:30.790
<v Danilo>we just need to support the other ones as well so that's why i i did this work

00:40:30.790 --> 00:40:35.870
<v Danilo>also in in preparation for for drivers because drivers absolutely need that okay.

00:40:36.830 --> 00:40:40.470
<v Matthias>It's not really a question, but an observation. It feels like you learned Rust

00:40:40.470 --> 00:40:46.090
<v Matthias>in hardcore mode by implementing all of these basic data structures and the allocator.

00:40:46.450 --> 00:40:50.970
<v Danilo>Yeah, that's actually what happened. So the way I learned Rust is probably a

00:40:50.970 --> 00:40:53.390
<v Danilo>way I wouldn't recommend to other people.

00:40:54.490 --> 00:40:59.530
<v Danilo>So what I did is I knew the kernel very well because I'm a kernel engineer for

00:40:59.530 --> 00:41:01.350
<v Danilo>a long time. So I knew a lot of parts.

00:41:02.190 --> 00:41:09.250
<v Danilo>In the past, I've worked at all different kinds of subsystems in the kernel.

00:41:09.670 --> 00:41:15.190
<v Danilo>So I'm more a generalist here than I was an expert for a very specific subsystem.

00:41:15.730 --> 00:41:20.350
<v Danilo>In fact, I'm only working for about three years in DRM and on GPU drivers.

00:41:20.710 --> 00:41:25.150
<v Danilo>All the time before, I was working on various other subsystems in the kernel.

00:41:25.150 --> 00:41:27.950
<v Danilo>But that was to my advantage in this

00:41:27.950 --> 00:41:31.010
<v Danilo>case because i i knew obviously from

00:41:31.010 --> 00:41:33.950
<v Danilo>that a lot about various different areas

00:41:33.950 --> 00:41:40.710
<v Danilo>in the kernel so what i was doing is i took advantage of that knowledge looked

00:41:40.710 --> 00:41:48.950
<v Danilo>at existing rust code in the kernel and knowing what it is supposed to do semantically

00:41:48.950 --> 00:41:53.370
<v Danilo>I basically reverse engineered for myself what the Rust code must be doing here.

00:41:53.970 --> 00:41:58.990
<v Danilo>So this is how I learned Rust and how I approached it.

00:42:00.320 --> 00:42:04.940
<v Danilo>Pretty painful way but it worked out in the end well for me.

00:42:04.940 --> 00:42:09.000
<v Matthias>Yeah true now the

00:42:09.000 --> 00:42:11.700
<v Matthias>community perception of some of the

00:42:11.700 --> 00:42:16.960
<v Matthias>conflicts on the mailing lists and people maybe getting a little angry and maybe

00:42:16.960 --> 00:42:21.720
<v Matthias>some people even leaving the project at some point what's your perspective on

00:42:21.720 --> 00:42:29.060
<v Matthias>this what's your take on this what's the inside perception versus the outside perception here yeah.

00:42:29.060 --> 00:42:34.200
<v Danilo>I i think that hits a very, very good point that is also very important to me.

00:42:34.880 --> 00:42:41.420
<v Danilo>So I saw how those news about some controversies or some discussions that were

00:42:41.420 --> 00:42:46.060
<v Danilo>a little bit controversial on the mailing list went through the news and sounded

00:42:46.060 --> 00:42:48.800
<v Danilo>like if it would have been the biggest drama on earth.

00:42:49.060 --> 00:42:54.640
<v Danilo>But in the end, we have thousands of contributors in the kernel.

00:42:54.640 --> 00:43:00.300
<v Danilo>So you have thousands of different opinions, I think, for such fundamental addition

00:43:00.300 --> 00:43:02.120
<v Danilo>to the kernel, like a new language.

00:43:02.360 --> 00:43:07.520
<v Danilo>It's absolutely normal that people have different opinions and some people have

00:43:07.520 --> 00:43:09.360
<v Danilo>stronger opinions than other people.

00:43:09.560 --> 00:43:13.640
<v Danilo>Some people express their opinions stronger than other people, right?

00:43:13.860 --> 00:43:24.060
<v Danilo>So I haven't seen anything that is dramatic or is unexpected to a certain extent and I think.

00:43:25.860 --> 00:43:34.120
<v Danilo>I feel like it appears to be made a bigger deal out of it as it actually is.

00:43:34.720 --> 00:43:44.420
<v Danilo>Another aspect of this is everyone talked about it and lots of news sites picked it up.

00:43:44.660 --> 00:43:50.800
<v Danilo>But in the end, it was one interaction from thousands of other interactions

00:43:50.800 --> 00:43:54.600
<v Danilo>that went in the absolute other direction.

00:43:55.480 --> 00:44:02.680
<v Danilo>So just to name a few, and I know the terms may not make a lot of sense to a

00:44:02.680 --> 00:44:04.720
<v Danilo>lot of people who are not super familiar with the kernel,

00:44:05.000 --> 00:44:11.860
<v Danilo>but I just want to list a few of them just to give an impression of where things go very well, actually.

00:44:12.160 --> 00:44:18.560
<v Danilo>And we have new contributors that have not been contributing to the kernel ever

00:44:18.560 --> 00:44:24.260
<v Danilo>before who stepped up doing kernel work because of Rust and because they were interested in Rust.

00:44:24.600 --> 00:44:31.640
<v Danilo>We have people that were a long time around in the kernel and are now doing Rust work as well.

00:44:31.960 --> 00:44:35.680
<v Danilo>And between those people who are doing this Rust work,

00:44:35.820 --> 00:44:40.500
<v Danilo>so those Rust contributors and C-maintainers,

00:44:40.500 --> 00:44:45.240
<v Danilo>we have so many interactions where great relationships has been established

00:44:45.240 --> 00:44:54.160
<v Danilo>and where actually ideas or implementations of Rust abstractions brought back

00:44:54.160 --> 00:44:56.100
<v Danilo>improvements to the seaside as well,

00:44:56.400 --> 00:45:00.320
<v Danilo>which are not going through the news pages, right?

00:45:00.760 --> 00:45:06.060
<v Danilo>And just to name a few of them, this is DriverCore, this is Memory Management,

00:45:06.400 --> 00:45:10.660
<v Danilo>PCI, OpenFirmware, ACPI, DRM, Networking, Timekeeping.

00:45:11.740 --> 00:45:16.400
<v Danilo>MISC Device, I2C, the clock framework, PWM regulators...

00:45:18.440 --> 00:45:23.620
<v Danilo>Primitives like maple tree, xarray, work queues, firmware api and and a lot more to be

00:45:23.620 --> 00:45:28.100
<v Danilo>honest where people have established relationships with the maintainers and

00:45:28.100 --> 00:45:33.060
<v Danilo>are working together and we have great interactions get great results and i

00:45:33.060 --> 00:45:36.160
<v Danilo>i think it's it's only fair to mention those as well.

00:45:37.560 --> 00:45:41.100
<v Matthias>Wow i had no idea and you

00:45:41.100 --> 00:45:44.080
<v Matthias>know as someone who does not know anything about

00:45:44.080 --> 00:45:46.940
<v Matthias>the linux kernel but a few things about rust

00:45:46.940 --> 00:45:49.680
<v Matthias>to me it feels enabling as well

00:45:49.680 --> 00:45:52.720
<v Matthias>like as just someone who thinks i might

00:45:52.720 --> 00:45:56.280
<v Matthias>potentially at some point want to

00:45:56.280 --> 00:45:59.540
<v Matthias>dabble with this don't have any plans but it would

00:45:59.540 --> 00:46:05.580
<v Matthias>be more likely now than before because there's the Rust4Linux project you

00:46:05.580 --> 00:46:11.100
<v Matthias>have a website and i checked it out it's very approachable and i'm guessing

00:46:11.100 --> 00:46:17.860
<v Matthias>that the people behind it are so as well and so i feel more welcome than i was before,

00:46:19.060 --> 00:46:22.180
<v Matthias>That's kind of a great achievement as well, besides the code.

00:46:22.620 --> 00:46:23.520
<v Danilo>Absolutely agree.

00:46:24.260 --> 00:46:30.940
<v Matthias>Now, let's say you look forward and you say a year or two from now,

00:46:31.220 --> 00:46:36.600
<v Matthias>we have another chat and you're enthusiastic about what was achieved.

00:46:36.860 --> 00:46:38.820
<v Matthias>What would you be proud of?

00:46:39.100 --> 00:46:42.180
<v Matthias>What's next for the Nova driver and for your work?

00:46:43.520 --> 00:46:47.220
<v Danilo>So as for the nova project one thing

00:46:47.220 --> 00:46:50.700
<v Danilo>that i want to say here is my role

00:46:50.700 --> 00:46:54.040
<v Danilo>so far has been to do all the enablement

00:46:54.040 --> 00:46:57.520
<v Danilo>work i implemented the driver core infrastructure

00:46:57.520 --> 00:47:01.760
<v Danilo>in rust piece the pci bus and and

00:47:01.760 --> 00:47:04.520
<v Danilo>generic io stuff and a lot of other

00:47:04.520 --> 00:47:08.240
<v Danilo>things that i now also maintain and i

00:47:08.240 --> 00:47:11.080
<v Danilo>will keep doing this work because i think it's

00:47:11.080 --> 00:47:13.800
<v Danilo>important it's important for nova but it's

00:47:13.800 --> 00:47:17.060
<v Danilo>also important for Rust4Linux

00:47:17.060 --> 00:47:20.560
<v Danilo>and i also think it's important for the kernel overall so

00:47:20.560 --> 00:47:23.780
<v Danilo>a lot of my time goes into

00:47:23.780 --> 00:47:31.260
<v Danilo>that when it comes to nova one could ask who's doing nova now and i have a very

00:47:31.260 --> 00:47:35.920
<v Danilo>very good answer to that which i'm very happy of and it turned out that a lot

00:47:35.920 --> 00:47:40.680
<v Danilo>of nvidia folks actually stepped up writing code for Nova.

00:47:40.940 --> 00:47:48.040
<v Danilo>Actually, the majority of the code that goes into NovaCore is written by NVIDIA people.

00:47:48.380 --> 00:47:53.300
<v Danilo>And we just got a co-maintainer for NovaCore, which is Alexandre Courbot,

00:47:53.560 --> 00:47:58.400
<v Danilo>who is helping me a lot in maintaining the project and moving the project forward.

00:47:59.100 --> 00:48:03.220
<v Danilo>And so I'm very happy about the NVIDIA folks stepping up.

00:48:04.460 --> 00:48:05.980
<v Danilo>So what I'm,

00:48:06.570 --> 00:48:10.270
<v Danilo>hopefully proud of in a year from now is that

00:48:10.270 --> 00:48:18.510
<v Danilo>Nova actually developed in the direction of solving the problems that we intended

00:48:18.510 --> 00:48:26.230
<v Danilo>to solve when we decided doing a whole new driver from scratch and doing it

00:48:26.230 --> 00:48:29.830
<v Danilo>in Rust is the correct way to go,

00:48:30.130 --> 00:48:35.050
<v Danilo>which specifically means it solves the design problems in Nouveau that we had in Nouveau.

00:48:35.190 --> 00:48:38.370
<v Danilo>It solves the problem of abstracting the firmware.

00:48:38.730 --> 00:48:47.990
<v Danilo>It solves the problem of building a modular driver stack that supports virtualization

00:48:47.990 --> 00:48:55.850
<v Danilo>and a solid compute and graphics driver on the host, as well as in VMs, of course.

00:48:56.570 --> 00:49:00.450
<v Danilo>I'm i'm looking forward to people saying

00:49:00.450 --> 00:49:03.270
<v Danilo>who run an nvidia gpu hey i'm

00:49:03.270 --> 00:49:06.670
<v Danilo>running this out of the box it comes with my kernel installation

00:49:06.670 --> 00:49:09.530
<v Danilo>from my distribution and it's not something that i

00:49:09.530 --> 00:49:15.010
<v Danilo>have to install afterwards from from an out-of-tree source and i mean we have

00:49:15.010 --> 00:49:23.450
<v Danilo>that with Nouveau but but honestly oftentimes it's a bit sad because i see all

00:49:23.450 --> 00:49:27.870
<v Danilo>the effort that went into Nouveau and there were brilliant minds working on Nouveau.

00:49:27.990 --> 00:49:31.710
<v Danilo>So I really want to give my appreciation for the work here.

00:49:32.390 --> 00:49:40.510
<v Danilo>But there is also the reality that oftentimes Nouveau is used to install the proprietary driver.

00:49:40.710 --> 00:49:43.830
<v Danilo>And that's also a bit sad. So I'm looking forward to change that.

00:49:44.210 --> 00:49:47.030
<v Matthias>At least to me and potentially to a lot of listeners.

00:49:48.330 --> 00:49:55.830
<v Matthias>The day-to-day work of an actual Linux kernel developer is completely unknown,

00:49:55.830 --> 00:49:58.970
<v Matthias>and it sounds almost a bit daunting to work on that.

00:50:00.270 --> 00:50:05.210
<v Matthias>What's it really like? What's your day-to-day? How does working in the Linux

00:50:05.210 --> 00:50:06.310
<v Matthias>kernel really look like?

00:50:06.770 --> 00:50:10.750
<v Danilo>Yeah, so there are many different aspects to that.

00:50:10.950 --> 00:50:16.210
<v Danilo>One of it is obviously the maintainer work, which means that I have to review

00:50:16.210 --> 00:50:23.730
<v Danilo>a lot of patches. have to give feedback, but also guide people into the right direction,

00:50:25.010 --> 00:50:33.990
<v Danilo>design-wise for the subsystem or for the component, and ideally serve as a multiplier here.

00:50:34.430 --> 00:50:39.690
<v Danilo>Make sure to get people interested in doing that work in the first place,

00:50:39.890 --> 00:50:43.590
<v Danilo>get more contributors involved, and also scale myself,

00:50:43.850 --> 00:50:51.250
<v Danilo>which means find people to work with who may want to take responsibility themselves,

00:50:51.770 --> 00:50:58.330
<v Danilo>which is, I think, a part that oftentimes is forgotten by maintainers.

00:50:59.290 --> 00:51:04.370
<v Matthias>And how much of that time do you spend in email, in your IDE,

00:51:04.790 --> 00:51:07.530
<v Matthias>and during code reviews?

00:51:07.910 --> 00:51:11.590
<v Danilo>So writing emails and doing code reviews, kind of the same thing.

00:51:11.750 --> 00:51:15.390
<v Danilo>We're doing code review by mail. Patches are sent through email.

00:51:15.750 --> 00:51:21.730
<v Danilo>I would say so roughly about half of the time goes definitely into writing mails

00:51:21.730 --> 00:51:24.730
<v Danilo>and having discussions about code, reviewing patches.

00:51:25.190 --> 00:51:30.730
<v Danilo>A significant amount of time also goes into dealing with patches.

00:51:30.730 --> 00:51:33.930
<v Danilo>It's not only about reviewing them as a maintainer, but you also have to handle

00:51:33.930 --> 00:51:36.290
<v Danilo>them, which means you have to apply them to your tree.

00:51:36.530 --> 00:51:44.030
<v Danilo>You have to sanity check if everything about the patch is correct in terms of process and form.

00:51:45.070 --> 00:51:48.010
<v Danilo>And ideally, you also do a build check, at least.

00:51:48.730 --> 00:51:53.670
<v Danilo>And then you take it in your tree, then it goes into the next tree,

00:51:53.870 --> 00:52:00.530
<v Danilo>which is a kernel tree that is basically capturing the trees of all kernel maintainers

00:52:00.530 --> 00:52:02.410
<v Danilo>who want to be part of Linux Next.

00:52:03.010 --> 00:52:10.810
<v Danilo>And it regularly, I think even nightly, merges all the maintainer trees into

00:52:10.810 --> 00:52:15.110
<v Danilo>one single branch and reports conflicts.

00:52:15.730 --> 00:52:21.810
<v Danilo>Most of the time, the conflicts are already solved by the Linux Next maintainer himself.

00:52:22.750 --> 00:52:25.930
<v Danilo>Sometimes it's not possible that he just drops the branch for the night and

00:52:25.930 --> 00:52:28.910
<v Danilo>comes back to the maintainers asking, hey, what I should do here?

00:52:29.210 --> 00:52:30.410
<v Danilo>What's the right solution?

00:52:31.170 --> 00:52:34.470
<v Danilo>So part of the job as a maintainer is also to deal with that.

00:52:34.910 --> 00:52:39.790
<v Danilo>And of course, you have to send the pull requests either to Linux himself or

00:52:39.790 --> 00:52:44.610
<v Danilo>to the next maintainer in the hierarchy at the end of the cycle.

00:52:44.610 --> 00:52:47.090
<v Danilo>So a development cycle is roughly about three months.

00:52:47.570 --> 00:52:53.450
<v Danilo>Then you send the changes that you accumulated over the time to Linus or the

00:52:53.450 --> 00:52:54.910
<v Danilo>next maintainer in the hierarchy.

00:52:55.430 --> 00:52:59.310
<v Danilo>And then also per release cycle, which is not release cycle,

00:52:59.410 --> 00:53:00.870
<v Danilo>but release candidate cycle.

00:53:01.570 --> 00:53:09.830
<v Danilo>You send the fixes for the last release or after the last merge window for the

00:53:09.830 --> 00:53:14.910
<v Danilo>next release candidates to Linus or the maintainers. as well.

00:53:15.330 --> 00:53:19.070
<v Danilo>And this goes on for the three months and then you have the next release and

00:53:19.070 --> 00:53:22.310
<v Danilo>then this cycle starts from the beginning.

00:53:23.190 --> 00:53:27.650
<v Danilo>Otherwise, yeah, I spend a lot of time in my editor, of course, writing actual code,

00:53:28.450 --> 00:53:33.690
<v Danilo>But there's also a lot of time that just goes into coordinating,

00:53:34.210 --> 00:53:40.350
<v Danilo>coordinating with other developers, coordinating with companies we're partnered

00:53:40.350 --> 00:53:44.150
<v Danilo>with or coordinating with people from the community.

00:53:44.750 --> 00:53:49.570
<v Matthias>And who's next in line for you? Do you send a patch to Greg Kroah-Hartman

00:53:50.410 --> 00:53:52.670
<v Matthias>or someone else in the hierarchy?

00:53:53.150 --> 00:53:57.510
<v Danilo>So that depends. I'm maintaining a couple of trees and a couple of different

00:53:57.510 --> 00:53:59.730
<v Danilo>components or subsystems and drivers.

00:54:00.030 --> 00:54:05.150
<v Danilo>So I'm sending patches to Dave Airlie, who's maintainer of DRM.

00:54:05.390 --> 00:54:07.830
<v Danilo>I do that previously. I did that for the Nova tree.

00:54:08.490 --> 00:54:13.390
<v Danilo>And now I'm doing it with the DRM Rust tree. We have an own DRM tree for Rust components.

00:54:14.170 --> 00:54:17.330
<v Danilo>And what we do different than other subsystems with that.

00:54:17.610 --> 00:54:21.850
<v Danilo>Then I submit patches to, or actually submit pull requests to Miguel,

00:54:22.050 --> 00:54:23.230
<v Danilo>who's maintaining the Rust tree.

00:54:23.230 --> 00:54:28.310
<v Danilo>This is for the allocator stuff that i mentioned previously and i'm also sending

00:54:28.310 --> 00:54:33.910
<v Danilo>pull requests to linus himself for the driver core tree that i co-maintain nice.

00:54:33.910 --> 00:54:39.190
<v Matthias>And how does the tooling look like then you mentioned that yeah well you need

00:54:39.190 --> 00:54:44.250
<v Matthias>to use an email tool and you need to use at least an ide so what's the weapon of choice.

00:54:44.250 --> 00:54:47.270
<v Danilo>Right yeah so this is where really

00:54:47.270 --> 00:54:50.650
<v Danilo>my past of being a

00:54:50.650 --> 00:54:53.930
<v Danilo>C kernel engineer from the get-go kind of shines through

00:54:53.930 --> 00:54:57.790
<v Danilo>which is i'm really just using vim not

00:54:57.790 --> 00:55:05.050
<v Danilo>even new vim just vim and mutt and that's that's basically about it so i i recently

00:55:05.050 --> 00:55:09.830
<v Danilo>switched to aerc for email which is another console client but that's really

00:55:09.830 --> 00:55:15.330
<v Danilo>all i use no no fancy ide no language server nothing and.

00:55:15.330 --> 00:55:16.590
<v Matthias>What about the rust tooling,

00:55:17.970 --> 00:55:21.030
<v Matthias>Do you use any tooling other than cargo format?

00:55:21.490 --> 00:55:25.290
<v Matthias>Is there any kernel-specific tooling as well that maybe you've built or someone

00:55:25.290 --> 00:55:29.830
<v Matthias>else builds which does various random tasks, administrative tasks?

00:55:30.970 --> 00:55:36.390
<v Danilo>No, I mean, the formatting and all the Rust-specific things are kind of built

00:55:36.390 --> 00:55:41.350
<v Danilo>into the cable build system, so you're not really running cargo Rust format.

00:55:41.490 --> 00:55:46.890
<v Danilo>I don't even know if that's an actual command of cargo, but it's integrated

00:55:46.890 --> 00:55:48.610
<v Danilo>into the kernel build system.

00:55:49.650 --> 00:55:55.090
<v Danilo>We have in DRM, we have some maintainer tools which are called DIMM.

00:55:55.270 --> 00:56:01.750
<v Danilo>It's a helper to apply patches, do back merges from other trees, send pull requests.

00:56:02.030 --> 00:56:08.550
<v Danilo>So basically make a couple of maintainer and committer tasks a bit more easy. But other than that.

00:56:08.770 --> 00:56:14.350
<v Matthias>No, just... I find it fascinating how much you can get done,

00:56:15.130 --> 00:56:18.210
<v Matthias>with these tools and then just sticking to

00:56:18.210 --> 00:56:23.070
<v Matthias>them and putting in the hours and putting in the work that's fascinating right

00:56:23.070 --> 00:56:28.450
<v Matthias>danilo if someone is now interested and intrigued to learn more and perhaps

00:56:28.450 --> 00:56:33.030
<v Matthias>even wants to contribute to the linux kernel at some point especially the rust

00:56:33.030 --> 00:56:38.070
<v Matthias>part where would they learn how would they how could they learn more.

00:56:38.860 --> 00:56:45.900
<v Danilo>So I think the best entry points here are the Zulip we have,

00:56:46.060 --> 00:56:52.620
<v Danilo>where the Rust4Linux community is usually around and also the Rust for Rust4Linux

00:56:52.620 --> 00:56:59.980
<v Danilo>team is around and can also give hints on where to start if people have a specific

00:56:59.980 --> 00:57:04.720
<v Danilo>topic of interest they want to work on in the kernel or may be interested in.

00:57:05.260 --> 00:57:09.120
<v Danilo>Otherwise, if you just want to get started doing your first steps,

00:57:09.400 --> 00:57:16.000
<v Danilo>the Rust4Linux project in the GitHub repository maintains an issue list with good first issues.

00:57:16.260 --> 00:57:21.340
<v Danilo>So we try to keep the list huge enough so that everyone has something interesting

00:57:21.340 --> 00:57:25.740
<v Danilo>to find, to pick out of it, where we keep just things around where we know,

00:57:25.860 --> 00:57:27.760
<v Danilo>okay, this would be a nice rework.

00:57:27.900 --> 00:57:34.680
<v Danilo>It's not super pressuring to get it done, but it would be something we would

00:57:34.680 --> 00:57:39.400
<v Danilo>like to see happening and it's a good thing for someone new to start contributing to.

00:57:39.940 --> 00:57:44.740
<v Danilo>Those are the things we keep around there and I can really recommend to have a look at that.

00:57:45.120 --> 00:57:48.900
<v Matthias>That was amazing. Everyone who's interested, please check out these resources.

00:57:49.220 --> 00:57:50.920
<v Matthias>We will also link to them in the show notes.

00:57:52.380 --> 00:57:55.100
<v Matthias>Finally, what's your message to the Rust community?

00:57:55.620 --> 00:58:00.700
<v Danilo>Oh, I don't know if I have the message to the Rust community.

00:58:02.320 --> 00:58:05.940
<v Danilo>I probably want to say thank you because I,

00:58:06.550 --> 00:58:14.150
<v Danilo>Learning Rust and writing Rust code made me a better engineer also for the C

00:58:14.150 --> 00:58:16.430
<v Danilo>parts in the kernel that I maintain.

00:58:17.030 --> 00:58:23.210
<v Danilo>It made me think different about certain problems and just gave me a different

00:58:23.210 --> 00:58:27.770
<v Danilo>perspective of approaching problems, which is very helpful.

00:58:28.110 --> 00:58:32.030
<v Danilo>So my message is probably be keep up the great work.

00:58:32.750 --> 00:58:41.430
<v Danilo>Otherwise, when it comes to the things that the kernel needs from the Rust project,

00:58:41.730 --> 00:58:45.170
<v Danilo>and there are definitely things that are needed,

00:58:45.570 --> 00:58:50.210
<v Danilo>I also want to say thank you for the great collaboration.

00:58:50.210 --> 00:58:52.550
<v Danilo>I'm not that involved myself.

00:58:53.090 --> 00:58:58.050
<v Danilo>I definitely want to make that clear. We have other members from the Rust4Linux

00:58:58.050 --> 00:59:05.570
<v Danilo>team who are regularly talking to people from the Rust core team and from

00:59:05.570 --> 00:59:07.010
<v Danilo>the Rust project in general.

00:59:07.870 --> 00:59:11.950
<v Danilo>And there is great collaboration already ongoing.

00:59:12.470 --> 00:59:18.150
<v Danilo>So, yeah, I'm very happy to see how things go.

00:59:18.930 --> 00:59:23.430
<v Matthias>Amazing. Danilo, thanks so much for taking the time for the interview today.

00:59:23.770 --> 00:59:24.490
<v Danilo>Thanks.

00:59:25.190 --> 00:59:29.210
<v Matthias>Rust in Production is a podcast by corrode. It is hosted by me,

00:59:29.470 --> 00:59:32.270
<v Matthias>Matthias Endler, and produced by Simon Brüggen.

00:59:32.450 --> 00:59:36.730
<v Matthias>For show notes, transcripts, and to learn more about how we can help your company

00:59:36.730 --> 00:59:39.610
<v Matthias>make the most of Rust, visit corrode.dev.

00:59:39.850 --> 00:59:42.210
<v Matthias>Thanks for listening to Rust in Production.