Re: [RFC patch 6/7] printk: Store mono/boot/real time timestamps

From: Petr Mladek
Date: Thu Nov 23 2017 - 08:36:30 EST


On Wed 2017-11-15 19:15:37, Thomas Gleixner wrote:
> To allow reliable timestamp correlation, replace the clock MONOTONIC based
> timestamp in the printk ringbuffer entries with a collection of MONOTONIC,
> BOOTTIME and REALTIME timestamps.
>
> This does not change the textual output, as this is a separate issue. For
> tools which access a vmcore the new timestamp fields are separately
> exported by name so the tools do not have to gain knowledge about struct
> system_timestamps. The existing 'ts_nsec' timestamp, which is used by
> existing tools is mapped to the clock MONOTONIC entry of the timestamp
> collection.

OK, we do this to do not break existing users. But what are
the acceptable ways to make this information available?

IMHO, the right solution is that every reader would need to
explicitely ask for the extended format:

+ /dev/kmsg: ask for extended output via ioctl()

+ syslog: ask for extra timestamps by LOG_*_TIMESTAMP options
of the openlog() syscall. It would be similar
to LOG_PID.

+ console: extend to console= parameter format, e.g.
console=name[,options][/t]

, where /t would cause showing all the timestamps
in the following format

[xxxxx.xxxxxx][b=xxxxx.xxxxxx][r=xxxxx.xxxxxxx] <message>

Would this be acceptable, please?
Do you have other/better ideas, please?

Best Regards,
Petr