[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210803131301.5588-1-john.ogness@linutronix.de>
Date: Tue, 3 Aug 2021 15:18:51 +0206
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>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
Douglas Anderson <dianders@...omium.org>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
"Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>,
Chengyang Fan <cy.fan@...wei.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Bhaskar Chowdhury <unixbhaskar@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
Cédric Le Goater <clg@...d.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linuxppc-dev@...ts.ozlabs.org,
kgdb-bugreport@...ts.sourceforge.net,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Vitor Massaru Iha <vitor@...saru.org>,
Sedat Dilek <sedat.dilek@...il.com>,
Changbin Du <changbin.du@...el.com>,
Sumit Garg <sumit.garg@...aro.org>,
Cengiz Can <cengiz@...nel.wtf>,
Jiri Slaby <jirislaby@...nel.org>,
Paul Cercueil <paul@...pouillou.net>,
Matthias Brugger <matthias.bgg@...il.com>,
Andrew Jeffery <andrew@...id.au>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
kuldip dwivedi <kuldip.dwivedi@...esoftware.com>,
Wang Qing <wangqing@...o.com>, Andrij Abyzov <aabyzov@....com>,
Johan Hovold <johan@...nel.org>,
Eddie Huang <eddie.huang@...iatek.com>,
Claire Chang <tientzu@...omium.org>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Zhang Qilong <zhangqilong3@...wei.com>,
"Maciej W. Rozycki" <macro@...am.me.uk>,
Guenter Roeck <linux@...ck-us.net>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Serge Semin <Sergey.Semin@...kalelectronics.ru>,
Al Cooper <alcooperx@...il.com>, linux-serial@...r.kernel.org,
linux-mips@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: [PATCH printk v1 00/10] printk: introduce atomic consoles and sync mode
Hi,
This is the next part of our printk-rework effort (points 3 and
4 of the LPC 2019 summary [0]).
Here the concept of "atomic consoles" is introduced through a
new (optional) write_atomic() callback for console drivers. This
callback must be implemented as an NMI-safe variant of the
write() callback, meaning that it can function from any context
without relying on questionable tactics such as ignoring locking
and also without relying on the synchronization of console
semaphore.
As an example of how such an atomic console can look like, this
series implements write_atomic() for the 8250 UART driver.
This series also introduces a new console printing mode called
"sync mode" that is only activated when the kernel is about to
end (such as panic, oops, shutdown, reboot). Sync mode can only
be activated if atomic consoles are available. A system without
registered atomic consoles will be unaffected by this series.
When in sync mode, the console printing behavior becomes:
- only consoles implementing write_atomic() will be called
- printing occurs within vprintk_store() instead of
console_unlock(), since the console semaphore is irrelevant
for atomic consoles
For systems that have registered atomic consoles, this series
improves the reliability of seeing crash messages by using new
locking techniques rather than "ignoring locks and hoping for
the best". In particular, atomic consoles rely on the
CPU-reentrant spinlock (i.e. the printk cpulock) for
synchronizing console output.
John Ogness
[0] https://lore.kernel.org/lkml/87k1acz5rx.fsf@linutronix.de/
John Ogness (10):
printk: relocate printk cpulock functions
printk: rename printk cpulock API and always disable interrupts
kgdb: delay roundup if holding printk cpulock
printk: relocate printk_delay()
printk: call boot_delay_msec() in printk_delay()
printk: use seqcount_latch for console_seq
console: add write_atomic interface
printk: introduce kernel sync mode
kdb: if available, only use atomic consoles for output mirroring
serial: 8250: implement write_atomic
arch/powerpc/include/asm/smp.h | 1 +
arch/powerpc/kernel/kgdb.c | 10 +-
arch/powerpc/kernel/smp.c | 5 +
arch/x86/kernel/kgdb.c | 9 +-
drivers/tty/serial/8250/8250.h | 47 ++-
drivers/tty/serial/8250/8250_core.c | 17 +-
drivers/tty/serial/8250/8250_fsl.c | 9 +
drivers/tty/serial/8250/8250_ingenic.c | 7 +
drivers/tty/serial/8250/8250_mtk.c | 29 +-
drivers/tty/serial/8250/8250_port.c | 92 ++--
drivers/tty/serial/8250/Kconfig | 1 +
include/linux/console.h | 32 ++
include/linux/kgdb.h | 3 +
include/linux/printk.h | 57 +--
include/linux/serial_8250.h | 5 +
kernel/debug/debug_core.c | 45 +-
kernel/debug/kdb/kdb_io.c | 16 +
kernel/printk/printk.c | 554 +++++++++++++++++--------
lib/Kconfig.debug | 3 +
lib/dump_stack.c | 4 +-
lib/nmi_backtrace.c | 4 +-
21 files changed, 684 insertions(+), 266 deletions(-)
base-commit: 23d8adcf8022b9483605531d8985f5b77533cb3a
--
2.20.1
Powered by blists - more mailing lists