Linux 6.9 Cleans Up Printk Code While Preparing For Atomic Consoles

Written by Michael Larabel in Linux Kernel on 13 March 2024 at 08:52 AM EDT. 7 Comments
LINUX KERNEL
The Linux work around atomic consoles and threaded printing remains ongoing. This work is particularly interesting as it's the last major blocker before real-time "RT" kernel support can land. This work sadly isn't ready for the new Linux 6.9 cycle but at least some printk clean-ups are landing for issues discovered during the atomic consoles effort.

The printk code in Linux 6.9 is seeing some cleanups and better robustness thanks to the ongoing work around threaded printing and atomic consoles. SUSE's Petr Mladek explained in the pull request:
Printk changes for 6.9 improve the behavior during panic. The issues were found when testing the ongoing changes introducing atomic consoles and printk kthreads.

- pr_flush() has to wait for the last reserved record instead of the last finalized one. Note that records are finalized in random order when generated by more CPUs in parallel.

- Ignore non-finalized records during panic(). Messages printed on panic-CPU are always finalized. Messages printed by other CPUs might never be finalized when the CPUs get stopped.

- Block new printk() calls on non-panic CPUs completely. Backtraces are printed before entering the panic mode. Later messages would just mess information printed by the panic CPU.

- Do not take console_lock in console_flush_on_panic() at all.The original code did try_lock()/console_unlock(). The unlock part might cause a deadlock when panic() happened in a scheduler code.

- Fix conversion of 64-bit sequence number for 32-bit atomic operations.

That printk work has been merged for Linux 6.9. Here's to hoping the atomic/non-blocking consoles work can land this year and seeing the real-time kernel code finally reach the mainline Linux kernel in 2024...
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com 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 OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week