rk: disable preempt_disable when power off
author黄涛 <huangtao@rock-chips.com>
Thu, 28 Feb 2013 05:30:49 +0000 (13:30 +0800)
committer黄涛 <huangtao@rock-chips.com>
Thu, 28 Feb 2013 05:57:13 +0000 (13:57 +0800)
On power off, pmic driver use mutex, so can not disable preemption.
Else will see this bug:
  rk30_pm_power_off start...
  act8846_device_shutdown
  BUG: scheduling while atomic: Thread-102/1505/0x00000002
  [<c043e390>] (unwind_backtrace+0x0/0xf8) from [<c09019f0>] (__schedule+0x7ec/0x8a8)
  [<c09019f0>] (__schedule+0x7ec/0x8a8) from [<c0902ca8>] (__mutex_lock_slowpath+0x128/0x1bc)
  [<c0902ca8>] (__mutex_lock_slowpath+0x128/0x1bc) from [<c0902da8>] (mutex_lock+0x6c/0x70)
  [<c0902da8>] (mutex_lock+0x6c/0x70) from [<c06213d8>] (act8846_reg_read+0x28/0x4c)
  [<c06213d8>] (act8846_reg_read+0x28/0x4c) from [<c062159c>] (act8846_device_shutdown+0x24/0x80)
  [<c062159c>] (act8846_device_shutdown+0x24/0x80) from [<c044f060>] (rk30_pm_power_off+0x4c/0x78)
  [<c044f060>] (rk30_pm_power_off+0x4c/0x78) from [<c0439dbc>] (machine_power_off+0x1c/0x24)
  [<c0439dbc>] (machine_power_off+0x1c/0x24) from [<c0481488>] (sys_reboot+0x154/0x214)
  [<c0481488>] (sys_reboot+0x154/0x214) from [<c0438f80>] (ret_fast_syscall+0x0/0x30)

And smp_send_stop is doing nothing on rk platform when power off, so it is no need to disable preemption.

arch/arm/kernel/process.c

index c132e8145754c3b9a8ea8d5e1a82a2467f707795..65d27efb1a916288ba2ae0bf3842d99e3b5f9682 100644 (file)
@@ -279,7 +279,9 @@ void machine_shutdown(void)
         * thread that might wind up blocking on
         * one of the stopped CPUs.
         */
+#ifndef CONFIG_PLAT_RK
        preempt_disable();
+#endif
 
        smp_send_stop();
 #endif