52 lines
1.4 KiB
Diff
52 lines
1.4 KiB
Diff
From: Ingo Molnar <mingo@elte.hu>
|
|
Date: Fri, 3 Jul 2009 08:30:32 -0500
|
|
Subject: timers: fix timer hotplug on -rt
|
|
|
|
Here we are in the CPU_DEAD notifier, and we must not sleep nor
|
|
enable interrupts.
|
|
|
|
Signed-off-by: Ingo Molnar <mingo@elte.hu>
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
|
|
---
|
|
kernel/timer.c | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
Index: linux-3.4/kernel/timer.c
|
|
===================================================================
|
|
--- linux-3.4.orig/kernel/timer.c
|
|
+++ linux-3.4/kernel/timer.c
|
|
@@ -1764,6 +1764,7 @@ static void __cpuinit migrate_timers(int
|
|
{
|
|
struct tvec_base *old_base;
|
|
struct tvec_base *new_base;
|
|
+ unsigned long flags;
|
|
int i;
|
|
|
|
BUG_ON(cpu_online(cpu));
|
|
@@ -1773,8 +1774,11 @@ static void __cpuinit migrate_timers(int
|
|
* The caller is globally serialized and nobody else
|
|
* takes two locks at once, deadlock is not possible.
|
|
*/
|
|
- spin_lock_irq(&new_base->lock);
|
|
- spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
|
|
+ local_irq_save(flags);
|
|
+ while (!spin_trylock(&new_base->lock))
|
|
+ cpu_relax();
|
|
+ while (!spin_trylock(&old_base->lock))
|
|
+ cpu_relax();
|
|
|
|
BUG_ON(old_base->running_timer);
|
|
|
|
@@ -1788,7 +1792,9 @@ static void __cpuinit migrate_timers(int
|
|
}
|
|
|
|
spin_unlock(&old_base->lock);
|
|
- spin_unlock_irq(&new_base->lock);
|
|
+ spin_unlock(&new_base->lock);
|
|
+ local_irq_restore(flags);
|
|
+
|
|
put_cpu_var(tvec_bases);
|
|
}
|
|
#endif /* CONFIG_HOTPLUG_CPU */
|