summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/hotplug.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-03-26 09:46:07 +0100
committerShawn Guo <shawn.guo@linaro.org>2013-03-26 13:25:45 +0100
commit2f3edfd7e27ad4206acbc2ae99c9df5f46353024 (patch)
tree91a1caefb205cb5fe9fc28de6cddd9490540c9b0 /arch/arm/mach-imx/hotplug.c
parentARM: imx: add dependency check for DEBUG_IMX_UART_PORT (diff)
downloadlinux-2f3edfd7e27ad4206acbc2ae99c9df5f46353024.tar.xz
linux-2f3edfd7e27ad4206acbc2ae99c9df5f46353024.zip
ARM: imx: fix sync issue between imx_cpu_die and imx_cpu_kill
There is a sync issue with hotplug operation. It's possible that when imx_cpu_kill gets running on primary core, the imx_cpu_die execution on the core which is to be killed hasn't been finished yet. The problem will very likely be hit when running suspend without no_console_suspend setting on kernel cmdline. It uses cpu jumping argument register to sync imx_cpu_die and imx_cpu_kill. The register will be set in imx_cpu_die and imx_cpu_kill will wait for the register being cleared to actually kill the cpu. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'arch/arm/mach-imx/hotplug.c')
-rw-r--r--arch/arm/mach-imx/hotplug.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 7bc5fe15dda2..361a253e2b63 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -46,11 +46,23 @@ static inline void cpu_enter_lowpower(void)
void imx_cpu_die(unsigned int cpu)
{
cpu_enter_lowpower();
+ /*
+ * We use the cpu jumping argument register to sync with
+ * imx_cpu_kill() which is running on cpu0 and waiting for
+ * the register being cleared to kill the cpu.
+ */
+ imx_set_cpu_arg(cpu, ~0);
cpu_do_idle();
}
int imx_cpu_kill(unsigned int cpu)
{
+ unsigned long timeout = jiffies + msecs_to_jiffies(50);
+
+ while (imx_get_cpu_arg(cpu) == 0)
+ if (time_after(jiffies, timeout))
+ return 0;
imx_enable_cpu(cpu, false);
+ imx_set_cpu_arg(cpu, 0);
return 1;
}