linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Marek Behún" <kabel@kernel.org>,
	"John Ogness" <john.ogness@linutronix.de>,
	"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: Boot stall regression from "printk for 5.19" merge
Date: Mon, 20 Jun 2022 16:24:54 +0200	[thread overview]
Message-ID: <YrCDNqsPrY+Hs9ju@alley> (raw)
In-Reply-To: <CAHk-=wgdquXVVE37CZooVK4X+YdSa7XoGtjr71CEYh8UsdKUow@mail.gmail.com>

On Mon 2022-06-20 08:48:29, Linus Torvalds wrote:
> On Mon, Jun 20, 2022 at 6:44 AM Petr Mladek <pmladek@suse.com> wrote:
> >
> > Both early console and proper console driver has its own kthread.
> >
> > >    1.166486] f0512000.serial: ttyS0 at MMIO 0xf0512000 (irq = 22, base_baud = 12500000) is a 16550A
> >
> > The line is malformed. I wonder if both early console and proper
> > console used the same port in parallel.
> 
> Honestly, I get the feeling that we need to just revert the whole
> "console from thread" thing.
> 
> Because:
> 
> > So, it looks like that con->write() code is not correctly serialized
> > between the early and normal console.
> > [ ... ]
> > I am going to check the driver...
> 
> We really cannot be in the situation that some random driver that used
> to work no longer does, and causes oopses and/or memory corruption
> just because it's now entered differently from how it traditionally
> has been.
>
> The traditional console write code has always been very careful to get
> exclusive access, and it sounds like that is just plain broken now.
> 
> So I don't think this is a "driver is broken".

I see what you think. There might be so many problems with the drivers
because they were never used this way. It looks like we opened a can
of worms. It is even more problematic because it causes silent boot
crashes and it is hard to debug.

I kind of agree with this and I have started looking at some more
generic solution.

All these boot crashes were in exactly the same situation when the
proper console was initialized and registered while there was
the early console used at the same time. It is a problem because
they use the same port.

The parallel use of different consoles should be much more
safe because they are much more independent.

There are the following possibilities:

1. Enable the kthreads later after the early consoles are gone.
   This is easy and should fix all known boot problems.

2. Temporary stop the kthreads and use direct printing when
   the proper consoles are registered. Well, this might be
   more complicated because the port might be accessed
   also before register_console() is called.

3. Another solution would be to use the global conosle_lock()
   also to synchronize the kthreads against each other. But
   it would be unfortunate.

I am going to prepare 1st solution.

Best Regards,
Petr

  reply	other threads:[~2022-06-20 15:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19 18:49 Boot stall regression from "printk for 5.19" merge Marek Behún
2022-06-19 22:23 ` John Ogness
2022-06-19 22:31   ` John Ogness
2022-06-20 10:02     ` Marek Behún
2022-06-20  9:29   ` Marek Behún
2022-06-20 11:44     ` Petr Mladek
2022-06-20 11:47       ` Petr Mladek
2022-06-20 12:04         ` Ilpo Järvinen
2022-06-20 13:48       ` Linus Torvalds
2022-06-20 14:24         ` Petr Mladek [this message]
2022-06-20 15:14           ` [PATCH] printk/console: Enable console kthreads only when there is no boot console left Petr Mladek
2022-06-20 15:16             ` Petr Mladek
2022-06-20 18:38             ` Marek Behún
2022-06-20 19:10             ` Linus Torvalds
2022-06-20 22:25               ` Petr Mladek
2022-06-20 22:51             ` John Ogness
2022-06-24 22:41               ` Steven Rostedt
2022-06-29  8:29                 ` Petr Mladek
2022-06-20  5:23 ` Boot stall regression from "printk for 5.19" merge Sergey Senozhatsky
2022-06-20 10:02   ` Marek Behún
2022-06-20 10:13     ` Sergey Senozhatsky
2022-06-20 10:29       ` Marek Behún
2022-06-20 11:01         ` Andy Shevchenko
2022-06-20 10:38 ` Daniel Palmer
2022-06-21  9:39 ` Thorsten Leemhuis
2022-07-04  9:32   ` Boot stall regression from "printk for 5.19" merge #forregzbot Thorsten Leemhuis

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=YrCDNqsPrY+Hs9ju@alley \
    --to=pmladek@suse.com \
    --cc=andriy.shevchenko@linux.intel.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;
as well as URLs for NNTP newsgroup(s).