Technology
Emperor Penguin Linus Torvalds banishes a bug – with a bot
Key Points
Work on Linux kernel 7.3 is underway, and a bug fix just came in from an unusual source: Linus himself. Well, kind of… The new bug fix has the title of Don’t hand out the flat CCS storage as usable VRAM, and it comes from emperor penguin Linus Torvalds . Now that kernel 7.2 is out, the team is hard at work on what will be kernel 7.3, which means lots of bug-bashing.
Work on Linux kernel 7.3 is underway, and a bug fix just came in from an unusual source: Linus himself. Well, kind of… The new bug fix has the title of Don’t hand out the flat CCS storage as usable VRAM, and it comes from emperor penguin Linus Torvalds . Now that kernel 7.2 is out, the team is hard at work on what will be kernel 7.3, which means lots of bug-bashing. However, while Torvalds remains in charge of the overall kernel project, as he has said a number of times, including on stage last November, “for the last almost 20 years, I’ve not been a programmer.” This bug is an exception to that – but it’s only a partial exception. The technical issue itself was not all that interesting. Due to an oopsie in the kernel driver for Intel Xe graphics, machines would freeze during the boot process, just at the point when the OS switches into graphics mode to show the login screen. That alone makes it tricky to troubleshoot. The problem was in how the graphics driver set aside memory used by Intel’s Compute Command Streamer (or CCS for short), which the kernel Intel i915 driver documentation describes as: “An engine that has access to the media and GPGPU pipelines, but not the 3D pipeline.” The driver tries to work out where that is, takes the memory below it, and after some other steps, rounds it up to a multiple of 128 kB and sets that as video memory that’s free to use. The problem was rounding it up – because that sometimes means that it’s marking as available memory that’s already in use. It should have rounded down instead. It’s a one-line fix, but finding the error was the problem. This is where the story gets interesting, for several reasons. One of them is that it has a remarkably large comment inserted in covering email, which reads as follows: There are several points of interest here. One is that the fix is from Linus himself. Another is the unusually discursive comment. The third and perhaps the most important is that he used a bot to find the bug. He also used it to write the bug report, which explains why that part is so dull and lifeless. (The patch description does note, however, that if you just restart the program that shows the login screen – in this case, GDM, the GNOME Display Manager – it works, because the second time around it gets a different block of memory.) It’s a good example of how coding bots are a legitimately useful tool for developers. It looks like he didn’t use the bot to write the fix – that wasn’t needed, it’s a one-line fix – but the bot wrote 42 chunks of test code that enabled Linus to find the bug. It sounds like that was a tough job. (Forty-two, eh? That must have needed some Deep Thought.) As a side note, it’s also interesting to note the continuing issues caused by most modern PC graphics controllers having their own separate chunk of RAM, which isn’t shared by the CPU. This is something some Arm64 machines – notably, Apple Silicon ones – avoid by having a single pool of RAM shared by both. As memory gets more expensive due to the AI-hyperscaler-induced RAM drought, we’re seeing other patches in this area. If you’re short of main system memory but have well-equipped GPUs, then Sean Lobjoit’s NBD-VRAM patch lets a Linux box use any leftover VRAM as very fast swap space. Conversely, Valve’s Natalie Vock wrote a patch that makes low-end AMD GPUs faster when trying to allocate more VRAM than they have, which she explained in much more depth last week. As we speculated earlier this year, we suspect that Apple’s closer silicon integration, and a single shared pool of memory, is the way that the industry will eventually go. Bootnote We thank our esteemed colleague Simon Sharwood for the “Emperor Penguin” sobriquet – we believe that on The Reg, he first used that a decade ago. We also thank him for pointing this fix out to us. ®