diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2017-08-31 17:12:48 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-09-25 21:05:59 +0200 |
commit | 4c3711d7fb4763c63b2654f2d07cbe21ca5aadd4 (patch) | |
tree | 8601fdab0f9b823f687d0ae5ddef6b7ef6046710 /kernel/kcmp.c | |
parent | 5df32107f609c1f621bcdac0a685c23677ef671e (diff) | |
download | linux-4c3711d7fb4763c63b2654f2d07cbe21ca5aadd4.tar.gz linux-4c3711d7fb4763c63b2654f2d07cbe21ca5aadd4.tar.bz2 linux-4c3711d7fb4763c63b2654f2d07cbe21ca5aadd4.zip |
timekeeping: Provide NMI safe access to clock realtime
The configurable printk timestamping wants access to clock realtime. Right
now there is no ktime_get_real_fast_ns() accessor because reading the
monotonic base and the realtime offset cannot be done atomically. Contrary
to boot time this offset can change during runtime and cause half updated
readouts.
struct tk_read_base was fully packed when the fast timekeeper access was
implemented. commit ceea5e3771ed ("time: Fix clock->read(clock) race around
clocksource changes") removed the 'read' function pointer from the
structure, but of course left the comment stale.
So now the structure can fit a new 64bit member w/o violating the cache
line constraints.
Add real_base to tk_read_base and update it in the fast timekeeper update
sequence.
Implement an accessor which follows the same scheme as the accessor to
clock monotonic, but uses the new real_base to access clock real time.
The runtime overhead for updating real_base is minimal as it just adds two
cache hot values and stores them into an already dirtied cache line along
with the other fast timekeeper updates.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead,org>
Link: https://lkml.kernel.org/r/1505757060-2004-3-git-send-email-prarit@redhat.com
Diffstat (limited to 'kernel/kcmp.c')
0 files changed, 0 insertions, 0 deletions