android_kernel_motorola_sm6375/kernel/time
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Paul E. McKenney dba9cda5aa clocksource: Retry clock read if long delays detected
[ Upstream commit db3a34e17433de2390eb80d436970edcebd0ca3e ]

When the clocksource watchdog marks a clock as unstable, this might be due
to that clock being unstable or it might be due to delays that happen to
occur between the reads of the two clocks.  Yes, interrupts are disabled
across those two reads, but there are no shortage of things that can delay
interrupts-disabled regions of code ranging from SMI handlers to vCPU
preemption.  It would be good to have some indication as to why the clock
was marked unstable.

Therefore, re-read the watchdog clock on either side of the read from the
clock under test.  If the watchdog clock shows an excessive time delta
between its pair of reads, the reads are retried.

The maximum number of retries is specified by a new kernel boot parameter
clocksource.max_cswd_read_retries, which defaults to three, that is, up to
four reads, one initial and up to three retries.  If more than one retry
was required, a message is printed on the console (the occasional single
retry is expected behavior, especially in guest OSes).  If the maximum
number of retries is exceeded, the clock under test will be marked
unstable.  However, the probability of this happening due to various sorts
of delays is quite small.  In addition, the reason (clock-read delays) for
the unstable marking will be apparent.

Reported-by: Chris Mason <clm@fb.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Feng Tang <feng.tang@intel.com>
Link: https://lore.kernel.org/r/20210527190124.440372-1-paulmck@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-14 16:53:18 +02:00
..
alarmtimer.c kernel, fs: Introduce and use set_restart_fn() and arch_set_restart_data() 2021-03-24 11:26:44 +01:00
clockevents.c
clocksource.c clocksource: Retry clock read if long delays detected 2021-07-14 16:53:18 +02:00
hrtimer.c kernel, fs: Introduce and use set_restart_fn() and arch_set_restart_data() 2021-03-24 11:26:44 +01:00
itimer.c time: Prevent undefined behaviour in timespec64_to_ns() 2020-11-18 19:20:15 +01:00
jiffies.c
Kconfig
Makefile
ntp.c
ntp_internal.h
posix-clock.c
posix-cpu-timers.c kernel, fs: Introduce and use set_restart_fn() and arch_set_restart_data() 2021-03-24 11:26:44 +01:00
posix-stubs.c
posix-timers.c posix-timers: Preserve return value in clock_adjtime32() 2021-05-11 14:04:04 +02:00
posix-timers.h
sched_clock.c
test_udelay.c
tick-broadcast-hrtimer.c
tick-broadcast.c
tick-common.c tick/common: Touch watchdog in tick_unfreeze() on all CPUs 2020-11-18 19:20:26 +01:00
tick-internal.h
tick-oneshot.c
tick-sched.c tick/sched: Remove bogus boot "safety" check 2021-01-06 14:48:40 +01:00
tick-sched.h
time.c
timeconst.bc
timeconv.c
timecounter.c
timekeeping.c timekeeping: Prevent 32bit truncation in scale64_check_overflow() 2020-10-01 13:17:38 +02:00
timekeeping.h
timekeeping_debug.c
timekeeping_internal.h
timer.c random32: make prandom_u32() output unpredictable 2020-11-18 19:20:20 +01:00
timer_list.c
vsyscall.c