2012-08-02 17:13:07

by chpoph

[permalink] [raw]
Subject: In function cpu_stop_cpu_callback, BUG_ON(stopper->thread || stopper->enabled || !list_empty(&stopper->works)) is triggered while restarting sometimes.

In function cpu_stop_cpu_callback, BUG_ON(stopper->thread ||
stopper->enabled || !list_empty(&stopper->works)) is triggered
sometimes.
/* manage stopper for a cpu, mostly lifted from sched migration thread mgmt */
static int __cpuinit cpu_stop_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
..................................
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_UP_PREPARE:
BUG_ON(stopper->thread || stopper->enabled ||
!list_empty(&stopper->works));
.................................
}

Before actually hardware restarting, machine_restart(cmd) will be called.

void machine_restart(char *cmd)
{
machine_shutdown();
arm_pm_restart(reboot_mode, cmd);
......................
}

after machine_shutdown(), all other cpus are set offline only by
settting the cpumask. if userspace software which regulators cpu are
running before arm_pm_restart(), it may set set another cpu online and
cpu_up(cpu) is called. At this situation, BUG_ON(stopper->thread ||
stopper->enabled || !list_empty(&stopper->works)) is triggered in
cpu_stop_cpu_callback.

Is it needed to preempt disable before calling machine_shutdown()?