🛒 Arduino, ESP32 & modules
Linus Torvalds Linux nüvəsindəki qrafik bug‑u AI köməyi ilə tapdı
3 HR AGOProgramming

Linus Torvalds Fixes Linux Kernel Graphics Bug with AI Help

A nasty Intel Xe VRAM bug in the Linux kernel was fixed by a one-line change after 24 diagnostic patches and 18 reboots, with AI doing most of the grunt work.

September 6, 20263 min read35 tags

After a full power-off and power-on, some Linux systems were booting into a black screen: the desktop environment kept restarting in a loop, while the OS itself remained alive. Restarting the DE manually temporarily fixed the issue.

Linus Torvalds decided to chase this bug himself — and he used an AI assistant to handle much of the routine work.

Root cause: wrong VRAM boundary rounding in Intel Xe driver

The problem was in the Intel Xe graphics driver and how it calculated the VRAM boundary. The GPU reserves part of VRAM for hardware compression metadata. The driver receives the start address of this reserved region and exposes everything below it as normal video memory for applications.

However, that address didn’t always align with a memory page boundary.

Legacy code used round_up() — it rounded the address up. This shifted the “free” VRAM boundary into the reserved region.

On Linus’s machine, the boundary landed in the middle of a 4 KB page: the last 2 KB already belonged to the compression engine, but the driver could hand out the entire page to user space. The GPU then wrote its internal data over the page tables stored there, and the desktop environment lost access to critical memory and crashed.

The fix was deceptively simple: replace round_up() with round_down(). Now the address is rounded down to the start of the page. If even a small part of a page is used by the GPU’s internal mechanisms, the driver excludes the whole page from usable VRAM. You lose a few kilobytes of VRAM, but applications no longer get memory that hardware might overwrite.

What did the AI actually do?

Although the fix is just one line, finding it required 24 diagnostic patches and 18 kernel reboots. The AI assistant handled most of the grunt work:

  • inserting various diagnostic snippets;
  • analyzing logs and results;
  • occasionally declaring the problem “unsolvable” and suggesting to stop with a report.

Torvalds kept pushing it to continue. In the end, he acknowledged that AI was a huge help and even let it write the final commit message. He did not disclose which model he used.

The key takeaway: AI didn’t magically find the bug with a single command and didn’t replace the engineer. It automated mechanical steps, while a human formed hypotheses, interpreted results, and refused to accept “this is impossible” as an answer.


Source: Habr Xəbərlər