linux/kernel/time
Thomas Gleixner ca4c34037b timekeeping: Repair ktime_get_coarse*() granularity
commit e3ff9c3678 upstream.

Jason reported that the coarse ktime based time getters advance only once
per second and not once per tick as advertised.

The code reads only the monotonic base time, which advances once per
second. The nanoseconds are accumulated on every tick in xtime_nsec up to
a second and the regular time getters take this nanoseconds offset into
account, but the ktime_get_coarse*() implementation fails to do so.

Add the accumulated xtime_nsec value to the monotonic base time to get the
proper per tick advancing coarse tinme.

Fixes: b9ff604cff ("timekeeping: Add ktime_get_coarse_with_offset")
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Sultan Alsawaf <sultan@kerneltoast.com>
Cc: Waiman Long <longman@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1906132136280.1791@nanos.tec.linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-19 08:18:06 +02:00
..
alarmtimer.c alarmtimer: Return correct remaining time 2019-04-17 08:38:50 +02:00
clockevents.c
clocksource.c
hrtimer.c
itimer.c
jiffies.c
Kconfig
Makefile
ntp_internal.h
ntp.c ntp: Allow TAI-UTC offset to be set to zero 2019-06-15 11:54:04 +02:00
posix-clock.c
posix-cpu-timers.c posix-cpu-timers: Unbreak timer rearming 2019-01-31 08:14:39 +01:00
posix-stubs.c
posix-timers.c
posix-timers.h
sched_clock.c timers/sched_clock: Prevent generic sched_clock wrap caused by tick_freeze() 2019-04-27 09:36:38 +02:00
test_udelay.c
tick-broadcast-hrtimer.c
tick-broadcast.c
tick-common.c timers/sched_clock: Prevent generic sched_clock wrap caused by tick_freeze() 2019-04-27 09:36:38 +02:00
tick-internal.h
tick-oneshot.c
tick-sched.c
tick-sched.h
time.c timekeeping: Force upper bound for setting CLOCK_REALTIME 2019-05-31 06:46:29 -07:00
timeconst.bc
timeconv.c
timecounter.c
timekeeping_debug.c
timekeeping_internal.h
timekeeping.c timekeeping: Repair ktime_get_coarse*() granularity 2019-06-19 08:18:06 +02:00
timekeeping.h timers/sched_clock: Prevent generic sched_clock wrap caused by tick_freeze() 2019-04-27 09:36:38 +02:00
timer_list.c
timer.c