Skip to content

Commit ef8969b

Browse files
Frederic WeisbeckerKAGA-KOKO
authored andcommitted
tick: Move broadcast cancellation up to CPUHP_AP_TICK_DYING
The broadcast shutdown code is executed through a random explicit call within stop machine from the outgoing CPU. However the tick broadcast is a midware between the tick callback and the clocksource, therefore it makes more sense to shut it down after the tick callback and before the clocksource drivers. Move it instead to the common tick shutdown CPU hotplug state where related operations can be ordered from highest to lowest level. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240225225508.11587-10-frederic@kernel.org
1 parent f04e512 commit ef8969b

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

include/linux/tick.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ extern void tick_broadcast_control(enum tick_broadcast_mode mode);
7373
static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { }
7474
#endif /* BROADCAST */
7575

76-
#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_HOTPLUG_CPU)
77-
extern void tick_offline_cpu(unsigned int cpu);
78-
#else
79-
static inline void tick_offline_cpu(unsigned int cpu) { }
80-
#endif
81-
8276
#ifdef CONFIG_GENERIC_CLOCKEVENTS
8377
extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state);
8478
#else

kernel/cpu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,8 +1324,6 @@ static int take_cpu_down(void *_param)
13241324
*/
13251325
cpuhp_invoke_callback_range_nofail(false, cpu, st, target);
13261326

1327-
/* Remove CPU from timer broadcasting */
1328-
tick_offline_cpu(cpu);
13291327
/* Park the stopper thread */
13301328
stop_machine_park(cpu);
13311329
return 0;

kernel/time/tick-common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,9 @@ int tick_cpu_dying(unsigned int dying_cpu)
412412

413413
tick_cancel_sched_timer(dying_cpu);
414414

415+
/* Remove CPU from timer broadcasting */
416+
tick_offline_cpu(dying_cpu);
417+
415418
return 0;
416419
}
417420

kernel/time/tick-internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_
142142
#endif /* !(BROADCAST && ONESHOT) */
143143

144144
#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_HOTPLUG_CPU)
145+
extern void tick_offline_cpu(unsigned int cpu);
145146
extern void tick_broadcast_offline(unsigned int cpu);
146147
#else
148+
static inline void tick_offline_cpu(unsigned int cpu) { }
147149
static inline void tick_broadcast_offline(unsigned int cpu) { }
148150
#endif
149151

0 commit comments

Comments
 (0)