[RFC][PATCHv6 00/12] printk: introduce printing kernel thread

From: Sergey Senozhatsky
Date: Mon Dec 04 2017 - 08:48:46 EST


Hello,

RFC

A new version, yet another rework. Lots of changes, e.g. hand off
control based on Steven's patch. Another change is that this time around
we finally have a kernel module to test printk offloading (YAYY!). The
module tests a bunch use cases; we also have trace printk events to...
trace offloading. I'll post the testing script and test module in reply
to this mail. So... let's have some progress ;) The code is not completely
awesome, but not tremendously difficult at the same time. We can verify
the approach/design (we have tests and traces now) first and then start
improving the code.

8<---- ---- ----

This patch set adds a printk() kernel thread which let us
to print kernel messages to the console from a non-atomic/schedule-able
context, avoiding different sort of lockups, stalls, etc.

v5->v6:
-- add hand off control (Steven)
-- dropped some of the previous patches (auto emergency mode, etc.)
-- remove `atomic_print_limit' knob
-- tons of other changes.

v4->v5
-- split some of the patches
-- make offloading time-based (not number of lines printed)
-- move offloading control to per-CPU
-- remove a pessimistic offloading spin from console_unlock()
-- adjust printk_kthread CPU affinity mask
-- disable preemption in console_unlock()
-- always offload printing from user space processes
-- add sync version of emergency_begin API
-- offload from printk_kthread as well, to periodically up() console_sem
-- limit `atomic_print_limit' to `watchdog_thresh'
-- and some other changes...

v3->v4 (Petr, Jan)
-- add syscore notifiers
-- fix 0001 compilation warnings
-- use proper CPU notifiers return values

v2->v3 (Petr, Pavel, Andreas):
-- rework offloading
-- use PM notifiers
-- dropped some patches, etc. etc.

v1->v2:
-- introduce printk_emergency mode and API to switch it on/off
-- move printk_pending out of per-CPU memory
-- add printk emergency_mode sysfs node
-- switch sysrq handlers (some of them) to printk_emergency
-- cleanus/etc.

Sergey Senozhatsky (12):
printk: move printk_pending out of per-cpu
printk: introduce printing kernel thread
printk: consider watchdogs thresholds for offloading
printk: add sync printk_emergency API
printk: enable printk offloading
PM: switch between printk emergency modes
printk: register syscore notifier
printk: force printk_kthread to offload printing
printk: do not cond_resched() when we can offload
printk: move offloading logic to per-cpu
printk: add offloading watchdog API
printk: improve printk offloading mechanism

Documentation/admin-guide/kernel-parameters.txt | 7 +
drivers/base/power/main.c | 5 +
include/linux/console.h | 7 +
kernel/printk/printk.c | 552 ++++++++++++++++++++++--
kernel/watchdog.c | 6 +-
5 files changed, 551 insertions(+), 26 deletions(-)

--
2.15.1