public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: "John Ogness" <john.ogness@linutronix.de>,
	"Marek Behún" <kabel@kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.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 13:19:19 +0200	[thread overview]
Message-ID: <20220621111919.GD7891@pathway.suse.cz> (raw)
In-Reply-To: <YrGMYk0LsbKewzPU@google.com>

On Tue 2022-06-21 18:16:18, Sergey Senozhatsky wrote:
> On (22/06/21 11:09), Petr Mladek wrote:
> > Threaded console printing does not take into consideration that boot
> > consoles may be accessing the same hardware as normal consoles and thus
> > must not be called in parallel.
> > 
> > Since it is currently not possible to identify which consoles are
> > accessing the same hardware, delay threaded console printing activation
> > until it is known that there are no boot consoles registered.
> > 
> > Link: https://lore.kernel.org/r/20220619204949.50d9154d@thinkpad
> > Link: https://lore.kernel.org/r/2a82eae7-a256-f70c-fd82-4e510750906e@samsung.com
> > Link: https://lore.kernel.org/r/20220619204949.50d9154d@thinkpad
> > Reported-by: Marek Behún <kabel@kernel.org>
> > [john.ogness@linutronix.de: Better description of the problem.]
> > Signed-off-by: Petr Mladek <pmladek@suse.com>
> > Tested-by: Marek Behún <kabel@kernel.org>
> 
> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>

Thanks.

> > -static int __init printk_activate_kthreads(void)
> > -{
> > -	struct console *con;
> >  
> > -	console_lock();
> > -	printk_kthreads_available = true;
> > -	for_each_console(con)
> > -		printk_start_kthread(con);
> > -	console_unlock();
> > +	/*
> > +	 * Boot consoles may be accessing the same hardware as normal
> > +	 * consoles and thus must not be called in parallel. Therefore
> > +	 * only activate threaded console printing if it is known that
> > +	 * there are no boot consoles registered.
> > +	 */
> > +	if (no_bootcon)
> > +		printk_activate_kthreads();
> 
> A quick question. Here we still can have bootcon which can unregistered
> later, right? Do you think it'll make sense to check if printing kthreads
> can be safely started and start them if so (if no CON_BOOT found and kthreads
> are not already created) at the end of unregister_console()?

Yeah, that's my plan how to optimize it in the future. I just
wanted to do something simple and be on the safe side for 5.19.

Best Regards,
Petr

  reply	other threads:[~2022-06-21 11:19 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 [this message]
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
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=20220621111919.GD7891@pathway.suse.cz \
    --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