kernel_samsung_a53x/kernel/time
Peter Hilber 3349ff0621 timekeeping: Fix cross-timestamp interpolation for non-x86
[ Upstream commit 14274d0bd31b4debf28284604589f596ad2e99f2 ]

So far, get_device_system_crosststamp() unconditionally passes
system_counterval.cycles to timekeeping_cycles_to_ns(). But when
interpolating system time (do_interp == true), system_counterval.cycles is
before tkr_mono.cycle_last, contrary to the timekeeping_cycles_to_ns()
expectations.

On x86, CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE will mitigate on
interpolating, setting delta to 0. With delta == 0, xtstamp->sys_monoraw
and xtstamp->sys_realtime are then set to the last update time, as
implicitly expected by adjust_historical_crosststamp(). On other
architectures, the resulting nonsense xtstamp->sys_monoraw and
xtstamp->sys_realtime corrupt the xtstamp (ts) adjustment in
adjust_historical_crosststamp().

Fix this by deriving xtstamp->sys_monoraw and xtstamp->sys_realtime from
the last update time when interpolating, by using the local variable
"cycles". The local variable already has the right value when
interpolating, unlike system_counterval.cycles.

Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface supporting slower devices")
Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/r/20231218073849.35294-4-peter.hilber@opensynergy.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 08:44:37 +01:00
..
alarmtimer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clockevents.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clocksource.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hrtimer.c hrtimer: Ignore slack time for RT tasks in schedule_hrtimeout_range() 2024-11-18 12:13:34 +01:00
itimer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
jiffies.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
namespace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ntp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ntp_internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix-clock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix-cpu-timers.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix-stubs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix-timers.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix-timers.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sched_clock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
test_udelay.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tick-broadcast-hrtimer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tick-broadcast.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tick-common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tick-internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tick-oneshot.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tick-sched.c tick/sched: Preserve number of idle sleeps across CPU hotplug events 2024-11-18 12:13:07 +01:00
tick-sched.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
time.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timeconst.bc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timeconv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timecounter.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timekeeping.c timekeeping: Fix cross-timestamp interpolation for non-x86 2024-11-19 08:44:37 +01:00
timekeeping.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timekeeping_debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timekeeping_internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer_list.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vsyscall.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00