Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Ingo Molnar:
 "Three fixes: fix link failure on Alpha, fix a Sparse warning and
  annotate/robustify a lockless access in the NOHZ code"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tick/sched: Annotate lockless access to last_jiffies_update
  lib/vdso: Make __cvdso_clock_getres() static
  time/posix-stubs: Provide compat itimer supoprt for alpha
This commit is contained in:
Linus Torvalds 2020-01-18 13:00:59 -08:00
commit 7ff15cd045
3 changed files with 13 additions and 5 deletions

View File

@ -151,6 +151,9 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
COMPAT_SYS_NI(timer_create); COMPAT_SYS_NI(timer_create);
#endif
#if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA)
COMPAT_SYS_NI(getitimer); COMPAT_SYS_NI(getitimer);
COMPAT_SYS_NI(setitimer); COMPAT_SYS_NI(setitimer);
#endif #endif

View File

@ -58,8 +58,9 @@ static void tick_do_update_jiffies64(ktime_t now)
/* /*
* Do a quick check without holding jiffies_lock: * Do a quick check without holding jiffies_lock:
* The READ_ONCE() pairs with two updates done later in this function.
*/ */
delta = ktime_sub(now, last_jiffies_update); delta = ktime_sub(now, READ_ONCE(last_jiffies_update));
if (delta < tick_period) if (delta < tick_period)
return; return;
@ -70,8 +71,9 @@ static void tick_do_update_jiffies64(ktime_t now)
if (delta >= tick_period) { if (delta >= tick_period) {
delta = ktime_sub(delta, tick_period); delta = ktime_sub(delta, tick_period);
last_jiffies_update = ktime_add(last_jiffies_update, /* Pairs with the lockless read in this function. */
tick_period); WRITE_ONCE(last_jiffies_update,
ktime_add(last_jiffies_update, tick_period));
/* Slow path for long timeouts */ /* Slow path for long timeouts */
if (unlikely(delta >= tick_period)) { if (unlikely(delta >= tick_period)) {
@ -79,8 +81,10 @@ static void tick_do_update_jiffies64(ktime_t now)
ticks = ktime_divns(delta, incr); ticks = ktime_divns(delta, incr);
last_jiffies_update = ktime_add_ns(last_jiffies_update, /* Pairs with the lockless read in this function. */
incr * ticks); WRITE_ONCE(last_jiffies_update,
ktime_add_ns(last_jiffies_update,
incr * ticks));
} }
do_timer(++ticks); do_timer(++ticks);

View File

@ -221,6 +221,7 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res)
return 0; return 0;
} }
static __maybe_unused
int __cvdso_clock_getres(clockid_t clock, struct __kernel_timespec *res) int __cvdso_clock_getres(clockid_t clock, struct __kernel_timespec *res)
{ {
int ret = __cvdso_clock_getres_common(clock, res); int ret = __cvdso_clock_getres_common(clock, res);