Skip to content

Commit 19b344a

Browse files
Frederic WeisbeckerKAGA-KOKO
Frederic Weisbecker
authored andcommitted
timers: Assert no next dyntick timer look-up while CPU is offline
The next timer (re-)evaluation, with the purpose of entering/updating the dyntick mode, can happen from 3 sites and none of them are relevant while the CPU is offline: 1) The idle loop: a) From the quick check helping the cpuidle governor to heuristically predict the best C-state. b) While stopping the tick. But if the CPU is offline, the tick has been cancelled and there is consequently no need to further stop the tick. 2) Remote expiry: when a CPU remotely expires global timers on behalf of another CPU, the latter target's next timer is re-evaluated afterwards. However remote expîry doesn't happen on offline CPUs. 3) IRQ exit: on nohz_full mode, the tick is (re-)evaluated on IRQ exit. But full dynticks is disabled on offline CPUs. Therefore it is safe to assume that no next dyntick timer lookup can be performed on offline CPUs. Assert this expectation to report any surprise. Signed-off-by: Frederic Weisbecker <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 500f8f9 commit 19b344a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/time/timer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,10 +2233,10 @@ static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem,
22332233
bool idle_is_possible;
22342234

22352235
/*
2236-
* Pretend that there is no timer pending if the cpu is offline.
2237-
* Possible pending timers will be migrated later to an active cpu.
2236+
* When the CPU is offline, the tick is cancelled and nothing is supposed
2237+
* to try to stop it.
22382238
*/
2239-
if (cpu_is_offline(smp_processor_id())) {
2239+
if (WARN_ON_ONCE(cpu_is_offline(smp_processor_id()))) {
22402240
if (idle)
22412241
*idle = true;
22422242
return tevt.local;

0 commit comments

Comments
 (0)