Linux 6.9 Cleans Up Printk Code While Preparing For Atomic Consoles
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:
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...
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...
7 Comments