There are high chances for hrtimer_interrupt() interrupt on
one of the core and other core executing sys_reboot simultaneously.
In such a situation we could see ipi_cpu_stop() marking a cpu
as 'offline' but hrtimer_wakeup() can schedule a task on
offline core, resulting BUG_ON in smp_send_reschedule().
In fact that the CPU is not really offline but ipi_cpu_stop()
is marking it as offline.
CPU0 CPU1 CPU2
sys_reboot()
kernel_restart()
machine_restart()
machine_shutdown()
smp_send_stop() ...
... ipi_cpu_stop() hrtimer_interrupt()
set_cpu_online(1, false) __run_hrtimer()
local_irq_disable() hrtimer_wakeup()
while(1) try_to_wake_up()
ttwu_do_wakeup()
check_preempt_curr()
smp_send_reschedule()
BUG_ON(cpu_is_offline(1));
This is easily reproducible in device continuous reboot testing.
Since the CPU is not really offline and hasn't gone through the
proper steps to be marked as such, let's mark the CPU as inactive.
Change-Id: Ia1daea407220578d4212ef6c65c4be837ca370fd
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>