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

From: Tetsuo Handa
Date: Sun Dec 02 2018 - 06:24:18 EST


On 2018/12/01 23:44, Tetsuo Handa wrote:
> On 2018/12/01 0:40, Petr Mladek wrote:
>>> Some examples for console output:
>>>
>>> [ 0.293000] [T1] smpboot: CPU0: Intel(R) Core(TM) i5-4440S CPU @ 2.80GHz (family: 0x6, model: 0x3c, stepping: 0x3)
>>> [ 0.299733] [T1] Performance Events: Haswell events, core PMU driver.
>>> [ 2.813808] [T35] clocksource: Switched to clocksource tsc
>>> [ 2.893984] [C0] random: fast init done
>> ^
>>
>> Please, remove the space between the timestamp and the from field.
>
> This space was emitted by print_time(). Do we want to modify print_time()
> not to emit this space if the from field is printed?
>
> 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.
>
> If we want to reduce space, do we want to do like
>
> [0.293000@T1] smpboot: CPU0: Intel(R) Core(TM) i5-4440S CPU @ 2.80GHz (family: 0x6, model: 0x3c, stepping: 0x3)
> [0.299733@T1] Performance Events: Haswell events, core PMU driver.
> [2.813808@T35] clocksource: Switched to clocksource tsc
> [2.893984@C0] random: fast init done
>
> (if printk_time = true) or
>
> [@T1] smpboot: CPU0: Intel(R) Core(TM) i5-4440S CPU @ 2.80GHz (family: 0x6, model: 0x3c, stepping: 0x3)
> [@T1] Performance Events: Haswell events, core PMU driver.
> [@T35] clocksource: Switched to clocksource tsc
> [@C0] random: fast init done
>
> (if printk_time = false) ?
>
> Dmitry, what format/delimiter is convenient for parsing by syzbot?

Here is an updated patch (which uses appropriate PREFIX_MAX definition
after "[PATCH v2] printk: fix printk_time race." is applied).