Linux x86 Boot Process Trying To Cleanup "Hay-Wire Circuits, Duct Tape & Super Glue"

Written by Michael Larabel in Linux Kernel on 14 June 2023 at 06:40 AM EDT. 20 Comments
Thomas Gleixner of Linutronix, which was acquired by Intel last year, and his team are working on cleaning up the Linux x86/x86_64 boot process. A set of 17 patches that touch the early Linux kernel initialization code and other tree-wide changes have now been posted for discussion.

Linux kernel developers are working on sanitizing the x86 boot process and cleaning up the code. Thomas Gleixner explained of the current Linux x86 boot code and the focus of this newest patch series:
"My team and myself are working on sanitizing the x86 boot process, especially the complete horror show of CPUID evaluation, which is constructed with hay-wire circuits, duct tape and superglue.

A related goal is to move the initialization of infrastructure which is not required during early boot out into a later phase of the boot process. Early boot is fragile and convoluted enough already, so anything which can move into a later phase is a win.

X86 FPU initialization is one of the obvious parts which has zero justification to be done early. The only requirement is that it happens before alternative patching. Doing it early also requires custom command line parsing which can be obviously avoided when the initialization happens later.

Alternative patching happens from check_bugs() which is invoked late in start_kernel(). Moving FPU initialization into that is too late because check_bugs() is invoked after fork_init(), but fork_init() requires that the FPU is initialized on X86 as on X86 the size of task_struct depends on the FPU register buffer size.

In order to avoid another magic function we set out to move check_bugs() earlier and inspected all incarnations whether there is any reason to do that so late. It turned out there is none (famous last words), but it also revealed that check_bugs() is a gross misnomer.

check_bugs() has become a dump ground for finalizing the CPU initialization before running the rest of the init code."

This patch series initially at 17 patches is aiming to clean up that Linux x86 boot code. It's a nice effort and follows Gleixner's recent work on parallel CPU bring-up support slated for Linux 6.5 as another boot improvement.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week