[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YfAIbRqfFMwqsrKV@alley>
Date: Tue, 25 Jan 2022 15:25:49 +0100
From: Petr Mladek <pmladek@...e.com>
To: Stephen Brennan <stephen.s.brennan@...cle.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] printk: Avoid livelock with heavy printk during panic
On Fri 2022-01-21 11:02:21, Stephen Brennan wrote:
> During a panic(), if another CPU is writing heavily the kernel log (e.g.
> via /dev/kmsg), then the panic CPU may livelock writing out its messages
> to the console. Note when too many messages are dropped during panic and
> suppress further printk, except from the panic CPU.
I would add something like:
"It might cause that some useful messages are lost. But messages are
being lost anyway and this at least avoids the possible livelock."
> ---
> kernel/printk/printk.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 20b4b71a1a07..ca253ac07615 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2667,6 +2678,8 @@ void console_unlock(void)
> if (console_seq != r.info->seq) {
> console_dropped += r.info->seq - console_seq;
> console_seq = r.info->seq;
> + if (panic_in_progress() && panic_console_dropped++ > 10)
> + suppress_panic_printk = 1;
It would be great to let the user know, something like:
pr_warn("Too many dropped messages. Supress messages on non-panic CPUs to prevent livelock.\n");
> }
>
> if (suppress_message_printing(r.info->level)) {
Otherwise, it looks good to me.
Best Regards,
Petr
Powered by blists - more mailing lists