[patch 09/34] arm64: Use generic idle loop

From: Thomas Gleixner
Date: Thu Mar 21 2013 - 18:01:29 EST


Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
---
arch/arm64/Kconfig | 1 +
arch/arm64/kernel/process.c | 43 +++++--------------------------------------
arch/arm64/kernel/smp.c | 2 +-
3 files changed, 7 insertions(+), 39 deletions(-)

Index: linux-2.6/arch/arm64/Kconfig
===================================================================
--- linux-2.6.orig/arch/arm64/Kconfig
+++ linux-2.6/arch/arm64/Kconfig
@@ -14,6 +14,7 @@ config ARM64
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select GENERIC_SMP_IDLE_THREAD
+ select GENERIC_IDLE_LOOP
select GENERIC_TIME_VSYSCALL
select HARDIRQS_SW_RESEND
select HAVE_ARCH_TRACEHOOK
Index: linux-2.6/arch/arm64/kernel/process.c
===================================================================
--- linux-2.6.orig/arch/arm64/kernel/process.c
+++ linux-2.6/arch/arm64/kernel/process.c
@@ -84,11 +84,15 @@ EXPORT_SYMBOL_GPL(pm_power_off);
void (*pm_restart)(const char *cmd);
EXPORT_SYMBOL_GPL(pm_restart);

+void arch_cpu_idle_prepare(void)
+{
+ local_fiq_enable();
+}

/*
* This is our default idle handler.
*/
-static void default_idle(void)
+void arch_cpu_idle(void)
{
/*
* This should do all the clock switching and wait for interrupt
@@ -98,43 +102,6 @@ static void default_idle(void)
local_irq_enable();
}

-/*
- * The idle thread.
- * We always respect 'hlt_counter' to prevent low power idle.
- */
-void cpu_idle(void)
-{
- local_fiq_enable();
-
- /* endless idle loop with no priority at all */
- while (1) {
- tick_nohz_idle_enter();
- rcu_idle_enter();
- while (!need_resched()) {
- /*
- * We need to disable interrupts here to ensure
- * we don't miss a wakeup call.
- */
- local_irq_disable();
- if (!need_resched()) {
- stop_critical_timings();
- default_idle();
- start_critical_timings();
- /*
- * default_idle functions should always return
- * with IRQs enabled.
- */
- WARN_ON(irqs_disabled());
- } else {
- local_irq_enable();
- }
- }
- rcu_idle_exit();
- tick_nohz_idle_exit();
- schedule_preempt_disabled();
- }
-}
-
void machine_shutdown(void)
{
#ifdef CONFIG_SMP
Index: linux-2.6/arch/arm64/kernel/smp.c
===================================================================
--- linux-2.6.orig/arch/arm64/kernel/smp.c
+++ linux-2.6/arch/arm64/kernel/smp.c
@@ -216,7 +216,7 @@ asmlinkage void __cpuinit secondary_star
/*
* OK, it's off to the idle thread for us
*/
- cpu_idle();
+ cpu_startup_entry(CPUHP_ONLINE);
}

void __init smp_cpus_done(unsigned int max_cpus)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/