alpha: Fix preemption handling in idle loop
authorFrederic Weisbecker <fweisbec@gmail.com>
Thu, 23 Aug 2012 12:11:25 +0000 (14:11 +0200)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Sun, 23 Sep 2012 14:44:42 +0000 (07:44 -0700)
cpu_idle() is called on the boot CPU by the init code with
preemption disabled. But the cpu_idle() function in alpha
doesn't handle this when it calls schedule() directly.

Fix it by converting it into schedule_preempt_disabled().

Also disable preemption before calling cpu_idle() from
secondary CPU entry code to stay consistent with this
state.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: Michael Cree <mcree@orcon.net.nz>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: alpha <linux-alpha@vger.kernel.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
arch/alpha/kernel/process.c
arch/alpha/kernel/smp.c

index d6fde98b74b38bf87aac592c2b9697c1bc925558..db56f31dbf707ca4f9a7deb708b8bf9c3de48cb6 100644 (file)
@@ -56,7 +56,8 @@ cpu_idle(void)
 
                while (!need_resched())
                        cpu_relax();
-               schedule();
+
+               schedule_preempt_disabled();
        }
 }
 
index 35ddc02bfa4a46312359d456e36c365816ecf2a3..a41ad90a97a692b039a2e8dbee2f57aa4b1a3300 100644 (file)
@@ -166,6 +166,7 @@ smp_callin(void)
        DBGS(("smp_callin: commencing CPU %d current %p active_mm %p\n",
              cpuid, current, current->active_mm));
 
+       preempt_disable();
        /* Do nothing.  */
        cpu_idle();
 }