Re: kernel CI: printk loglevels in kernel boot logs?

From: Sergey Senozhatsky
Date: Wed Nov 22 2017 - 00:26:53 EST


Hello,

On (11/22/17 11:27), Fengguang Wu wrote:
> [CC LKML for possible printk improvements]

[..]

> > > In kernelCI, we're considering submitting a patch to add a
> > > "show_loglevel" command-line argument to enable that option on kernel
> > > boot.
> >
> > Thanks for doing that patch! It'll obviously make it easier to catch
> > various warnings, which will be useful when used with caution,
> > especially when false warnings (wrt. real problems that should be
> > fixed) can be effectively filtered out.

both /dev/kmsg and /proc/kmsg show log levels. user space then can
hide those levels or show them via "--raw" mode/etc. we don't (*sort
of don't*) have a "--raw" mode for serial consoles. we do have extended
consoles, which print metadata on consoles: msg_print_ext_header()
and msg_print_ext_body()

sprintf(... "%u,%llu,%llu,%c;",
(msg->facility << 3) | msg->level, seq, ts_usec, ....)

basically the same format as for /dev/kmsg. but extended console drivers
come at a price - broken pr_cont(). "sad!". and, besides, may be ext
consoles can show more data than needed.

/proc/kmsg has different format. it does not do the ext_header/ext_body
thing, but instead calls msg_print_text()->print_prefix(), which simply
does

prefix = (msg->facility << 3) | msg->level;
sprintf(buf, "<%u>", prefix);

console_unlock(), the function that prints messages on the consoles,
calls msg_print_text() function, but does not do print_prefix()
("bool syslog" is false).

so may be we can add "syslog" mode for console drivers and do print_prefix()
in console_unlock() [unless have nr_ext_console_drivers]. if this is what
you guys are talking about. (frankly, I have no idea if there are tools
that parse output from serial consoles/net consoles and thus might get
confused by extra <%u> in every message).

-ss