public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: John Ogness <john.ogness@linutronix.de>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Petr Mladek <pmladek@suse.com>, Marco Elver <elver@google.com>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v2] printk: allow direct console printing to be enabled always
Date: Mon, 20 Jun 2022 14:17:36 +0900	[thread overview]
Message-ID: <YrAC8F8lDc1JNkoq@google.com> (raw)
In-Reply-To: <87letsw8en.fsf@jogness.linutronix.de>

On (22/06/20 01:23), John Ogness wrote:
> I'm wondering if we should output a message here. My suggestion is:
> 
> pr_info("printing threads disabled, using direct printing\n");
> 
> > +		return 0;
> > +
> >  	console_lock();
> >  	printk_kthreads_available = true;
> >  	for_each_console(con)
> 
> Otherwise it looks OK to me. But you may want to wait on a response from
> Petr, Sergey, or Steven before sending a v3. You are adding a kernel
> config and a boot argument. Both of these are sensitive topics that
> require more feedback from others.

A tricky situation. I think John already mentioned in another thread
that any such config/boot param potentially can become a default value
for some setups; at the same time, well, yeah, I see what commit message
talks about.

May I just dump some thoughts?

I guess user-space "[+] some userspace command" are write()-s to /dev/ttyX
which end up in uart circular buffer and which are printed from console
IRQ handler (where it handles both TX and RX)

	console_irq()
	{
		int count = XXX;

		spin lock irqsafe port->lock

		RX

		do {
			TX char from xmit->buf
		} while (--count);

		spin unlock irqrestore port->lock
	}

The "[    1.2345 ] some kernel log output" (which I assume are printed
by user-space from some syscall?) now take a much more lengthy path to
console and are always async/deferred.

I know that John and Petr (rightfully so) will hate what I'm about to
say, but would it make sense/be possible/etc. to look into possibility
to address that "deferred kthread vs IRQ" race by moving prb entries
emit to the same IRQ handler that emits chars from uart xmit buffer?
In other words:

	console_irq()
	{
		int count = XXX;

		spin lock irqsafe port->lock

		RX

		do {
			TX char from xmit->buf
		} while (--count);

+		count = XXX;
+		do {
+			console_emit_next_record();
+		} while (--count);

		spin unlock irqrestore port->lock
	}

  parent reply	other threads:[~2022-06-20  5:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 13:23 5.19 printk breaks message ordering Jason A. Donenfeld
2022-06-17 13:37 ` Jason A. Donenfeld
2022-06-17 13:38   ` [PATCH] printk: allow direct console printing to be enabled always Jason A. Donenfeld
2022-06-19  0:30     ` Randy Dunlap
2022-06-19  8:37       ` Jason A. Donenfeld
2022-06-19 11:05     ` John Ogness
2022-06-19 20:39       ` Jason A. Donenfeld
2022-06-19 20:43         ` [PATCH v2] " Jason A. Donenfeld
2022-06-19 23:17           ` John Ogness
2022-06-19 23:28             ` Jason A. Donenfeld
2022-06-19 23:33               ` [PATCH v3] " Jason A. Donenfeld
2022-06-20 16:58                 ` Petr Mladek
2022-06-20 17:03                   ` Jason A. Donenfeld
2022-06-21  9:43                   ` David Laight
2022-06-21  9:59                 ` Jason A. Donenfeld
2022-06-22 12:55                   ` Jason A. Donenfeld
2022-06-20  4:04             ` [PATCH v2] " David Laight
2022-06-20  5:17             ` Sergey Senozhatsky [this message]
2022-06-20  7:56               ` Jason A. Donenfeld
2022-06-21  1:34                 ` Sergey Senozhatsky
2022-06-21 21:47               ` John Ogness
2022-06-17 14:21 ` 5.19 printk breaks message ordering Petr Mladek
2022-06-17 14:41   ` Jason A. Donenfeld
2022-06-17 15:01   ` David Laight
2022-06-19  8:15     ` John Ogness
2022-06-19 14:24       ` David Laight

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=YrAC8F8lDc1JNkoq@google.com \
    --to=senozhatsky@chromium.org \
    --cc=Jason@zx2c4.com \
    --cc=elver@google.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.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