From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Petr Mladek <pmladek@suse.com>,
Kevin Hilman <khilman@baylibre.com>,
Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: kernel CI: printk loglevels in kernel boot logs?
Date: Thu, 23 Nov 2017 11:59:57 +0900 [thread overview]
Message-ID: <20171123025933.GA341@jagdpanzerIV> (raw)
In-Reply-To: <20171122125245.bktzhq4ortf6wrj4@wfg-t540p.sh.intel.com>
On (11/22/17 20:52), Fengguang Wu wrote:
[..]
> > well, I think that that "consoles_format=syslog" command line parameter
> > will be enabled only by those who actually want to have it - Fengguang's
> > build robot and kernelCI (+ may be more setups). so I'd probably assume
> > there are low risks here. may be I'm wrong.
>
> Yes, since it needs explicit enabling, local parsers should stay
> working. Unless we send dmesg to other developers, but then they
> might also receive $(dmesg --raw) outputs and need to handle <%u>
> prefixes, too.
>
> > I think it makes sense to have syslog's format "<%u>[timestamp] text\n"
> > on serial consoles (time stamp when PRINTK_TIME set; <%u> when
> > consoles_format=syslog set).
>
> Thanks. Since the 0day scripts can already parse that format (code
> is listed below), we should quickly benefit from that feature when
> it's mainlined.
okay... who's going to send the patch? kernelCI folks?
I have some sort of a patch. added console_msg_format= with the only
available option so far - "syslog". may be people would want to have
boot time, etc. on their consoles. who knows. may be msg_format will
be extended someday in the future or may be not, and we can do
something like "console_format_syslog" (or any better name).
Not-yet-signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++
kernel/printk/printk.c | 21 ++++++++++++++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 62436bd5f34a..42113e5181b2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -640,6 +640,17 @@
console=brl,ttyS0
For now, only VisioBraille is supported.
+ console_msg_format=
+ [KNL] Control message format
+ By default we print messages in "[time stamp] text\n"
+ format (time stamp may not be printed, depending on
+ CONFIG_PRINTK_TIME or `printk_time' param).
+ syslog
+ Switch to syslog format (similar to "dmesg --raw" or
+ reading from /proc/kmsg): "<%u>[time stamp] text\n"
+ IOW, each message is getting prepended with the
+ facility and loglevel prefix.
+
consoleblank= [KNL] The console blank (screen saver) timeout in
seconds. A value of 0 disables the blank timer.
Defaults to 0.
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5d81206a572d..034f3ad85f5b 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -277,6 +277,13 @@ EXPORT_SYMBOL(console_set_on_cmdline);
/* Flag: console code may call schedule() */
static int console_may_schedule;
+enum con_msg_format {
+ MSG_FORMAT_DEFAULT = 1,
+ MSG_FORMAT_SYSLOG = 2,
+};
+
+static int console_msg_format = MSG_FORMAT_DEFAULT;
+
/*
* The printk log buffer consists of a chain of concatenated variable
* length records. Every record starts with a record header, containing
@@ -1913,6 +1920,15 @@ static int __add_preferred_console(char *name, int idx, char *options,
c->index = idx;
return 0;
}
+
+static int __init console_msg_format_setup(char *str)
+{
+ if (!strncmp(str, "syslog", 6))
+ console_msg_format = MSG_FORMAT_SYSLOG;
+ return 1;
+}
+__setup("console_msg_format=", console_msg_format_setup);
+
/*
* Set up a console. Called via do_early_param() in init/main.c
* for each "console=" parameter in the boot command line.
@@ -2215,7 +2231,10 @@ void console_unlock(void)
goto skip;
}
- len += msg_print_text(msg, false, text + len, sizeof(text) - len);
+ len += msg_print_text(msg,
+ console_msg_format & MSG_FORMAT_SYSLOG,
+ text + len,
+ sizeof(text) - len);
if (nr_ext_console_drivers) {
ext_len = msg_print_ext_header(ext_text,
sizeof(ext_text),
--
2.15.0
next prev parent reply other threads:[~2017-11-23 2:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAOi56cVORdyjTXK4QGYRfyD1Q=QBgsU3B__gZT0xj6OBKaasLQ@mail.gmail.com>
[not found] ` <20171122015610.x3kgzqgtwywlurmz@wfg-t540p.sh.intel.com>
2017-11-22 3:27 ` kernel CI: printk loglevels in kernel boot logs? Fengguang Wu
2017-11-22 5:26 ` Sergey Senozhatsky
2017-11-22 10:42 ` Mark Brown
2017-11-22 11:34 ` Petr Mladek
2017-11-22 12:38 ` Sergey Senozhatsky
2017-11-22 12:52 ` Fengguang Wu
2017-11-23 2:59 ` Sergey Senozhatsky [this message]
2017-11-23 3:14 ` Fengguang Wu
2017-11-23 4:31 ` Sergey Senozhatsky
2017-11-29 0:13 ` Kevin Hilman
2017-11-29 7:25 ` Sergey Senozhatsky
2017-11-30 17:45 ` Kevin Hilman
2017-12-01 1:25 ` Sergey Senozhatsky
2017-11-23 10:04 ` Petr Mladek
2017-11-22 20:22 ` Kevin Hilman
2017-11-22 14:10 ` Fengguang Wu
2017-12-05 15:55 ` Petr Mladek
2017-12-05 16:13 ` Sergey Senozhatsky
2017-12-05 20:54 ` Steven Rostedt
2017-12-06 13:54 ` Petr Mladek
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=20171123025933.GA341@jagdpanzerIV \
--to=sergey.senozhatsky.work@gmail.com \
--cc=broonie@kernel.org \
--cc=fengguang.wu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.