From: Petr Mladek <pmladek@suse.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Daniel Palmer" <daniel@0x0f.com>,
"John Ogness" <john.ogness@linutronix.de>,
"Marek Behún" <kabel@kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Jan Kara" <jack@suse.cz>,
"Peter Zijlstra" <peterz@infradead.org>
Subject: Re: [PATCH v2] printk/console: Enable console kthreads only when there is no boot console left
Date: Tue, 21 Jun 2022 15:55:33 +0200 [thread overview]
Message-ID: <20220621135533.GF7891@pathway.suse.cz> (raw)
In-Reply-To: <CAHk-=wg9dB5Fc7skWTEOHNohgf=p3oLdL4H_FW-7GyunnQ5Edg@mail.gmail.com>
On Tue 2022-06-21 07:45:09, Linus Torvalds wrote:
> On Tue, Jun 21, 2022 at 6:42 AM Daniel Palmer <daniel@0x0f.com> wrote:
> >
> > The lockups on boot seem to be gone on my boards with this patch.
>
> Good.
>
> Petr, was this all the reports sorted out? Sounds like we can keep the
> kernel thread model.
Yes, it seems that we fixed all the reports when boot failed or
the console was messed or silent.
There is one more issue, see
https://lore.kernel.org/r/YqyANveL50uxupfQ@zx2c4.com
It is about synchronization between messages printed by
userspace and kernel consoles.
The synchronization was never guaranteed. I think that it is
not an argument to remove the kthreads. They are really
needed, especially for huge systems, noisy debugging,
or RT where softlockups really hurts.
My opinion is that we might easily support 3 printk
modes, switched on the command line:
1. Use printk console kthreads when the system is normally
running. It makes printk() predictable and safe. We do
our best to switch to the direct mode when the kthreads
are not reliable, for example, panic, suspend, reboot.
IMHO, it should be default, especially for production
systems.
2. Use an atomic console in fully synchronous mode. It is
inspired by a patch from Peter Zijlstra. It calls
the (serial) console directly from printk() and
uses CPU-reentrant lock to serialize the messages
between CPUs.
AFAIK, Peter and some others use this approach to
debug some nasty bugs in the scheduler, NMI,
early boot when even the legacy code using
console_lock() is not reliable enough.
John Ogness is working on the atomic serial console.
It would allow to integrate this mode a clean
way.
It is not usable for production because printk()
might slow down the entire system.
3. Use the legacy code that tries to call consoles from
printk() via console_trylock(). We need this code
anyway for the early boot, suspend, reboot, panic.
It would be used for debugging nasty bugs like
the 2nd mode for system without serial console.
It will be pretty hard to create lockless
variant for more complicate consoles.
I am not happy that we need more modes. But I think that
they all have a good justification.
Best Regards,
Petr
next prev parent reply other threads:[~2022-06-21 13:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 9:09 [PATCH v2] printk/console: Enable console kthreads only when there is no boot console left Petr Mladek
2022-06-21 9:16 ` Sergey Senozhatsky
2022-06-21 11:19 ` Petr Mladek
2022-06-22 2:55 ` Sergey Senozhatsky
2022-06-21 11:35 ` John Ogness
2022-06-21 11:42 ` Daniel Palmer
2022-06-21 12:45 ` Linus Torvalds
2022-06-21 13:55 ` Petr Mladek [this message]
2022-06-23 10:15 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220621135533.GF7891@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=daniel@0x0f.com \
--cc=jack@suse.cz \
--cc=john.ogness@linutronix.de \
--cc=kabel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox