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 clockevents: Warn if cpu_all_mask is used as cpumask 2018-08-02 14:55:53 +02:00
clocksource.c clocksource: Revert "Remove kthread" 2018-09-06 23:38:35 +02:00
hrtimer.c
itimer.c pid: Implement PIDTYPE_TGID 2018-07-21 10:43:12 -05:00
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: Fix division by zero bug 2018-12-29 13:37:56 +01:00
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-hrtimer: Use cpu_possible_mask for ce_broadcast_hrtimer 2018-08-02 14:55:52 +02:00
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 nohz: Fix local_timer_softirq_pending() 2018-07-31 22:08:44 +02:00
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 timers: Clear timer_base::must_forward_clk with timer_base::lock held 2018-08-02 12:52:38 +02:00