Re: [PATCH] printk: Add caller information to printk() output.

From: Tetsuo Handa
Date: Mon Dec 03 2018 - 16:10:53 EST


On 2018/12/04 0:06, Petr Mladek wrote:
>> If we modify print_time(), I think that the leading spaces inserted by "%5lu"
>> makes little sense, for "%5lu" is too small for systems with uptime >= 1.16 days
>> and parsers after all cannot assume fixed length for the timestamp field. Then,
>> we could change from "%5lu.%06lu" to "%lu.%06lu" so that parsers (like /bin/awk)
>> can get prefix part using white spaces as a delimiter.
>
> My primary concern was a human readability. The different header columns
> are separated by brackets and the message itself is separated by the space.

PID_MAX_LIMIT is 4194304, which can take up to 10 bytes if [T%u] is used.
But unless a race occurs, each series of printk() lines are printed with
same width. My concern is how to minimize number of characters written to
consoles, for writing to consoles are slow, and userspace usually uses
/dev/kmsg rather than netconsole as a source. For normal users who do not
need to directly parse console/netconsole output, saving spaces in the header
fields will be OK.

> /dev/kmsg uses key=value notation. It does not need any version. The
> version filed was intended for crashdump. It would make the life
> easier for its maintainers.

If the version field is for crashdump rather than for netconsole, we can
get it from some vmcoreinfo variable rather than appending to every record.