mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
timers: Reinitialize per cpu bases on hotplug
The timer wheel bases are not (re)initialized on CPU hotplug. That leaves
them with a potentially stale clk and next_expiry valuem, which can cause
trouble then the CPU is plugged.
Add a prepare callback which forwards the clock, sets next_expiry to far in
the future and reset the control flags to a known state.
Set base->must_forward_clk so the first timer which is queued will try to
forward the clock to current jiffies.
Fixes: 500462a9de ("timers: Switch to a non-cascading wheel")
Reported-by: Paul E. McKenney <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Sebastian Siewior <[email protected]>
Cc: Anna-Maria Gleixner <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1712272152200.2431@nanos
This commit is contained in:
parent
ced6d5c11d
commit
26456f87ac
4 changed files with 21 additions and 4 deletions
|
|
@ -1277,9 +1277,9 @@ static struct cpuhp_step cpuhp_bp_states[] = {
|
|||
* before blk_mq_queue_reinit_notify() from notify_dead(),
|
||||
* otherwise a RCU stall occurs.
|
||||
*/
|
||||
[CPUHP_TIMERS_DEAD] = {
|
||||
[CPUHP_TIMERS_PREPARE] = {
|
||||
.name = "timers:dead",
|
||||
.startup.single = NULL,
|
||||
.startup.single = timers_prepare_cpu,
|
||||
.teardown.single = timers_dead_cpu,
|
||||
},
|
||||
/* Kicks the plugged cpu into life */
|
||||
|
|
|
|||
|
|
@ -1853,6 +1853,21 @@ static void migrate_timer_list(struct timer_base *new_base, struct hlist_head *h
|
|||
}
|
||||
}
|
||||
|
||||
int timers_prepare_cpu(unsigned int cpu)
|
||||
{
|
||||
struct timer_base *base;
|
||||
int b;
|
||||
|
||||
for (b = 0; b < NR_BASES; b++) {
|
||||
base = per_cpu_ptr(&timer_bases[b], cpu);
|
||||
base->clk = jiffies;
|
||||
base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA;
|
||||
base->is_idle = false;
|
||||
base->must_forward_clk = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int timers_dead_cpu(unsigned int cpu)
|
||||
{
|
||||
struct timer_base *old_base;
|
||||
|
|
|
|||
Loading…
Reference in a new issue