[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=Uzp_Pi_q5YRbRi3FgdiCy1HR3g6P72d92dbqAdLyWuRQ@mail.gmail.com>
Date: Mon, 20 Oct 2025 13:00:22 -0700
From: Doug Anderson <dianders@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Andrew Chant <achant@...gle.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Brian Gerst <brgerst@...il.com>,
Christian Brauner <brauner@...nel.org>, Francesco Valla <francesco@...la.it>,
Geert Uytterhoeven <geert+renesas@...der.be>, Guo Weikang <guoweikang.kernel@...il.com>,
Huacai Chen <chenhuacai@...nel.org>, Jan Hendrik Farr <kernel@...rr.cc>, Jeff Xu <jeffxu@...omium.org>,
Kees Cook <kees@...nel.org>, Masahiro Yamada <masahiroy@...nel.org>,
Michal Koutný <mkoutny@...e.com>,
Miguel Ojeda <ojeda@...nel.org>, "Mike Rapoport (Microsoft)" <rppt@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>, Shakeel Butt <shakeel.butt@...ux.dev>,
Tejun Heo <tj@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
"Uladzislau Rezki (Sony)" <urezki@...il.com>
Subject: Re: [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs
Hi,
On Mon, Oct 20, 2025 at 11:51 AM Andrew Morton
<akpm@...ux-foundation.org> wrote:
>
> On Sun, 19 Oct 2025 10:06:14 -0700 Douglas Anderson <dianders@...omium.org> wrote:
>
> > The kernel cmdline length is allowed to be longer than what printk can
> > handle. When this happens the cmdline that's printed to the kernel
> > ring buffer at bootup is cutoff and some kernel cmdline options are
> > "hidden" from the logs. This undercuts the usefulness of the log
> > message.
> >
> > Add wrapping to the printout.
>
> Do we really need the wrapping? That will confuse anything which
> parses the output expecting a single line.
By making the default wrapping size the same as the current truncation
size, I was hoping to avoid confusion. With the default CONFIG the
only case where a tool would be confused would be if they were dealing
with a truncated log today and so they were already in a bad shape.
The hope was also that the format was simple enough that tools could
easily parse it, since each line starts with the same prefix and the
initial lines all end with a " \".
> And the code would presumably be much simpler if we simply chunked up
> the printing and spat out one really long line.
I'm not quite sure what you're suggesting. Before my changes we _do_
try to spit out one really long line, but then printk() silently
truncates it for us at 1021 characters. Re-reading your suggestion,
I'm not sure if you're suggesting that we improve printk() to handle
lines longer than 1021 characters by chunking them up, or if you're
suggesting that this code could use "pr_cont()" to chunk things up.
...or something totally different. ;-) Can you clarify?
Thanks!
-Doug
Powered by blists - more mailing lists