mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-04 16:43:40 +01:00
timers/core: Convert to hotplug state machine
When tearing down, call timers_dead_cpu() before notify_dead(). There is a hidden dependency between: - timers - block multiqueue - rcutree If timers_dead_cpu() comes later than blk_mq_queue_reinit_notify() that latter function causes a RCU stall. Signed-off-by: Richard Cochran <[email protected]> Signed-off-by: Anna-Maria Gleixner <[email protected]> Reviewed-by: Sebastian Andrzej Siewior <[email protected]> Cc: John Stultz <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
1 parent
27590dc17b
commit
24f73b9971
4 files changed
+14
-23
No files matched your search
@@ -16,6 +16,7 @@ enum cpuhp_state {
|
||||
CPUHP_X86_APB_DEAD,
|
||||
CPUHP_WORKQUEUE_PREP,
|
||||
CPUHP_HRTIMERS_PREPARE,
|
||||
CPUHP_TIMERS_DEAD,
|
||||
CPUHP_NOTIFY_PREPARE,
|
||||
CPUHP_BRINGUP_CPU,
|
||||
CPUHP_AP_IDLE_DEAD,
|
||||
|
||||
@@ -273,4 +273,10 @@ unsigned long __round_jiffies_up_relative(unsigned long j, int cpu);
|
||||
unsigned long round_jiffies_up(unsigned long j);
|
||||
unsigned long round_jiffies_up_relative(unsigned long j);
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
int timers_dead_cpu(unsigned int cpu);
|
||||
#else
|
||||
#define timers_dead_cpu NULL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1195,6 +1195,11 @@ static struct cpuhp_step cpuhp_bp_states[] = {
|
||||
.startup = hrtimers_prepare_cpu,
|
||||
.teardown = hrtimers_dead_cpu,
|
||||
},
|
||||
[CPUHP_TIMERS_DEAD] = {
|
||||
.name = "timers dead",
|
||||
.startup = NULL,
|
||||
.teardown = timers_dead_cpu,
|
||||
},
|
||||
/*
|
||||
* Preparatory and dead notifiers. Will be replaced once the notifiers
|
||||
* are converted to states.
|
||||
|
||||
+2
-23
@@ -1804,7 +1804,7 @@ static void migrate_timer_list(struct timer_base *new_base, struct hlist_head *h
|
||||
}
|
||||
}
|
||||
|
||||
static void migrate_timers(int cpu)
|
||||
int timers_dead_cpu(unsigned int cpu)
|
||||
{
|
||||
struct timer_base *old_base;
|
||||
struct timer_base *new_base;
|
||||
@@ -1831,29 +1831,9 @@ static void migrate_timers(int cpu)
|
||||
spin_unlock_irq(&new_base->lock);
|
||||
put_cpu_ptr(&timer_bases);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int timer_cpu_notify(struct notifier_block *self,
|
||||
unsigned long action, void *hcpu)
|
||||
{
|
||||
switch (action) {
|
||||
case CPU_DEAD:
|
||||
case CPU_DEAD_FROZEN:
|
||||
migrate_timers((long)hcpu);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static inline void timer_register_cpu_notifier(void)
|
||||
{
|
||||
cpu_notifier(timer_cpu_notify, 0);
|
||||
}
|
||||
#else
|
||||
static inline void timer_register_cpu_notifier(void) { }
|
||||
#endif /* CONFIG_HOTPLUG_CPU */
|
||||
|
||||
static void __init init_timer_cpu(int cpu)
|
||||
@@ -1881,7 +1861,6 @@ void __init init_timers(void)
|
||||
{
|
||||
init_timer_cpus();
|
||||
init_timer_stats();
|
||||
timer_register_cpu_notifier();
|
||||
open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user