Re: [RFC PATCH 2/2] init: Allow multi-line output of kernel command line
From: Joe Perches
Date: Wed May 20 2020 - 22:09:33 EST
On Wed, 2020-05-20 at 18:00 -0700, Andrew Morton wrote:
> On Wed, 20 May 2020 13:36:45 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> > On Wed, 2020-05-20 at 21:10 +0900, Sergey Senozhatsky wrote:
> > > On (20/05/19 21:58), Joe Perches wrote:
> > > [..]
> > > > > Maybe we can
> > > > > use here something rather random and much shorter instead. E.g.
> > > > > 256 chars. Hmm. How
> > > >
> > > > min(some_max like 132/256, PRINTK_LOG_LINE_MAX)
> > > >
> > > > would work.
> > >
> > > An alternative approach would be to do what we do in the
> > > print_modules() (the list of modules which can definitely
> > > be longer than 1K chars).
> > >
> > > We can split command line in a loop - memchr(pos, ' ') - and
> > > pr_cont() parts of the command line. pr_cont() has overflow
> > > control and it flushes cont buffer before it overflows, so
> > > we should not lose anything.
> >
> > It doesn't matter much here, but I believe
> > there's an 8k max buffer for pr_cont output.
> >
> > include/linux/printk.h:#define CONSOLE_EXT_LOG_MAX 8192
> >
> > Anyway, no worries, it simplifies the loop if
> > done that way.
>
> I'm wondering if we shold add a kernel puts() (putsk()? yuk) which can
> puts() a string of any length.
>
> I'm counting around 150 instances of printk("%s", ...) and pr_foo("%s",
> ...) which could perhaps be converted, thus saving an argument.
I'd expect that it hardly matters.
printk(KERN_CONT "string") works.