Re: [PATCH 0/2] printk, Add printk.clock kernel parameter [v2]

From: Prarit Bhargava
Date: Thu Jan 14 2016 - 09:39:35 EST




On 01/14/2016 07:52 AM, Petr Mladek wrote:
> On Wed 2016-01-13 18:28:50, Thomas Gleixner wrote:
>> You can solve the whole business by changing the timestamp in printk_log to
>>
>> u64 mono;
>> u64 offset_real;
>
> This is not so easy because the structure is proceed by userspace tool,
> e.g. crash, see log_buf_kexec_setup(). We would need to update all
> the tools as well.
>
>
>> and have a function which does:
>>
>> u64 ktime_get_log_ts(u64 *offset_real)
>> {
>> *offset_real = tk_core.timekeeper.offs_real;
>>
>> if (timekeeping_active)
>> return ktime_get_mono_fast_ns();
>> else
>> return local_clock();
>> }
>
> A solution would be to apply the offset_real immediately. I wonder if
> any tool expects the messages to be sorted by a monotonic clock. In

/var/log/messages from systemd will have to be fixed, but that's something that
was brought up previously (and IMO should be trivial based on the value in
/sys/modules/printk/parameters/time).

> fact, it might be useful to see that some messages are disordered
> against the real time, e.g. because of the leaf second.

I kicked a leap seconds during my testing (I have been running tests from
/tools/tests/selftests/timers) and didn't see anything strange with both a stock
leap-a-day.c and a modified leap-a-day.c which only does leap insertions.

P.

>
> Best Regards,
> Petr
>