timer: Update code that migrates timers and hrtimers during isolation

__migrate_timers() can be called from both hotplug and isolation
contexts. When called from the isolation context, we might sometimes
encounter running timers. This is OK since the currently running or
just expired timers are off of the timer wheel and so everything else
can be migrated off.

In the case of hrtimers, we must wait until all callbacks have finished.
However, a udelay is important while waiting to allow for store-exclusive
fairness when run_hrtimer is attempting to grab the hrtimer base lock.

Change-Id: I4dccc66e09819a44b2f9597408a6a3ac4e11f5d7
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 470d966..5463c3b 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1856,7 +1856,8 @@
 		spin_lock_irqsave(&new_base->lock, flags);
 		spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
 
-		BUG_ON(old_base->running_timer);
+		if (!cpu_online(cpu))
+			BUG_ON(old_base->running_timer);
 
 		for (i = 0; i < WHEEL_SIZE; i++)
 			migrate_timer_list(new_base, old_base->vectors + i,