Skip to content

RFC printk: Switch to CLOCK_MONOTONIC and store extra time stamps

Thomas Gleixner lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7timekeeping: Do not unconditionally suspend NMI safe timekeepersinclude/linux/clocksource.h kernel/time/timekeeping.c+5 -10 replies
2/7x86/tsc: Set clocksource CLOCK_SOURCE_SUSPEND_ACCESS_OKarch/x86/kernel/tsc.c+4 -20 replies
3/7printk: Use clock MONOTONIC for timestampskernel/printk/printk.c+2 -21 reply
4/7timekeeping: Add NMI safe accessor to mono/boot/real clocksinclude/linux/timekeeping.h kernel/time/timekeeping.c+41 -123 replies
5/7crash: Add VMCOREINFO_FIELD_AND_OFFSET()include/linux/crash_core.h+4 -21 reply
6/7printk: Store mono/boot/real time timestampskernel/printk/printk.c+32 -231 reply
7/7timekeeping: Hack to use fine grained timestamps during bootkernel/time/timekeeping.c+21 -49 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by.

PatchThomas Gleixner
1/7
2/7
3/7
4/7
5/7
6/7
7/7Not-Signed-off-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC patch 0/7] printk: Switch to CLOCK_MONOTONIC and store extra time stamps

Following up on yesterdays discussion about adding support for reliably correlatable time stamps to the printk ringbuffer entries, I split up that draft patch from yesterday, addressed review feedback and actually tested it.

There are a few things which are visible changes:

1) The fine grained time stamps start later in the boot process because local_clock() is initialized before a high resolution clocksource is installed.

2) During suspend/resume between timekeeping_suspend() and timekeeping_resume() the NMI safe accessors return a stale timestamp, i.e. the timestamp which was captured in timekeeping_suspend()

Mitigation:

#1 Can be mitigated by a horrible hack, which I added as last patch in the
series. It uses local_clock() in early boot up to the point where a proper clocksource providing fine grained CLOCK_MONOTONIC is available. That's actually not that bad, because time won't drift apart.

#2 Can be mitigated at least for clocksources which are safe to access past
timekeeping_suspend(). There are patches which enable that for TSC when the TSC_NONSTOP_SUSPEND cpu feature bit is enabled.

For clocksources which cannot be accessed past timekeeping_suspend() the workaround #1 can be used (see last patch^Whack). Though this might cause time inconsistencies (non monotonic time stamps).

Not sure if any of this is a real problem, because not all local/sched_clock() implementations are functional past timekeeping_suspend().

I left all 3 time stamps in the patch for now so people can actually play with that.

Thanks,

tglx