[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220207194323.273637-1-john.ogness@linutronix.de>
Date: Mon, 7 Feb 2022 20:49:10 +0106
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Marco Elver <elver@...gle.com>,
Stephen Boyd <swboyd@...omium.org>,
Alexander Potapenko <glider@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>,
Nicholas Piggin <npiggin@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>,
Corey Minyard <cminyard@...sta.com>,
Kees Cook <keescook@...omium.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Mark Brown <broonie@...nel.org>,
Josef Bacik <josef@...icpanda.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Shawn Guo <shawn.guo@...aro.org>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Wang Qing <wangqing@...o.com>, Tejun Heo <tj@...nel.org>,
Stephen Boyd <sboyd@...nel.org>, rcu@...r.kernel.org,
Max Filippov <jcmvbkbc@...il.com>,
David Sterba <dsterba@...e.com>,
Samuel Iglesias Gonsálvez
<siglesias@...lia.com>, Bhaskar Chowdhury <unixbhaskar@...il.com>,
Igor Matheus Andrade Torrente <igormtorrente@...il.com>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
nick black <dankamongmen@...il.com>
Subject: [PATCH printk v1 00/13] implement threaded console printing
This is the next part of our printk-rework effort (points 2 and 6 of
the LPC 2019 summary [0]).
This series implements a kthread for each registered console. The
kthreads locklessly retrieve the records from the printk ringbuffer
and also do not cause any lock contention between one another. This
allows consoles to run at full speed. For example, a netconsole is
able to dump records much faster than a serial or vt console.
There are situations where kthread printing is not sufficient. For
example, during early boot before kthreads exist or during panic
situations, where the kthreads may not get a chance to schedule. In
these cases, the current method of printing directly within the
printk() caller context is used. New functions printk_direct_enter()
and printk_direct_exit() are made available to mark areas of the
kernel where direct printing should be used.
This series also introduces pr_flush(): a might_sleep() function
that will block until all active printing threads have caught up
to the latest record at the time of the pr_flush() call. This
function is useful, for example, to wait until pending records
are flushed to consoles before suspending.
And finally, this series introduces a new console flag
CON_MIGHT_SLEEP that can be set by consoles that only want their
write() callback called in sleepable contexts. This was requested
by Daniel Vetter [1] due to the many and growing number of deadlock
situations in the fbcon code.
Note that this series does *not* increase the reliability of console
printing. Rather it focuses on the non-interference aspect of
printk() by decoupling printk() callers from printing (during normal
operation). Nonetheless, the reliability aspect should not worsen
due to this series (with perhaps the exception of the fbcon, which
will only print from sleepable contexts).
[0] https://lore.kernel.org/lkml/87k1acz5rx.fsf@linutronix.de
[1] https://lore.kernel.org/all/YYuS1uNhxWOEX1Ci@phenom.ffwll.local
John Ogness (13):
printk: rename cpulock functions
printk: cpu sync always disable interrupts
printk: use percpu flag instead of cpu_online()
printk: get caller_id/timestamp after migration disable
printk: call boot_delay_msec() in printk_delay()
printk: refactor and rework printing logic
printk: move buffer definitions into console_emit_next_record() caller
printk: add pr_flush()
printk: add functions to allow direct printing
printk: add kthread console printers
printk: reimplement console_lock for proper kthread support
printk: remove @console_locked
console: introduce CON_MIGHT_SLEEP for vt
drivers/tty/sysrq.c | 2 +
drivers/tty/vt/vt.c | 2 +-
include/linux/console.h | 22 +-
include/linux/printk.h | 70 ++--
kernel/hung_task.c | 11 +-
kernel/printk/printk.c | 903 +++++++++++++++++++++++++++++-----------
kernel/rcu/tree_stall.h | 2 +
kernel/reboot.c | 14 +-
kernel/watchdog.c | 4 +
kernel/watchdog_hld.c | 4 +
lib/dump_stack.c | 6 +-
lib/nmi_backtrace.c | 6 +-
12 files changed, 765 insertions(+), 281 deletions(-)
base-commit: a229327733b86aa585effdb0d27a87b12aa51597
--
2.30.2
Powered by blists - more mailing lists