Skip to content

Commit 2fbc23c

Browse files
committed
Merge tag 'timers-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner: "Two small fixes for the time(r) subsystem: - Handle a subtle race between the clocksource watchdog and a concurrent clocksource watchdog stop/start sequence correctly to prevent a timer double add bug. - Fix the file path for the core time namespace file" * tag 'timers-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource: Prevent double add_timer_on() for watchdog_timer MAINTAINERS: Correct path to time namespace source file
2 parents f06bed8 + febac33 commit 2fbc23c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13360,7 +13360,7 @@ S: Maintained
1336013360
F: fs/timerfd.c
1336113361
F: include/linux/timer*
1336213362
F: include/linux/time_namespace.h
13363-
F: kernel/time_namespace.c
13363+
F: kernel/time/namespace.c
1336413364
F: kernel/time/*timer*
1336513365

1336613366
POWER MANAGEMENT CORE

kernel/time/clocksource.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,15 @@ static void clocksource_watchdog(struct timer_list *unused)
293293
next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
294294
if (next_cpu >= nr_cpu_ids)
295295
next_cpu = cpumask_first(cpu_online_mask);
296-
watchdog_timer.expires += WATCHDOG_INTERVAL;
297-
add_timer_on(&watchdog_timer, next_cpu);
296+
297+
/*
298+
* Arm timer if not already pending: could race with concurrent
299+
* pair clocksource_stop_watchdog() clocksource_start_watchdog().
300+
*/
301+
if (!timer_pending(&watchdog_timer)) {
302+
watchdog_timer.expires += WATCHDOG_INTERVAL;
303+
add_timer_on(&watchdog_timer, next_cpu);
304+
}
298305
out:
299306
spin_unlock(&watchdog_lock);
300307
}

0 commit comments

Comments
 (0)