Re: [RFC][PATCH] printk: add console_msg_format command line option

From: Sergey Senozhatsky
Date: Thu Dec 07 2017 - 11:04:04 EST


On (12/07/17 16:45), Petr Mladek wrote:
[.,]
> > hmm... `dmesg -S --raw' doesn't show anything on my system. `dmesg --raw'
> > matches the console_msg_format=syslog.
>
> Huh, I am confused now. I thought that I saw the extended, /dev/kmsg - like,
> output with "dmesg --raw" but I do not see it now.
>
> Anyway, I can see a difference related to
> /sys/module/printk/parameters/time. The command "dmesg --raw" always
> shows the timestamp help because it reads the messages via /dev/kmsg.
> But "dmesg -S --raw" shows the timestamp only when the "time"
> parameter is enabled:

aha, I see your point. -S forces dmesg to use syslog() syscall. so it
doesn't access the kmsg. otherwise it attempts to read from kmsg first.
you are right.

> $> echo 0 >/sys/module/printk/parameters/time
> $> dmesg -S --raw | head -n 3
> <5>Linux version 4.15.0-rc2-5-default+ (pmladek@pathway) (gcc version 4.8.5 (SUSE Linux)) #4180 SMP Thu Dec 7 16:06:42 CET 2017
> <6>Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-rc2-5-default+ root=UUID=9ba368bb-c323-4131-ad94-c29cf3add76f resume=/dev/sda2 earlyprintk=ttyS0,115200 console=tty0 console=ttyS0,115200 console_msg_format=syslog ignore_loglevel nosplash showopts crashkernel=256M,high crashkernel=128M,low
> <6>x86/fpu: x87 FPU will use FXSAVE
> $> echo 1 >/sys/module/printk/parameters/time
> $> dmesg -S --raw | head -n 3
> <5>[ 0.000000] Linux version 4.15.0-rc2-5-default+ (pmladek@pathway) (gcc version 4.8.5 (SUSE Linux)) #4180 SMP Thu Dec 7 16:06:42 CET 2017
> <6>[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-rc2-5-default+ root=UUID=9ba368bb-c323-4131-ad94-c29cf3add76f resume=/dev/sda2 earlyprintk=ttyS0,115200 console=tty0 console=ttyS0,115200 console_msg_format=syslog ignore_loglevel nosplash showopts crashkernel=256M,high crashkernel=128M,low
> <6>[ 0.000000] x86/fpu: x87 FPU will use FXSAVE

I see.

> To be honest, I am somehow confused by the terminology.
> We should make it clear that the "syslog" console format
> is the same as the format used by the syslog syscall.

yeah. that was exactly my point. syslog format means that

: we do what reading from /proc/kmsg does -- do_syslog(). which "is"
: the same for some dmesg modes.

I thought that `dmesg --raw' always uses do_syslog(), apparently this
is not the case, and that "is" was not correct.

-ss