[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YQwHwT2wYM1dJfVk@alley>
Date: Thu, 5 Aug 2021 17:47:22 +0200
From: Petr Mladek <pmladek@...e.com>
To: John Ogness <john.ogness@...utronix.de>
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>,
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: Re: [PATCH printk v1 00/10] printk: introduce atomic consoles and
sync mode
On Tue 2021-08-03 15:18:51, John Ogness wrote:
> 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
I am fine with the new behavior at this stage. It is a quite clear
win when (only) the atomic console is used. And it does not make any
difference when atomic consoles are disabled.
But I am not sure about the proposed terms and implementation.
I want to be sure that we are on the right way for introducing
console kthreads.
Let me try to compare the behavior:
1. before this patchset():
/* printk: store immediately; try all consoles immediately */
int printk(...)
{
vprintk_store();
if (console_try_lock()) {
/* flush pending messages to the consoles */
console_unlock();
}
}
/* panic: try hard to flush messages to the consoles and avoid deadlock */
void panic()
{
/* Ignore locks in console drivers */
bust_spinlocks(1);
printk("Kernel panic ...);
dump_stack();
smp_send_stop();
/* ignore console lock */
console_flush_on_panic();
}
2. after this patchset():
+ same as before in normal mode or when there is no atomic console
+ in panic with atomic console; it modifies the behavior:
/*
* printk: store immediately; immediately flush atomic consoles;
* unsafe consoles are not used anymore;
*/
int printk(...)
{
vprintk_store();
flush_atomic_consoles();
}
/* panic: no hacks; only atomic consoles are used */
void panic()
{
printk("Kernel panic ...);
dump_stack();
}
3. After introducing console kthread(s):
int printk(...)
{
vprintk_store();
wake_consoles_via_irqwork();
}
+ in panic:
+ with atomic console like after this patchset?
+ without atomic consoles?
+ during early boot?
I guess that we will need another sync mode for the early boot,
panic, suspend, kexec, etc.. It must be posible to debug these states
even wihtout atomic console and working kthreads.
Best Regards,
Petr
Powered by blists - more mailing lists