Skip to contentSkip to conversation

pm_idle cleanup patch series

PATCH Superseded Len Brown 12 participants 46 messages Feb 10, 2013 – Mar 26, 2013

Subsystems (13)
Arm (32-bit) x86 ACPI arm64 +9 more subsystems
lore
Share & tools
lore
author reviewer
#1 lore raw

PATCH 1/16 APM idle: register apm_cpu_idle via cpuidle

In reply to Len Brown

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

---
 arch/x86/Kconfig          |  1 +
 arch/x86/kernel/apm_32.c  | 58 +++++++++++++++++++++++++++++------------------
 arch/x86/kernel/process.c |  3 ---
 3 files changed, 37 insertions(+), 25 deletions(-)
arch/x86/Kconfig +1 -0
index 225543b..1b63586 100644
@@ -1912,6 +1912,7 @@ config APM_DO_ENABLE
 	  this feature.
 
 config APM_CPU_IDLE
+	depends on CPU_IDLE
 	bool "Make CPU Idle calls when idle"
 	---help---
 	  Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.
arch/x86/kernel/apm_32.c +36 -22

124 lines not on this page · raw message

arch/x86/kernel/process.c +0 -3
index 2ed787f..f571a6e 100644
@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);
  * Powermanagement idle function, if any..
  */
 void (*pm_idle)(void);
-#ifdef CONFIG_APM_MODULE
-EXPORT_SYMBOL(pm_idle);
-#endif
 
 #ifndef CONFIG_SMP
 static inline void play_dead(void)
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#9 lore raw

PATCH 2/16 x86 idle: rename global pm_idle to static x86_idle

In reply to Len Brown

From: Len Brown <[email protected]>

(pm_idle)() is being removed from linux/pm.h
because Linux does not have such a cross-architecture concept.

x86 uses an idle function pointer in its architecture specific code as a backup to cpuidle. So we re-name x86 use of pm_idle to x86_idle, and make it static to x86.

---
 arch/x86/kernel/process.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
arch/x86/kernel/process.c +12 -16
index f571a6e..ceb05db 100644
@@ -268,10 +268,7 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
 unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
 EXPORT_SYMBOL(boot_option_idle_override);
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void);
+static void (*x86_idle)(void);
 
 #ifndef CONFIG_SMP
 static inline void play_dead(void)
@@ -348,7 +345,7 @@ void cpu_idle(void)
 			rcu_idle_enter();
 
 			if (cpuidle_idle_call())
-				pm_idle();
+				x86_idle();
 
 			rcu_idle_exit();
 			start_critical_timings();
@@ -395,9 +392,9 @@ EXPORT_SYMBOL(default_idle);
 
 bool set_pm_idle_to_default(void)
 {
-	bool ret = !!pm_idle;
+	bool ret = !!x86_idle;
 
-	pm_idle = default_idle;
+	x86_idle = default_idle;
 
 	return ret;
 }
@@ -564,11 +561,10 @@ static void amd_e400_idle(void)
 void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_SMP
-	if (pm_idle == poll_idle && smp_num_siblings > 1) {
+	if (x86_idle == poll_idle && smp_num_siblings > 1)
 		pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n");
-	}
 #endif
-	if (pm_idle)
+	if (x86_idle)
 		return;
 
 	if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
@@ -576,19 +572,19 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
 		 * One CPU supports mwait => All CPUs supports mwait
 		 */
 		pr_info("using mwait in idle threads\n");
-		pm_idle = mwait_idle;
+		x86_idle = mwait_idle;
 	} else if (cpu_has_amd_erratum(amd_erratum_400)) {
 		/* E400: APIC timer interrupt does not wake up CPU from C1e */
 		pr_info("using AMD E400 aware idle routine\n");
-		pm_idle = amd_e400_idle;
+		x86_idle = amd_e400_idle;
 	} else
-		pm_idle = default_idle;
+		x86_idle = default_idle;
 }
 
 void __init init_amd_e400_c1e_mask(void)
 {
 	/* If we're using amd_e400_idle, we need to allocate amd_e400_c1e_mask. */
-	if (pm_idle == amd_e400_idle)
+	if (x86_idle == amd_e400_idle)
 		zalloc_cpumask_var(&amd_e400_c1e_mask, GFP_KERNEL);
 }
 
@@ -599,7 +595,7 @@ static int __init idle_setup(char *str)
 
 	if (!strcmp(str, "poll")) {
 		pr_info("using polling idle threads\n");
-		pm_idle = poll_idle;
+		x86_idle = poll_idle;
 		boot_option_idle_override = IDLE_POLL;
 	} else if (!strcmp(str, "mwait")) {
 		boot_option_idle_override = IDLE_FORCE_MWAIT;
@@ -612,7 +608,7 @@ static int __init idle_setup(char *str)
 		 * To continue to load the CPU idle driver, don't touch
 		 * the boot_option_idle_override.
 		 */
-		pm_idle = default_idle;
+		x86_idle = default_idle;
 		boot_option_idle_override = IDLE_HALT;
 	} else if (!strcmp(str, "nomwait")) {
 		/*
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#10 lore raw

PATCH 3/16 sh idle: rename global pm_idle to static sh_idle

In reply to Len Brown

From: Len Brown <[email protected]>

SH idle code could use some simplification. This patch enables that by guaranteeing
that "sh_idle" is local, and thus architecture specific.

---
 arch/sh/kernel/idle.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/sh/kernel/idle.c +6 -6
index 0c91016..3d5a1b3 100644
@@ -22,7 +22,7 @@
 #include <asm/smp.h>
 #include <asm/bl_bit.h>
 
-void (*pm_idle)(void);
+static void (*sh_idle)(void);
 
 static int hlt_counter;
 
@@ -103,9 +103,9 @@ void cpu_idle(void)
 			/* Don't trace irqs off for idle */
 			stop_critical_timings();
 			if (cpuidle_idle_call())
-				pm_idle();
+				sh_idle();
 			/*
-			 * Sanity check to ensure that pm_idle() returns
+			 * Sanity check to ensure that sh_idle() returns
 			 * with IRQs enabled
 			 */
 			WARN_ON(irqs_disabled());
@@ -123,13 +123,13 @@ void __init select_idle_routine(void)
 	/*
 	 * If a platform has set its own idle routine, leave it alone.
 	 */
-	if (pm_idle)
+	if (sh_idle)
 		return;
 
 	if (hlt_works())
-		pm_idle = default_idle;
+		sh_idle = default_idle;
 	else
-		pm_idle = poll_idle;
+		sh_idle = poll_idle;
 }
 
 void stop_this_cpu(void *unused)
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#11 lore raw

PATCH 4/16 sparc idle: rename pm_idle to sparc_idle

In reply to Len Brown

From: Len Brown <[email protected]>

(pm_idle)() is being removed from linux/pm.h
because Linux does not have such a cross-architecture concept.

sparc uses an idle function pointer in its architecture specific code. So we re-name sparc use of pm_idle to sparc_idle.

Maybe some day, SPARC will cut over to cpuidle...

---
 arch/sparc/include/asm/processor.h | 1 +
 arch/sparc/kernel/apc.c            | 3 ++-
 arch/sparc/kernel/leon_pmc.c       | 5 +++--
 arch/sparc/kernel/pmc.c            | 3 ++-
 arch/sparc/kernel/process_32.c     | 7 +++----
 5 files changed, 11 insertions(+), 8 deletions(-)
arch/sparc/include/asm/processor.h +1 -0
index 2fe99e6..34baa35 100644
@@ -7,5 +7,6 @@
 #endif
 
 #define nop() 		__asm__ __volatile__ ("nop")
+extern void (*sparc_idle)(void);
 
 #endif
arch/sparc/kernel/apc.c +2 -1
index 348fa1a..eefda32 100644
@@ -20,6 +20,7 @@
 #include <asm/uaccess.h>
 #include <asm/auxio.h>
 #include <asm/apc.h>
+#include <asm/processor.h>
 
 /* Debugging
  * 
@@ -158,7 +159,7 @@ static int apc_probe(struct platform_device *op)
 
 	/* Assign power management IDLE handler */
 	if (!apc_no_idle)
-		pm_idle = apc_swift_idle;	
+		sparc_idle = apc_swift_idle;
 
 	printk(KERN_INFO "%s: power management initialized%s\n", 
 	       APC_DEVNAME, apc_no_idle ? " (CPU idle disabled)" : "");
arch/sparc/kernel/leon_pmc.c +3 -2
index 4e17432..708bca4 100644
@@ -9,6 +9,7 @@
 #include <asm/leon_amba.h>
 #include <asm/cpu_type.h>
 #include <asm/leon.h>
+#include <asm/processor.h>
 
 /* List of Systems that need fixup instructions around power-down instruction */
 unsigned int pmc_leon_fixup_ids[] = {
@@ -69,9 +70,9 @@ static int __init leon_pmc_install(void)
 	if (sparc_cpu_model = sparc_leon) {
 		/* Assign power management IDLE handler */
 		if (pmc_leon_need_fixup())
-			pm_idle = pmc_leon_idle_fixup;
+			sparc_idle = pmc_leon_idle_fixup;
 		else
-			pm_idle = pmc_leon_idle;
+			sparc_idle = pmc_leon_idle;
 
 		printk(KERN_INFO "leon: power management initialized\n");
 	}
arch/sparc/kernel/pmc.c +2 -1
index dcbb62f..8b7297f 100644
@@ -17,6 +17,7 @@
 #include <asm/oplib.h>
 #include <asm/uaccess.h>
 #include <asm/auxio.h>
+#include <asm/processor.h>
 
 /* Debug
  *
@@ -63,7 +64,7 @@ static int pmc_probe(struct platform_device *op)
 
 #ifndef PMC_NO_IDLE
 	/* Assign power management IDLE handler */
-	pm_idle = pmc_swift_idle;
+	sparc_idle = pmc_swift_idle;
 #endif
 
 	printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME);
arch/sparc/kernel/process_32.c +3 -4
index be8e862..62eede1 100644
@@ -43,8 +43,7 @@
  * Power management idle function 
  * Set in pm platform drivers (apc.c and pmc.c)
  */
-void (*pm_idle)(void);
-EXPORT_SYMBOL(pm_idle);
+void (*sparc_idle)(void);
 
 /* 
  * Power-off handler instantiation for pm.h compliance
@@ -75,8 +74,8 @@ void cpu_idle(void)
 	/* endless idle loop with no priority at all */
 	for (;;) {
 		while (!need_resched()) {
-			if (pm_idle)
-				(*pm_idle)();
+			if (sparc_idle)
+				(*sparc_idle)();
 			else
 				cpu_relax();
 		}
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#13 lore raw

PATCH 5/16 blackfin idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -7
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;
 
 #ifdef CONFIG_HOTPLUG_CPU
 		if (cpu_is_offline(smp_processor_id()))
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#23 lore raw

PATCH 6/16 ARM idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle() on ARM was a synonym for default_idle(), so simply invoke default_idle() directly.

Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/kernel/process.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
arch/arm/kernel/process.c +4 -9
index c6dec5f..047d3e4 100644
@@ -172,14 +172,9 @@ static void default_idle(void)
 	local_irq_enable();
 }
 
-void (*pm_idle)(void) = default_idle;
-EXPORT_SYMBOL(pm_idle);
-
 /*
- * The idle thread, has rather strange semantics for calling pm_idle,
- * but this is what x86 does and we need to do the same, so that
- * things like cpuidle get called in the same way.  The only difference
- * is that we always respect 'hlt_counter' to prevent low power idle.
+ * The idle thread.
+ * We always respect 'hlt_counter' to prevent low power idle.
  */
 void cpu_idle(void)
 {
@@ -210,10 +205,10 @@ void cpu_idle(void)
 			} else if (!need_resched()) {
 				stop_critical_timings();
 				if (cpuidle_idle_call())
-					pm_idle();
+					default_idle();
 				start_critical_timings();
 				/*
-				 * pm_idle functions must always
+				 * default_idle functions must always
 				 * return with IRQs enabled.
 				 */
 				WARN_ON(irqs_disabled());
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#28 lore raw

PATCH 7/16 ARM64 idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle() on arm64 was a synonym for default_idle(), so remove it and invoke default_idle() directly.

Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm64/kernel/process.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
arch/arm64/kernel/process.c +4 -9
index cb0956b..c7002d4 100644
@@ -97,14 +97,9 @@ static void default_idle(void)
 	local_irq_enable();
 }
 
-void (*pm_idle)(void) = default_idle;
-EXPORT_SYMBOL_GPL(pm_idle);
-
 /*
- * The idle thread, has rather strange semantics for calling pm_idle,
- * but this is what x86 does and we need to do the same, so that
- * things like cpuidle get called in the same way.  The only difference
- * is that we always respect 'hlt_counter' to prevent low power idle.
+ * The idle thread.
+ * We always respect 'hlt_counter' to prevent low power idle.
  */
 void cpu_idle(void)
 {
@@ -122,10 +117,10 @@ void cpu_idle(void)
 			local_irq_disable();
 			if (!need_resched()) {
 				stop_critical_timings();
-				pm_idle();
+				default_idle();
 				start_critical_timings();
 				/*
-				 * pm_idle functions should always return
+				 * default_idle functions should always return
 				 * with IRQs enabled.
 				 */
 				WARN_ON(irqs_disabled());
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#30 lore raw

PATCH 8/16 cris idle: delete idle and pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle() and idle() served no purpose on cris --
invoke default_idle() directly.

---
 arch/cris/kernel/process.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
arch/cris/kernel/process.c +1 -10
index 7f65be6..104ff4d 100644
@@ -54,11 +54,6 @@ void enable_hlt(void)
 
 EXPORT_SYMBOL(enable_hlt);
  
-/*
- * The following aren't currently used.
- */
-void (*pm_idle)(void);
-
 extern void default_idle(void);
 
 void (*pm_power_off)(void);
@@ -77,16 +72,12 @@ void cpu_idle (void)
 	while (1) {
 		rcu_idle_enter();
 		while (!need_resched()) {
-			void (*idle)(void);
 			/*
 			 * Mark this as an RCU critical section so that
 			 * synchronize_kernel() in the unload path waits
 			 * for our completion.
 			 */
-			idle = pm_idle;
-			if (!idle)
-				idle = default_idle;
-			idle();
+			default_idle();
 		}
 		rcu_idle_exit();
 		schedule_preempt_disabled();
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#32 lore raw

PATCH 9/16 ia64 idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle() on ia64 was a synonym for default_idle(). So simply invoke default_idle() directly.

---
 arch/ia64/kernel/process.c | 3 ---
 arch/ia64/kernel/setup.c   | 1 -
 2 files changed, 4 deletions(-)
arch/ia64/kernel/process.c +0 -3
index 31360cb..e34f565 100644
@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
 
 unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
 EXPORT_SYMBOL(boot_option_idle_override);
-void (*pm_idle) (void);
-EXPORT_SYMBOL(pm_idle);
 void (*pm_power_off) (void);
 EXPORT_SYMBOL(pm_power_off);
 
@@ -301,7 +299,6 @@ cpu_idle (void)
 			if (mark_idle)
 				(*mark_idle)(1);
 
-			idle = pm_idle;
 			if (!idle)
 				idle = default_idle;
 			(*idle)();
arch/ia64/kernel/setup.c +0 -1
index aaefd9b..2029cc0 100644
@@ -1051,7 +1051,6 @@ cpu_init (void)
 		max_num_phys_stacked = num_phys_stacked;
 	}
 	platform_cpu_init();
-	pm_idle = default_idle;
 }
 
 void __init
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#36 lore raw

PATCH 10/16 m32r idle: delete pm_idle, and other dead idle code

In reply to Len Brown

From: Len Brown <[email protected]>

All paths on m32r lead to cpu_relax().
So delete the dead code and simply call cpu_relax() directly.

---
 arch/m32r/kernel/process.c | 51 ++--------------------------------------------
 1 file changed, 2 insertions(+), 49 deletions(-)
arch/m32r/kernel/process.c +2 -49
index 765d0f5..bde899e 100644
@@ -44,36 +44,10 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
 	return tsk->thread.lr;
 }
 
-/*
- * Powermanagement idle function, if any..
- */
-static void (*pm_idle)(void) = NULL;
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
 /*
- * We use this is we don't have any better
- * idle routine..
- */
-static void default_idle(void)
-{
-	/* M32R_FIXME: Please use "cpu_sleep" mode.  */
-	cpu_relax();
-}
-
-/*
- * On SMP it's slightly faster (but much more power-consuming!)
- * to poll the ->work.need_resched flag instead of waiting for the
- * cross-CPU IPI to arrive. Use this option with caution.
- */
-static void poll_idle (void)
-{
-	/* M32R_FIXME */
-	cpu_relax();
-}
-
-/*
  * The idle thread. There's no useful work to be
  * done, so just try to conserve power and have a
  * low exit latency (ie sit in a loop waiting for
@@ -84,14 +58,8 @@ void cpu_idle (void)
 	/* endless idle loop with no priority at all */
 	while (1) {
 		rcu_idle_enter();
-		while (!need_resched()) {
-			void (*idle)(void) = pm_idle;
-
-			if (!idle)
-				idle = default_idle;
-
-			idle();
-		}
+		while (!need_resched())
+			cpu_relax();
 		rcu_idle_exit();
 		schedule_preempt_disabled();
 	}
@@ -120,21 +88,6 @@ void machine_power_off(void)
 	/* M32R_FIXME */
 }
 
-static int __init idle_setup (char *str)
-{
-	if (!strncmp(str, "poll", 4)) {
-		printk("using poll in idle threads.\n");
-		pm_idle = poll_idle;
-	} else if (!strncmp(str, "sleep", 4)) {
-		printk("using sleep in idle threads.\n");
-		pm_idle = default_idle;
-	}
-
-	return 1;
-}
-
-__setup("idle=", idle_setup);
-
 void show_regs(struct pt_regs * regs)
 {
 	printk("\n");
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#37 lore raw

PATCH 11/16 microblaze idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle on microblaze served no purpose.

---
 arch/microblaze/kernel/process.c | 3 ---
 1 file changed, 3 deletions(-)
arch/microblaze/kernel/process.c +0 -3
index a5b74f7..6ff2dcf 100644
@@ -41,7 +41,6 @@ void show_regs(struct pt_regs *regs)
 				regs->msr, regs->ear, regs->esr, regs->fsr);
 }
 
-void (*pm_idle)(void);
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
@@ -98,8 +97,6 @@ void cpu_idle(void)
 
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;
-
 		if (!idle)
 			idle = default_idle;
 
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#40 lore raw

PATCH 12/16 mn10300 idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle on mn10300 served no purpose.

---
 arch/mn10300/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/mn10300/kernel/process.c +0 -7
index eb09f5a..84f4e97 100644
@@ -37,12 +37,6 @@
 #include "internal.h"
 
 /*
- * power management idle function, if any..
- */
-void (*pm_idle)(void);
-EXPORT_SYMBOL(pm_idle);
-
-/*
  * return saved PC of a blocked thread.
  */
 unsigned long thread_saved_pc(struct task_struct *tsk)
@@ -113,7 +107,6 @@ void cpu_idle(void)
 			void (*idle)(void);
 
 			smp_rmb();
-			idle = pm_idle;
 			if (!idle) {
 #if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU)
 				idle = poll_idle;
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#41 lore raw

PATCH 13/16 openrisc idle: delete pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle() on openrisc was dead code.

---
 arch/openrisc/kernel/idle.c | 5 -----
 1 file changed, 5 deletions(-)
arch/openrisc/kernel/idle.c +0 -5
index 7d618fe..5e8a3b6 100644
@@ -39,11 +39,6 @@
 
 void (*powersave) (void) = NULL;
 
-static inline void pm_idle(void)
-{
-	barrier();
-}
-
 void cpu_idle(void)
 {
 	set_thread_flag(TIF_POLLING_NRFLAG);
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#44 lore raw

PATCH 15/16 PM idle: remove global declaration of pm_idle

In reply to Len Brown

From: Len Brown <[email protected]>

pm_idle appears in no generic Linux code,
it appears only in architecture-specific code.

Thus, pm_idle should not be declared in pm.h.

Architectures that use an idle function pointer
should delcare one local to their architecture,
and/or use cpuidle.

---
 include/linux/pm.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/pm.h +0 -1
index 03d7bb1..97bcf23 100644
@@ -31,7 +31,6 @@
 /*
  * Callbacks for platform drivers to implement.
  */
-extern void (*pm_idle)(void);
 extern void (*pm_power_off)(void);
 extern void (*pm_power_off_prepare)(void);
 
Signature · 1 line
1.8.1.3.535.ga923c31
author reviewer
#45 lore raw

PATCH 16/16 xen idle: make xen-specific macro xen-specific

In reply to Len Brown

From: Len Brown <[email protected]>

This macro is only invoked by Xen,
so make its definition specific to Xen.

Quoted 1 line

set_pm_idle_to_default()

< xen_set_default_idle()

---
 arch/x86/include/asm/processor.h | 6 +++++-
 arch/x86/kernel/process.c        | 4 +++-
 arch/x86/xen/setup.c             | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/include/asm/processor.h +5 -1
index 888184b..c2f7f47 100644
@@ -998,7 +998,11 @@ extern unsigned long arch_align_stack(unsigned long sp);
 extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
 
 void default_idle(void);
-bool set_pm_idle_to_default(void);
+#ifdef	CONFIG_XEN
+bool xen_set_default_idle(void);
+#else
+#define xen_set_default_idle 0
+#endif
 
 void stop_this_cpu(void *dummy);
 
arch/x86/kernel/process.c +3 -1
index ceb05db..b86de21 100644
@@ -390,7 +390,8 @@ void default_idle(void)
 EXPORT_SYMBOL(default_idle);
 #endif
 
-bool set_pm_idle_to_default(void)
+#ifdef CONFIG_XEN
+bool xen_set_default_idle(void)
 {
 	bool ret = !!x86_idle;
 
@@ -398,6 +399,7 @@ bool set_pm_idle_to_default(void)
 
 	return ret;
 }
+#endif
 void stop_this_cpu(void *dummy)
 {
 	local_irq_disable();
arch/x86/xen/setup.c +1 -1
index 8971a26..2b73b5c 100644
@@ -561,7 +561,7 @@ void __init xen_arch_setup(void)
 #endif
 	disable_cpuidle();
 	disable_cpufreq();
-	WARN_ON(set_pm_idle_to_default());
+	WARN_ON(xen_set_default_idle());
 	fiddle_vdso();
 #ifdef CONFIG_NUMA
 	numa_off = 1;
Signature · 1 line
1.8.1.3.535.ga923c31

Len Brown

author reviewer
#0 lore raw

Use of (pm_idle)() spread from x86 to a number of architectures. Some used it like x86, but most copied it for no functional reason.

There is no Linux architecture-independent code that mandates that an architecture supply a pm_idle().
So we delete it from pm.h and we either remove it or re-name it to be private to each architecture.

It is a safe bet that I fat-fingered something in this series. Please send me an Ack if you can build/test or I broke your favorite machine.

In particular, for those with computer museums,
I'd like help testing the APM patch, which is
compile-tested only.

thanks,
Len Brown, Intel Open Source Technology Center

author reviewer
#43 lore raw

PATCH 14/16 unicore32 idle: delete stray pm_idle comment

From: Len Brown <[email protected]>

as pm_idle() has already been deleted from this code, the comment was a stray.

---
 arch/unicore32/kernel/process.c | 5 -----
 1 file changed, 5 deletions(-)
arch/unicore32/kernel/process.c +0 -5
index 62bad9f..872d7e2 100644
@@ -45,11 +45,6 @@ static const char * const processor_modes[] = {
 	"UK18", "UK19", "UK1A", "EXTN", "UK1C", "UK1D", "UK1E", "SUSR"
 };
 
-/*
- * The idle thread, has rather strange semantics for calling pm_idle,
- * but this is what x86 does and we need to do the same, so that
- * things like cpuidle get called in the same way.
- */
 void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
Signature · 1 line
1.8.1.3.535.ga923c31
maintainer
#42 lore raw

Re: [ORLinux] [PATCH 13/16] openrisc idle: delete pm_idle

In reply to Len Brown
Quoted 9 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle() on openrisc was dead code.

---
  arch/openrisc/kernel/idle.c | 5 -----
  1 file changed, 5 deletions(-)

Thanks, Len. Will apply.
/Jonas

Quoted 16 lines
arch/openrisc/kernel/idle.c +0 -5
index 7d618fe..5e8a3b6 100644
@@ -39,11 +39,6 @@
 
  void (*powersave) (void) = NULL;
 
-static inline void pm_idle(void)
-{
-	barrier();
-}
-
  void cpu_idle(void)
  {
  	set_thread_flag(TIF_POLLING_NRFLAG);
maintainer Acked-by on v1 4/16
#12 lore raw

Re: [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle

In reply to Len Brown

From: Len Brown <[email protected]>
Date: Sun, 10 Feb 2013 00:58:11 -0500

Quoted 11 lines

From: Len Brown <[email protected]>

(pm_idle)() is being removed from linux/pm.h
because Linux does not have such a cross-architecture concept.

sparc uses an idle function pointer in its architecture specific code. So we re-name sparc use of pm_idle to sparc_idle.

Maybe some day, SPARC will cut over to cpuidle...

Acked-by on v1 8/16
#31 lore raw

Re: [PATCH 08/16] cris idle: delete idle and pm_idle

In reply to Len Brown
Quoted 7 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle() and idle() served no purpose on cris --
invoke default_idle() directly.

Looks good!

Quoted 40 lines
---
 arch/cris/kernel/process.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
arch/cris/kernel/process.c +1 -10
index 7f65be6..104ff4d 100644
@@ -54,11 +54,6 @@ void enable_hlt(void)
 
 EXPORT_SYMBOL(enable_hlt);
 
-/*
- * The following aren't currently used.
- */
-void (*pm_idle)(void);
-
 extern void default_idle(void);
 
 void (*pm_power_off)(void);
@@ -77,16 +72,12 @@ void cpu_idle (void)
 	while (1) {
 		rcu_idle_enter();
 		while (!need_resched()) {
-			void (*idle)(void);
 			/*
 			 * Mark this as an RCU critical section so that
 			 * synchronize_kernel() in the unload path waits
 			 * for our completion.
 			 */
-			idle = pm_idle;
-			if (!idle)
-				idle = default_idle;
-			idle();
+			default_idle();
 		}
 		rcu_idle_exit();
 		schedule_preempt_disabled();
Signature · 1 line
1.8.1.3.535.ga923c31

/^JN - Jesper Nilsson

Signature · 1 line
               Jesper Nilsson -- [email protected]
#2 lore raw

Re: [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle

In reply to Len Brown
Quoted 13 lines · Len Brown

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

---

[ ... ]

Quoted 14 lines
arch/x86/kernel/apm_32.c +13 -0
+static int apm_cpu_idle(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv, int index);
+
+static struct cpuidle_driver apm_idle_driver = {
+	.name = "apm_idle",
+	.owner = THIS_MODULE,
+	.en_core_tk_irqen = 1,
+	.states = {
+		{ /* entry 0 is for polling */ },
+		{ /* entry 1 is for APM idle */
+			.name = "APM",
+			.desc = "APM idle",
+			.flags = CPUIDLE_FLAG_TIME_VALID,

arch/x86/kernel/apm_32.c struct apm_user { · line 392

Quoted 10 lines
arch/x86/kernel/apm_32.c +10 -0
+			.exit_latency = 250,	/* WAG */
+			.target_residency = 500,	/* WAG */
+			.enter = &apm_cpu_idle
+		},
+	},
+};
+
+static struct cpuidle_device apm_cpuidle_device = {
+	.state_count = 2,
+};

This will make the cpuidle_register_driver to fail because the state_count field of the cpuidle_driver is zero, no ?

static struct cpuidle_driver apm_idle_driver = {
	.name = "apm_idle",
	...
	.states = {
	...
	},
	.state_count = 2,
}

static struct cpuidle_device apm_cpuidle_device;

Quoted 51 lines

/*
* Local variables
*/

arch/x86/kernel/apm_32.c +3 -9
@@ -377,7 +402,6 @@ static struct {
 static int clock_slowed;
 static int idle_threshold __read_mostly = DEFAULT_IDLE_THRESHOLD;
 static int idle_period __read_mostly = DEFAULT_IDLE_PERIOD;
-static int set_pm_idle;
 static int suspends_pending;
 static int standbys_pending;
 static int ignore_sys_suspend;
@@ -884,8 +908,6 @@ static void apm_do_busy(void)
 #define IDLE_CALC_LIMIT	(HZ * 100)
 #define IDLE_LEAKY_MAX	16
 
-static void (*original_pm_idle)(void) __read_mostly;
-
 /**
  * apm_cpu_idle		-	cpu idling for APM capable Linux
  *
@@ -894,7 +916,8 @@ static void (*original_pm_idle)(void) __read_mostly;
  * Furthermore it calls the system default idle routine.
  */
 
-static void apm_cpu_idle(void)
+static int apm_cpu_idle(struct cpuidle_device *dev,
+	struct cpuidle_driver *drv, int index)
 {
 	static int use_apm_idle; /* = 0 */
 	static unsigned int last_jiffies; /* = 0 */
@@ -904,7 +927,6 @@ static void apm_cpu_idle(void)
 	unsigned int jiffies_since_last_check = jiffies - last_jiffies;
 	unsigned int bucket;
 
-	WARN_ONCE(1, "deprecated apm_cpu_idle will be deleted in 2012");
 recalc:
 	if (jiffies_since_last_check > IDLE_CALC_LIMIT) {
 		use_apm_idle = 0;
@@ -950,10 +972,7 @@ recalc:
 				break;
 			}
 		}
-		if (original_pm_idle)
-			original_pm_idle();
-		else
-			default_idle();
+		default_idle();
 		local_irq_disable();
 		jiffies_since_last_check = jiffies - last_jiffies;
 		if (jiffies_since_last_check > idle_period)

arch/x86/kernel/apm_32.c recalc: · line 985

Quoted 3 lines
arch/x86/kernel/apm_32.c +0 -0
@@ -964,6 +983,7 @@ recalc:
 		apm_do_busy();
 
 	local_irq_enable();
           ^^^^^^^^

As the 'en_core_tk_irqen' flag has been enabled in the driver, the caller of this function will call 'local_irq_enable'. We can remove the this line no ?

Quoted 51 lines
arch/x86/kernel/apm_32.c +7 -12
+	return index;
 }
 
 /**
@@ -2381,9 +2401,9 @@ static int __init apm_init(void)
 	if (HZ != 100)
 		idle_period = (idle_period * HZ) / 100;
 	if (idle_threshold < 100) {
-		original_pm_idle = pm_idle;
-		pm_idle  = apm_cpu_idle;
-		set_pm_idle = 1;
+		if (!cpuidle_register_driver(&apm_idle_driver))
+			if (cpuidle_register_device(&apm_cpuidle_device))
+				cpuidle_unregister_driver(&apm_idle_driver);
 	}
 
 	return 0;
@@ -2393,15 +2413,9 @@ static void __exit apm_exit(void)
 {
 	int error;
 
-	if (set_pm_idle) {
-		pm_idle = original_pm_idle;
-		/*
-		 * We are about to unload the current idle thread pm callback
-		 * (pm_idle), Wait for all processors to update cached/local
-		 * copies of pm_idle before proceeding.
-		 */
-		kick_all_cpus_sync();
-	}
+	cpuidle_unregister_device(&apm_cpuidle_device);
+	cpuidle_unregister_driver(&apm_idle_driver);
+
 	if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0)
 	    && (apm_info.connection_version > 0x0100)) {
 		error = apm_engage_power_management(APM_DEVICE_ALL, 0);
arch/x86/kernel/process.c +0 -3
index 2ed787f..f571a6e 100644
@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);
  * Powermanagement idle function, if any..
  */
 void (*pm_idle)(void);
-#ifdef CONFIG_APM_MODULE
-EXPORT_SYMBOL(pm_idle);
-#endif
 
 #ifndef CONFIG_SMP
 static inline void play_dead(void)
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
maintainer
#24 lore raw

Re: [PATCH 06/16] ARM idle: delete pm_idle

In reply to Len Brown
Quoted 2 lines · Len Brown

pm_idle() on ARM was a synonym for default_idle(), so simply invoke default_idle() directly.

The clean-up looks fine as we already have an arm_pm_idle but longer term I was thinking about having a common declaration similar to pm_power_off that code under drivers/power/(reset/) can override (and such driver may be shared by multiple architectures). OTOH, if you get rid of the generic linux/pm.h declaration architectures can use a common pm_idle name and type (though I think having it in the common header would be better). For ARM this would mean s/arm_pm_idle/pm_idle/ on top if your patch.

Do you have any plans with pm_power_off as well?

Thanks.

Signature · 1 line
Catalin
#25 lore raw

Re: [PATCH 06/16] ARM idle: delete pm_idle

Quoted 4 lines · Catalin Marinas
Quoted 2 lines · Len Brown

pm_idle() on ARM was a synonym for default_idle(), so simply invoke default_idle() directly.

Quoted 8 lines

The clean-up looks fine as we already have an arm_pm_idle but longer term I was thinking about having a common declaration similar to pm_power_off that code under drivers/power/(reset/) can override (and such driver may be shared by multiple architectures). OTOH, if you get rid of the generic linux/pm.h declaration architectures can use a common pm_idle name and type (though I think having it in the common header would be better). For ARM this would mean s/arm_pm_idle/pm_idle/ on top if your patch.

pm_idle() was that common declaration - but it had the side effect that it was defined to be called with interrupts disabled, but return with interrupts enabled.

arm_pm_idle() "fixed" that weirdness such that it's now expected to return with IRQs in the same state that it was called.

pm_power_off() is a cross-arch hook already.

author reviewer
#26 lore raw

Re: [PATCH 06/16] ARM idle: delete pm_idle

Quoted 14 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
Quoted 2 lines · Len Brown

pm_idle() on ARM was a synonym for default_idle(), so simply invoke default_idle() directly.

Quoted 8 lines

The clean-up looks fine as we already have an arm_pm_idle but longer term I was thinking about having a common declaration similar to pm_power_off that code under drivers/power/(reset/) can override (and such driver may be shared by multiple architectures). OTOH, if you get rid of the generic linux/pm.h declaration architectures can use a common pm_idle name and type (though I think having it in the common header would be better). For ARM this would mean s/arm_pm_idle/pm_idle/ on top if your patch.

Quoted 3 lines

pm_idle() was that common declaration - but it had the side effect that it was defined to be called with interrupts disabled, but return with interrupts enabled.

Yeah, I expect that grew out of the x86 idiom "STI;HLT", which dictated default_idle(), which in-turn dictated pm_idle(). x86's MWAIT instruction now has more flexibility WRT interrupts, but the cast was already set...

Please let me know if you Ack the patch as is,
or would like it changed.

thanks,
-Len Brown, Intel Open Source Technology Center

Quoted 5 lines

arm_pm_idle() "fixed" that weirdness such that it's now expected to return with IRQs in the same state that it was called.

pm_power_off() is a cross-arch hook already.

author reviewer
#3 lore raw

Re: [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle

In reply to Daniel Lezcano
Quoted 23 lines · Daniel Lezcano
Quoted 15 lines · Len Brown

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

---

arch/x86/kernel/apm_32.c struct apm_user { · line 392

Quoted 3 lines
arch/x86/kernel/apm_32.c +3 -0
+static struct cpuidle_device apm_cpuidle_device = {
+	.state_count = 2,
+};

This will make the cpuidle_register_driver to fail because the state_count field of the cpuidle_driver is zero, no ?

Quoted 8 lines
static struct cpuidle_driver apm_idle_driver = {
	.name = "apm_idle",
	...
	.states = {
	...
	},
	.state_count = 2,
}

yup, good catch.

Quoted 6 lines
Quoted 6 lines
arch/x86/kernel/apm_32.c +2 -1
-static void apm_cpu_idle(void)
+static int apm_cpu_idle(struct cpuidle_device *dev,
+	struct cpuidle_driver *drv, int index)
 {
 	static int use_apm_idle; /* = 0 */
 	static unsigned int last_jiffies; /* = 0 */

...

Quoted 10 lines

arch/x86/kernel/apm_32.c recalc: · line 985

Quoted 4 lines
arch/x86/kernel/apm_32.c +0 -0
@@ -964,6 +983,7 @@ recalc:
 		apm_do_busy();
 
 	local_irq_enable();
           ^^^^^^^^

As the 'en_core_tk_irqen' flag has been enabled in the driver, the caller of this function will call 'local_irq_enable'. We can remove the this line no ?

yup, this line is no longer necessary.

v2 on the way -- hoping somebody with an APM box can test it.

thanks,
-Len Brown, Intel Open Source Technology Center

author reviewer
#4 lore raw

APM: Request to Test

In reply to Daniel Lezcano

Thanks, Daniel, for reviewing the patch -- never would have worked... Here is v2.

Is there anybody out there with an APM box that can run an upstream kernel with this patch in it?

thanks,
-Len

author reviewer
#5 lore raw

PATCH v2 1/1 APM idle: register apm_cpu_idle via cpuidle

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

---
v2: updates from Daniel Lezcano's review

---
 arch/x86/Kconfig          |  1 +
 arch/x86/kernel/apm_32.c  | 60 +++++++++++++++++++++++++++++------------------
 arch/x86/kernel/process.c |  3 ---
 3 files changed, 38 insertions(+), 26 deletions(-)
arch/x86/Kconfig +1 -0
index 225543b..1b63586 100644
@@ -1912,6 +1912,7 @@ config APM_DO_ENABLE
 	  this feature.
 
 config APM_CPU_IDLE
+	depends on CPU_IDLE
 	bool "Make CPU Idle calls when idle"
 	---help---
 	  Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.
arch/x86/kernel/apm_32.c +37 -23

126 lines not on this page · raw message

arch/x86/kernel/process.c +0 -3
index 2ed787f..f571a6e 100644
@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);
  * Powermanagement idle function, if any..
  */
 void (*pm_idle)(void);
-#ifdef CONFIG_APM_MODULE
-EXPORT_SYMBOL(pm_idle);
-#endif
 
 #ifndef CONFIG_SMP
 static inline void play_dead(void)
Signature · 1 line
1.8.1.3.535.ga923c31
Reviewed-by on v2 1/1
#6 lore raw

Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle

In reply to Len Brown
Quoted 69 lines · Len Brown

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

---
v2: updates from Daniel Lezcano's review

---
 arch/x86/Kconfig          |  1 +
 arch/x86/kernel/apm_32.c  | 60 +++++++++++++++++++++++++++++------------------
 arch/x86/kernel/process.c |  3 ---
 3 files changed, 38 insertions(+), 26 deletions(-)
arch/x86/Kconfig +1 -0
index 225543b..1b63586 100644
@@ -1912,6 +1912,7 @@ config APM_DO_ENABLE
 	  this feature.
 
 config APM_CPU_IDLE
+	depends on CPU_IDLE
 	bool "Make CPU Idle calls when idle"
 	---help---
 	  Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.
arch/x86/kernel/apm_32.c +15 -1
index d65464e..f9f8afc 100644
@@ -232,6 +232,7 @@
 #include <linux/acpi.h>
 #include <linux/syscore_ops.h>
 #include <linux/i8253.h>
+#include <linux/cpuidle.h>
 
 #include <asm/uaccess.h>
 #include <asm/desc.h>
@@ -360,13 +361,38 @@ struct apm_user {
  * idle percentage above which bios idle calls are done
  */
 #ifdef CONFIG_APM_CPU_IDLE
-#warning deprecated CONFIG_APM_CPU_IDLE will be deleted in 2012
 #define DEFAULT_IDLE_THRESHOLD	95
 #else
 #define DEFAULT_IDLE_THRESHOLD	100
 #endif
 #define DEFAULT_IDLE_PERIOD	(100 / 3)
 
+static int apm_cpu_idle(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv, int index);
+
+static struct cpuidle_driver apm_idle_driver = {
+	.name = "apm_idle",
+	.owner = THIS_MODULE,
+	.en_core_tk_irqen = 1,
+	.states = {
+		{ /* entry 0 is for polling */ },
+		{ /* entry 1 is for APM idle */
+			.name = "APM",
+			.desc = "APM idle",
+			.flags = CPUIDLE_FLAG_TIME_VALID,
+			.exit_latency = 250,	/* WAG */

arch/x86/kernel/apm_32.c struct apm_user { · line 393

Quoted 10 lines
arch/x86/kernel/apm_32.c +10 -0
+			.target_residency = 500,	/* WAG */
+			.enter = &apm_cpu_idle
+		},
+	},
+	.state_count = 2,
+};
+
+static struct cpuidle_device apm_cpuidle_device = {
+	.state_count = 2,
+};

Actually this initialization is not needed because when it is set to zero, the cpuidle_enable_device function will set it for us from the driver's state_count.

int cpuidle_enable_device(struct cpuidle_device *dev)

{
	...
	if (!dev->state_count)
                dev->state_count = drv->state_count;
}

It is useful to set a value when it differs from the driver's one.

Otherwise :

Quoted 106 lines
arch/x86/kernel/apm_32.c +10 -22
 /*
  * Local variables
  */
@@ -377,7 +403,6 @@ static struct {
 static int clock_slowed;
 static int idle_threshold __read_mostly = DEFAULT_IDLE_THRESHOLD;
 static int idle_period __read_mostly = DEFAULT_IDLE_PERIOD;
-static int set_pm_idle;
 static int suspends_pending;
 static int standbys_pending;
 static int ignore_sys_suspend;
@@ -884,8 +909,6 @@ static void apm_do_busy(void)
 #define IDLE_CALC_LIMIT	(HZ * 100)
 #define IDLE_LEAKY_MAX	16
 
-static void (*original_pm_idle)(void) __read_mostly;
-
 /**
  * apm_cpu_idle		-	cpu idling for APM capable Linux
  *
@@ -894,7 +917,8 @@ static void (*original_pm_idle)(void) __read_mostly;
  * Furthermore it calls the system default idle routine.
  */
 
-static void apm_cpu_idle(void)
+static int apm_cpu_idle(struct cpuidle_device *dev,
+	struct cpuidle_driver *drv, int index)
 {
 	static int use_apm_idle; /* = 0 */
 	static unsigned int last_jiffies; /* = 0 */
@@ -904,7 +928,6 @@ static void apm_cpu_idle(void)
 	unsigned int jiffies_since_last_check = jiffies - last_jiffies;
 	unsigned int bucket;
 
-	WARN_ONCE(1, "deprecated apm_cpu_idle will be deleted in 2012");
 recalc:
 	if (jiffies_since_last_check > IDLE_CALC_LIMIT) {
 		use_apm_idle = 0;
@@ -950,10 +973,7 @@ recalc:
 				break;
 			}
 		}
-		if (original_pm_idle)
-			original_pm_idle();
-		else
-			default_idle();
+		default_idle();
 		local_irq_disable();
 		jiffies_since_last_check = jiffies - last_jiffies;
 		if (jiffies_since_last_check > idle_period)
@@ -963,7 +983,7 @@ recalc:
 	if (apm_idle_done)
 		apm_do_busy();
 
-	local_irq_enable();
+	return index;
 }
 
 /**
@@ -2381,9 +2401,9 @@ static int __init apm_init(void)
 	if (HZ != 100)
 		idle_period = (idle_period * HZ) / 100;
 	if (idle_threshold < 100) {
-		original_pm_idle = pm_idle;
-		pm_idle  = apm_cpu_idle;
-		set_pm_idle = 1;
+		if (!cpuidle_register_driver(&apm_idle_driver))
+			if (cpuidle_register_device(&apm_cpuidle_device))
+				cpuidle_unregister_driver(&apm_idle_driver);
 	}
 
 	return 0;
@@ -2393,15 +2413,9 @@ static void __exit apm_exit(void)
 {
 	int error;
 
-	if (set_pm_idle) {
-		pm_idle = original_pm_idle;
-		/*
-		 * We are about to unload the current idle thread pm callback
-		 * (pm_idle), Wait for all processors to update cached/local
-		 * copies of pm_idle before proceeding.
-		 */
-		kick_all_cpus_sync();
-	}
+	cpuidle_unregister_device(&apm_cpuidle_device);
+	cpuidle_unregister_driver(&apm_idle_driver);
+
 	if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0)
 	    && (apm_info.connection_version > 0x0100)) {
 		error = apm_engage_power_management(APM_DEVICE_ALL, 0);
arch/x86/kernel/process.c +0 -3
index 2ed787f..f571a6e 100644
@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);
  * Powermanagement idle function, if any..
  */
 void (*pm_idle)(void);
-#ifdef CONFIG_APM_MODULE
-EXPORT_SYMBOL(pm_idle);
-#endif
 
 #ifndef CONFIG_SMP
 static inline void play_dead(void)
Signature · 10 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by Tested-by on v1 6/16
#27 lore raw

Re: [PATCH 06/16] ARM idle: delete pm_idle

In reply to Len Brown
Quoted 7 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle() on ARM was a synonym for default_idle(), so simply invoke default_idle() directly.

Cc linux-arm-kernel at lists.infradead.org

Looks good to me.

Tested this patch along with 15/16 (removes global declaration) on an ARM platform (TI OMAP3) with and without CPUidle, and things continue to work as expected:

Kevin

#7 lore raw

Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle

In reply to Len Brown
Quoted 9 lines · Len Brown

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

I will test it on APM hardware and report back to you.

Do you then want me to take it through my tree, or are you going to push the whole patchset as a whole?

Signature · 2 lines
Jiri Kosina
SUSE Labs
#14 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

In reply to Len Brown
Quoted 28 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -6
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 

arch/blackfin/kernel/process.c void cpu_idle(void) · line 84

Quoted 4 lines
arch/blackfin/kernel/process.c +0 -1
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;

Hi,

This results in the following error:

arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)
arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once
arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

This change on top of your patch, fixes it.

arch/blackfin/kernel/process.c +1 -3
index 8061426..9782c03 100644
@@ -80,12 +80,10 @@ void cpu_idle(void)
 		if (cpu_is_offline(smp_processor_id()))
 			cpu_die();
 #endif
-		if (!idle)
-			idle = default_idle;
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 		preempt_enable_no_resched();

Otherwise the patch seems to work fine.

- Lars

author reviewer
#8 lore raw

Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle

In reply to Jiri Kosina
Quoted 8 lines · Jiri Kosina
Quoted 6 lines · Len Brown

From: Len Brown <[email protected]>

Update APM to register its local idle routine with cpuidle.

This allows us to stop exporting pm_idle to modules on x86.

Quoted 8 lines
Quoted 3 lines

The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.

Compile-tested only.

I will test it on APM hardware and report back to you.

Do you then want me to take it through my tree, or are you going to push the whole patchset as a whole?

Rafael took my series as a whole into his PM tree and it is currently staged for a 3.9 pull. But if I broke your APM box, I'm standing by ready to fix it during the release.

Please get back to me with the test results:

dmesg | grep idle
grep . /sys/devices/system/cpu/cpu*/cpuidle/*/*

would tell us if it is working or not.

thanks!
-Len Brown, Intel Open Source Technology Center

author reviewer
#15 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

In reply to Lars-Peter Clausen
Quoted 2 lines

Otherwise the patch seems to work fine.

Thanks for testing Lars!
Sorry about breaking the build w/ my slopyness --
will get that patched up.

cheers,
Len Brown, Intel Open Source Technology Center

#16 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

In reply to Lars-Peter Clausen
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -6
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 

arch/blackfin/kernel/process.c void cpu_idle(void) · line 84

Quoted 4 lines
arch/blackfin/kernel/process.c +0 -1
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;

Hi,

This results in the following error:

arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)
arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once
arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

Quoted 1 line

This change on top of your patch, fixes it.

Lars, I need your sign-off for the patch below. May I add it?

Rafael

Quoted 27 lines
arch/blackfin/kernel/process.c +1 -3
index 8061426..9782c03 100644
@@ -80,12 +80,10 @@ void cpu_idle(void)
 		if (cpu_is_offline(smp_processor_id()))
 			cpu_die();
 #endif
-		if (!idle)
-			idle = default_idle;
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 		preempt_enable_no_resched();

Otherwise the patch seems to work fine.

- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#17 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

Quoted 49 lines · Rafael J. Wysocki
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -6
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 

arch/blackfin/kernel/process.c void cpu_idle(void) · line 84

Quoted 4 lines
arch/blackfin/kernel/process.c +0 -1
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;

Hi,

This results in the following error:

arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)
arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once
arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

Quoted 5 lines
Quoted 1 line

This change on top of your patch, fixes it.

Lars, I need your sign-off for the patch below. May I add it?

Rafael

Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.

- Lars

Quoted 20 lines
Quoted 20 lines
arch/blackfin/kernel/process.c +1 -3
index 8061426..9782c03 100644
@@ -80,12 +80,10 @@ void cpu_idle(void)
 		if (cpu_is_offline(smp_processor_id()))
 			cpu_die();
 #endif
-		if (!idle)
-			idle = default_idle;
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 		preempt_enable_no_resched();
#18 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

Quoted 50 lines · Lars-Peter Clausen
Quoted 49 lines · Rafael J. Wysocki
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -6
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 

arch/blackfin/kernel/process.c void cpu_idle(void) · line 84

Quoted 4 lines
arch/blackfin/kernel/process.c +0 -1
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;

Hi,

This results in the following error:

arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)
arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once
arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This change on top of your patch, fixes it.

Lars, I need your sign-off for the patch below. May I add it?

Rafael

Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.

Please do now, if you can. Sorry for the trouble.

Thanks,
Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#19 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

Quoted 53 lines · Rafael J. Wysocki
Quoted 52 lines · Lars-Peter Clausen
Quoted 51 lines · Rafael J. Wysocki
Quoted 49 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -6
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 

arch/blackfin/kernel/process.c void cpu_idle(void) · line 84

Quoted 4 lines
arch/blackfin/kernel/process.c +0 -1
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;

Hi,

This results in the following error:

arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)
arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once
arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

This change on top of your patch, fixes it.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Lars, I need your sign-off for the patch below. May I add it?

Rafael

Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.

Please do now, if you can. Sorry for the trouble.

I can send it tomorrow morning, it's on my machine at work.

- Lars

#20 lore raw

Re: [PATCH 05/16] blackfin idle: delete pm_idle

Quoted 58 lines · Lars-Peter Clausen
Quoted 57 lines · Rafael J. Wysocki
Quoted 56 lines · Lars-Peter Clausen
Quoted 54 lines · Rafael J. Wysocki
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle is dead code on blackfin.

---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -6
index 3e16ad9..8061426 100644
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;
 void *l1_stack_base;
 unsigned long l1_stack_len;
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
-
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 

arch/blackfin/kernel/process.c void cpu_idle(void) · line 84

Quoted 4 lines
arch/blackfin/kernel/process.c +0 -1
@@ -81,7 +75,6 @@ void cpu_idle(void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;

Hi,

This results in the following error:

arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)
arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once
arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

Quoted 1 line

This change on top of your patch, fixes it.

Lars, I need your sign-off for the patch below. May I add it?

Rafael

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.

Please do now, if you can. Sorry for the trouble.

I can send it tomorrow morning, it's on my machine at work.

That will be fine.

Thanks,
Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#21 lore raw

PATCH 1/1 blackfin idle: Fix compile error

Commit 26bab0c ("blackfin idle: delete pm_idle") introduced the following
compile error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function) arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

This patch fixes it.

---
 arch/blackfin/kernel/process.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/blackfin/kernel/process.c +1 -3
index 8061426..9782c03 100644
@@ -80,12 +80,10 @@ void cpu_idle(void)
 		if (cpu_is_offline(smp_processor_id()))
 			cpu_die();
 #endif
-		if (!idle)
-			idle = default_idle;
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 		preempt_enable_no_resched();
Signature · 1 line
1.8.0
#38 lore raw

PATCH 1/1 microblaze idle: Fix compile error

In reply to Len Brown

Commit def8203 ("microblaze idle: delete pm_idle") introduced the following compile error:

arch/microblaze/kernel/process.c: In function 'cpu_idle':
arch/microblaze/kernel/process.c:100: error: 'idle' undeclared (first use in this function) arch/microblaze/kernel/process.c:100: error: (Each undeclared identifier is reported only once arch/microblaze/kernel/process.c:100: error: for each function it appears in.) arch/microblaze/kernel/process.c:106: error: implicit declaration of function 'idle'

This patch fixes it.

---
 arch/microblaze/kernel/process.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/microblaze/kernel/process.c +1 -4
index 6ff2dcf..08f8734 100644
@@ -97,13 +97,10 @@ void cpu_idle(void)
 
 	/* endless idle loop with no priority at all */
 	while (1) {
-		if (!idle)
-			idle = default_idle;
-
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 
Signature · 1 line
1.8.0
#33 lore raw

Re: [PATCH 09/16] ia64 idle: delete pm_idle

In reply to Len Brown
Quoted 26 lines · Len Brown

From: Len Brown <[email protected]>

pm_idle() on ia64 was a synonym for default_idle(). So simply invoke default_idle() directly.

---
 arch/ia64/kernel/process.c | 3 ---
 arch/ia64/kernel/setup.c   | 1 -
 2 files changed, 4 deletions(-)
arch/ia64/kernel/process.c +0 -2
index 31360cb..e34f565 100644
@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
 
 unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
 EXPORT_SYMBOL(boot_option_idle_override);
-void (*pm_idle) (void);
-EXPORT_SYMBOL(pm_idle);
 void (*pm_power_off) (void);
 EXPORT_SYMBOL(pm_power_off);
 

arch/ia64/kernel/process.c cpu_idle (void) · line 302

Quoted 5 lines
arch/ia64/kernel/process.c +0 -1
@@ -301,7 +299,6 @@ cpu_idle (void)
 			if (mark_idle)
 				(*mark_idle)(1);
 
-			idle = pm_idle;
 			if (!idle)

Hm, if I'm not mistaken idle will uninitialized at this point, so this could quite likely lead to a crash.

Quoted 14 lines
arch/ia64/kernel/process.c +0 -0
 				idle = default_idle;
 			(*idle)();
arch/ia64/kernel/setup.c +0 -1
index aaefd9b..2029cc0 100644
@@ -1051,7 +1051,6 @@ cpu_init (void)
 		max_num_phys_stacked = num_phys_stacked;
 	}
 	platform_cpu_init();
-	pm_idle = default_idle;
 }
 
 void __init
#22 lore raw

Re: [PATCH] blackfin idle: Fix compile error

In reply to Lars-Peter Clausen
Quoted 11 lines · Lars-Peter Clausen

Commit 26bab0c ("blackfin idle: delete pm_idle") introduced the following
compile error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function) arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’

This patch fixes it.

Applied to linux-pm.git/linux-next, I'm going to push it to Linus later this week.

Thanks,
Rafael

Quoted 23 lines
---
 arch/blackfin/kernel/process.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/blackfin/kernel/process.c +1 -3
index 8061426..9782c03 100644
@@ -80,12 +80,10 @@ void cpu_idle(void)
 		if (cpu_is_offline(smp_processor_id()))
 			cpu_die();
 #endif
-		if (!idle)
-			idle = default_idle;
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 		preempt_enable_no_resched();
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#39 lore raw

Re: [PATCH] microblaze idle: Fix compile error

In reply to Lars-Peter Clausen
Quoted 9 lines · Lars-Peter Clausen

Commit def8203 ("microblaze idle: delete pm_idle") introduced the following compile error:

arch/microblaze/kernel/process.c: In function 'cpu_idle':
arch/microblaze/kernel/process.c:100: error: 'idle' undeclared (first use in this function) arch/microblaze/kernel/process.c:100: error: (Each undeclared identifier is reported only once arch/microblaze/kernel/process.c:100: error: for each function it appears in.) arch/microblaze/kernel/process.c:106: error: implicit declaration of function 'idle'

Quoted 3 lines

This patch fixes it.

Applied to linux-pm.git/linux-next, I'm going to push it to Linus later this week.

Thanks,
Rafael

Quoted 24 lines
---
 arch/microblaze/kernel/process.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/microblaze/kernel/process.c +1 -4
index 6ff2dcf..08f8734 100644
@@ -97,13 +97,10 @@ void cpu_idle(void)
 
 	/* endless idle loop with no priority at all */
 	while (1) {
-		if (!idle)
-			idle = default_idle;
-
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		while (!need_resched())
-			idle();
+			default_idle();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#34 lore raw

RE: [PATCH 09/16] ia64 idle: delete pm_idle

In reply to Lars-Peter Clausen
Quoted 5 lines

arch/ia64/kernel/process.c cpu_idle (void) · line 302

Quoted 2 lines
arch/ia64/kernel/process.c +0 -1
-			idle = pm_idle;
 			if (!idle)

Hm, if I'm not mistaken idle will uninitialized at this point, so this could quite likely lead to a crash.

thanks,
will fix.

-Len

author reviewer
#35 lore raw

PATCH 1/1 ia64 idle: delete (*idle)()

From: Len Brown <[email protected]>

3e7fc708eb (ia64 idle: delete pm_idle) in 3.9-rc1
didn't finish the job, leaving an un-initialized
reference to (*idle)().

---
 arch/ia64/kernel/process.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/ia64/kernel/process.c +1 -4
index e34f565..6f7dc8b 100644
@@ -291,7 +291,6 @@ cpu_idle (void)
 		}
 
 		if (!need_resched()) {
-			void (*idle)(void);
 #ifdef CONFIG_SMP
 			min_xtp();
 #endif
@@ -299,9 +298,7 @@ cpu_idle (void)
 			if (mark_idle)
 				(*mark_idle)(1);
 
-			if (!idle)
-				idle = default_idle;
-			(*idle)();
+			default_idle();
 			if (mark_idle)
 				(*mark_idle)(0);
 #ifdef CONFIG_SMP