From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754668AbdLGOBK (ORCPT ); Thu, 7 Dec 2017 09:01:10 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:43851 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753555AbdLGOBI (ORCPT ); Thu, 7 Dec 2017 09:01:08 -0500 X-Google-Smtp-Source: AGs4zMYCPcYccDl6V0O6C0/XkazByiUQ4Rtf9yqKPncet/9Fm3XBdoM7taPXvKuADZ4RjYZ6J5dnbA== Date: Thu, 7 Dec 2017 23:01:04 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Fengguang Wu , Kevin Hilman , Mark Brown , Greg Kroah-Hartman , Andrew Morton , LKML , Sergey Senozhatsky Subject: Re: [RFC][PATCH] printk: add console_msg_format command line option Message-ID: <20171207140104.GA659@tigerII.localdomain> References: <20171201104404.1885-1-sergey.senozhatsky@gmail.com> <20171207134844.dkwo4b2tsfj3jxyu@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171207134844.dkwo4b2tsfj3jxyu@pathway.suse.cz> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On (12/07/17 14:48), Petr Mladek wrote: [..] > > This patch introduces a `console_msg_format=' command line option, > > to switch between different message formatting on serial consoles. > > For the time being we have just one option - syslog. This option > > makes serial console messages to appear in syslog format, matching > > the `dmesg --raw' and `cat /proc/kmsg' output formats: > > I have realized that 'cat /proc/kmsg' did not work. It can be done using: hm, it does work on my system. what do you mean by 'did not work'? > Also the format is more comlicated here, see printk.c: > > * /dev/kmsg exports the structured data in the following line format: > * ",,,[,additional_values, ... ];\n" that's /dev/kmsg. /dev/kmsg != /proc/kmsg. I never mentioned /dev/kmsg in my commit. /dev/kmsg prints the extended stuff, /proc/kmsg does not. > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > > index 28467638488d..2dd91c5073f9 100644 > > --- a/Documentation/admin-guide/kernel-parameters.txt > > +++ b/Documentation/admin-guide/kernel-parameters.txt > > @@ -643,6 +643,16 @@ > > 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" > > To be precise, it exactly the same as "dmesg -S --raw". Also it is the > format used by SYSLOG_ACTION_READ* actions of the syslog syscall. hmm... `dmesg -S --raw' doesn't show anything on my system. `dmesg --raw' matches the console_msg_format=syslog. > > +static int __init console_msg_format_setup(char *str) > > +{ > > + if (!strncmp(str, "syslog", 6)) > > + console_msg_format = MSG_FORMAT_SYSLOG; > > It might make sense to accept also the "default" format. > > > + return 1; > > +} > > +__setup("console_msg_format=", console_msg_format_setup); > > I would use early_param() so that it takes effect as soon as possible. ok. can take a look. -ss