printk: Yield console_sem to blocking waiters
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | printk: Yield console_sem to blocking waiterskernel/ | +32 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/1] printk: Yield console_sem to blocking waiters
Problem context:
After a reboot, NetworkManager failed to bring up interfaces because systemd was stalled, due to a flood of printk warnings. Systemd was blocked waiting on the console lock for over 122 seconds:
__schedule+0x224/0x65b schedule+0x5f/0xdf schedule_timeout+0x110/0x145 __down_common+0x14d/0x18c ? srso_alias_return_thunk+0x5/0x7 down+0x43/0x54 console_lock+0x16/0x3d show_cons_active+0x3d/0x1b6 dev_attr_show+0x16/0x50 sysfs_kf_seq_show+0x9c/0x124 seq_read_iter+0x12b/0x4e3 new_sync_read+0x140/0x1db vfs_read+0x106/0x199 ksys_read+0x67/0xe8 do_syscall_64+0x35/0x87 entry_SYSCALL_64_after_hwframe+0x6e/0x0
The loglevel was set to 7, due to which there were a flood of messages to the console, which in turn starved systemd due to the chain of direct printk handoffs. Direct printk handoffs transfer printing ownership between printk callers without releasing console_sem. A continuous chain of these handoffs can therefore leave blocking console_lock() callers waiting on the semaphore.
Proposed solution:
If there is a blocked console_sem waiter, then:
1. Prevent new printk-to-printk handoffs.
2. Stop the current owner from indefinitely flushing all records until its done.
This unblocks console_sem waiters who are not doing printk.
Aruna Ramakrishna (1):
printk: Yield console_sem to blocking waiters
kernel/printk/printk.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-)
Signature · 1 line
2.43.7