Commit 723539db authored by Jan Kiszka's avatar Jan Kiszka Committed by Philippe Gerum

ipipe: Clean up per-CPU host timers on hotplug

When a CPU is unplugged, make sure to drop all per-CPU ipipe timer
devices when removing the CPU. Otherwise, we will corrupt the device
list when re-registering the host timer on CPU onlining.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent c1fb3cbf
......@@ -102,6 +102,11 @@ extern unsigned long __ipipe_hrtimer_freq;
*/
void ipipe_host_timer_register(struct clock_event_device *clkevt);
/*
* Called by tick_cleanup_dead_cpu, to drop per-CPU timer devices
*/
void ipipe_host_timer_cleanup(struct clock_event_device *clkevt);
/*
* Register a standalone ipipe timer
*/
......
......@@ -145,6 +145,21 @@ void ipipe_host_timer_register(struct clock_event_device *evtdev)
ipipe_timer_register(timer);
}
#ifdef CONFIG_HOTPLUG_CPU
void ipipe_host_timer_cleanup(struct clock_event_device *evtdev)
{
struct ipipe_timer *timer = evtdev->ipipe_timer;
unsigned long flags;
if (timer == NULL)
return;
raw_spin_lock_irqsave(&lock, flags);
list_del(&timer->link);
raw_spin_unlock_irqrestore(&lock, flags);
}
#endif /* CONFIG_HOTPLUG_CPU */
/*
* register a timer: maintain them in a list sorted by rating
*/
......
......@@ -630,8 +630,10 @@ void tick_cleanup_dead_cpu(int cpu)
* Unregister the clock event devices which were
* released from the users in the notify chain.
*/
list_for_each_entry_safe(dev, tmp, &clockevents_released, list)
list_for_each_entry_safe(dev, tmp, &clockevents_released, list) {
list_del(&dev->list);
ipipe_host_timer_cleanup(dev);
}
/*
* Now check whether the CPU has left unused per cpu devices
*/
......@@ -641,6 +643,7 @@ void tick_cleanup_dead_cpu(int cpu)
!tick_is_broadcast_device(dev)) {
BUG_ON(!clockevent_state_detached(dev));
list_del(&dev->list);
ipipe_host_timer_cleanup(dev);
}
}
raw_spin_unlock_irqrestore(&clockevents_lock, flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment