From: Arvind Sankar <nivedita@alum.mit.edu>
To: Joe Perches <joe@perches.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
王程刚 <wangchenggang@vivo.com>,
"'Masami Hiramatsu'" <mhiramat@kernel.org>,
"'Steven Rostedt (VMware'" <rostedt@goodmis.org>,
"'Kees Cook'" <keescook@chromium.org>,
"'Thomas Gleixner'" <tglx@linutronix.de>,
"'Dominik Brodowski'" <linux@dominikbrodowski.net>,
"'Arvind Sankar'" <nivedita@alum.mit.edu>,
"'Mike Rapoport'" <rppt@linux.ibm.com>,
"'Alexander Potapenko'" <glider@google.com>,
linux-kernel@vger.kernel.org, kernel@vivo.com
Subject: Re: [PATCH] init/main.c: Print all command line when boot
Date: Tue, 19 May 2020 10:34:28 -0400 [thread overview]
Message-ID: <20200519143428.GA1526900@rani.riverdale.lan> (raw)
In-Reply-To: <79e649a5a73b2137bc576a75271854dc4024ae24.camel@perches.com>
On Mon, May 18, 2020 at 10:09:34PM -0700, Joe Perches wrote:
> On Mon, 2020-05-18 at 20:44 -0700, Andrew Morton wrote:
> > On Tue, 19 May 2020 11:29:46 +0800 王程刚 <wangchenggang@vivo.com> wrote:
> >
> > > Function pr_notice print max length maybe less than the command line length,
> > > need more times to print all.
> > > For example, arm64 has 2048 bytes command line length, but printk maximum
> > > length is only 1024 bytes.
> >
> > I can see why that might be a problem!
> >
> > > --- a/init/main.c
> > > +++ b/init/main.c
> > > @@ -825,6 +825,16 @@ void __init __weak arch_call_rest_init(void)
> > > rest_init();
> > > }
> > >
> > > +static void __init print_cmdline(void)
> > > +{
> > > + const char *prefix = "Kernel command line: ";
> >
> > const char prefix[] = "...";
> >
> > might generate slightly more efficient code.
> >
> > > + int len = -strlen(prefix);
> >
> > hm, tricky. What the heck does printk() actually return to the caller?
> > Seems that we forgot to document this, and there are so many different
> > paths which a printk call can take internally that I'm not confident
> > that they all got it right!
>
> There is no use of the return value of any pr_<level> or
> dev_<level> or netdev_<level) in the kernel.
>
> All the pr_<level> mechanisms (as functions) should return void.
> https://lore.kernel.org/lkml/1466739971-30399-1-git-send-email-joe@perches.com/
>
> > > + len += pr_notice("%s%s\n", prefix, boot_command_line);
> > > + while (boot_command_line[len])
> > > + len += pr_notice("%s\n", &boot_command_line[len]);
> > > +}
>
> More likely it'd be better to use a strlen(boot_command_line)
> and perhaps do something like print multiple lines with args
> using strchr(, ' ') at some largish value, say 132 or 256 chars
> maximum per line.
>
>
>
Should it use pr_cont to print the subsequent lines?
next prev parent reply other threads:[~2020-05-19 14:34 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 3:29 [PATCH] init/main.c: Print all command line when boot 王程刚
2020-05-19 3:44 ` Andrew Morton
2020-05-19 5:09 ` Joe Perches
2020-05-19 14:34 ` Arvind Sankar [this message]
2020-05-19 19:42 ` [RFC PATCH 0/2] printk/init: multi-line kernel command line logging Joe Perches
2020-05-19 19:42 ` [RFC PATCH 1/2] printk: Move and rename maximum printk output line length defines Joe Perches
2020-05-21 13:49 ` Petr Mladek
2020-05-19 19:42 ` [RFC PATCH 2/2] init: Allow multi-line output of kernel command line Joe Perches
2020-05-20 4:41 ` Sergey Senozhatsky
2020-05-20 4:58 ` Joe Perches
2020-05-20 12:10 ` Sergey Senozhatsky
2020-05-20 20:36 ` Joe Perches
2020-05-21 1:00 ` Andrew Morton
2020-05-21 2:09 ` Joe Perches
2020-05-21 4:36 ` Sergey Senozhatsky
2020-05-21 4:40 ` Andrew Morton
2020-05-21 12:31 ` Petr Mladek
2020-05-21 15:08 ` Arvind Sankar
2020-05-21 12:48 ` Sergey Senozhatsky
2020-05-21 4:32 ` Sergey Senozhatsky
2020-05-21 13:46 ` Petr Mladek
2020-05-21 15:59 ` Arvind Sankar
2020-05-21 16:09 ` Joe Perches
2020-06-03 8:48 ` [init] d0bcc26c0d: BUG:kernel_hang_in_early-boot_stage,last_printk:early_console_in_setup_code kernel test robot
2020-05-21 18:40 ` [PATCH] printk: Move and rename maximum printk output line length defines Joe Perches
2020-05-25 8:38 ` Sergey Senozhatsky
2020-05-20 14:01 ` [PATCH] init/main.c: Print all command line when boot Masami Hiramatsu
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=20200519143428.GA1526900@rani.riverdale.lan \
--to=nivedita@alum.mit.edu \
--cc=akpm@linux-foundation.org \
--cc=glider@google.com \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=kernel@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rppt@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=wangchenggang@vivo.com \
/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;
as well as URLs for NNTP newsgroup(s).