From: Petr Mladek <pmladek@suse.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: John Ogness <john.ogness@linutronix.de>,
Marco Elver <elver@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: 5.19 printk breaks message ordering
Date: Fri, 17 Jun 2022 16:21:15 +0200 [thread overview]
Message-ID: <YqyN20jpRw1SaaTw@alley> (raw)
In-Reply-To: <YqyANveL50uxupfQ@zx2c4.com>
On Fri 2022-06-17 15:23:02, Jason A. Donenfeld wrote:
> Hi John & folks,
>
> In 5.19, I'm seeing some changes in message ordering / interleaving
> which lead to confusion. The most obvious (and benign) example appears
> on system boot, in which the "Run /init as init process" message gets
> intermixed with the messages that init actually writes() to stdout. For
> example, here's a snippet from build.wireguard.com:
>
> [ 0.469732] Freeing unused kernel image (initmem) memory: 4576K
> [ 0.469738] Write protecting the kernel read-only data: 10240k
> [ 0.473823] Freeing unused kernel image (text/rodata gap) memory: 2044K
> [ 0.475228] Freeing unused kernel image (rodata/data gap) memory: 1136K
> [ 0.475236] Run /init as init process
>
>
> WireGuard Test Suite on Linux 5.19.0-rc2+ x86_64
>
>
> [+] Mounting filesystems...
> [+] Module self-tests:
> * allowedips self-tests: pass
> * nonce counter self-tests: pass
> * ratelimiter self-tests: pass
> [+] Enabling logging...
> [+] Launching tests...
> [ 0.475237] with arguments:
> [ 0.475238] /init
> [ 0.475238] with environment:
> [ 0.475239] HOME=/
> [ 0.475240] TERM=linux
> [+] ip netns add wg-test-46-0
> [+] ip netns add wg-test-46-1
I see.
> But the bigger issue for me is that it makes it very confusing to
> interpret CI results later on. Prior, I would nice a nice correlation
> of:
>
> [+] some userspace command
> [ 1.2345 ] some kernel log output
> [+] some userspace command
> [ 1.2346 ] some kernel log output
> [+] some userspace command
> [ 1.2347 ] some kernel log output
>
> I assume this is mostly caused by your threaded printk patchset
Console has never been fully synchronous. printk() did console_trylock()
and flushed the message to the console only the lock was available.
The console kthreads made it asynchronous always when the kthreads
are available and system is in normal state.
> This probably has important benefits. But it certainly makes CI
> and related debugging a bit trickier as a result.
I could imagine.
> So I was wondering if there was some way to boot the kernel with a
> command line option or compile-time flag that always flushes printk
> messages when they're made, or does something to make the ordering a bit
> more faithful.
I am pretty sure that we will have to add such an option sooner or
later. We did not want to do it from the beginning because otherwise
people would use it and would not tell use about their problematic
use-cases ;-)
In fact, in your case you might get even better synchronization
if you do it the other way and write userspace messages into
the kernel log via /dev/kmsg:
echo "Hello world" > /dev/kmsg
That said. I am going to look at your patch the following week.
I also want to wait for an opinion from John.
Best Regards,
Petr
next prev parent reply other threads:[~2022-06-17 14:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 13:23 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
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 ` Petr Mladek [this message]
2022-06-17 14:41 ` 5.19 printk breaks message ordering 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=YqyN20jpRw1SaaTw@alley \
--to=pmladek@suse.com \
--cc=Jason@zx2c4.com \
--cc=elver@google.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®