linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pm_idle cleanup patch series
@ 2013-02-10  5:58 Len Brown
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
  0 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle
  2013-02-10  5:58 pm_idle cleanup patch series Len Brown
@ 2013-02-10  5:58 ` Len Brown
  2013-02-10  5:58   ` [PATCH 02/16] x86 idle: rename global pm_idle to static x86_idle Len Brown
                     ` (15 more replies)
  0 siblings, 16 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, Jiri Kosina

From: Len Brown <len.brown@intel.com>

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.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Jiri Kosina <jkosina@suse.cz>
---
 arch/x86/Kconfig          |  1 +
 arch/x86/kernel/apm_32.c  | 58 +++++++++++++++++++++++++++++------------------
 arch/x86/kernel/process.c |  3 ---
 3 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 225543b..1b63586 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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.
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index d65464e..18a3cc3 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -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,37 @@ 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 */
+			.target_residency = 500,	/* WAG */
+			.enter = &apm_cpu_idle
+		},
+	},
+};
+
+static struct cpuidle_device apm_cpuidle_device = {
+	.state_count = 2,
+};
+
+
 /*
  * Local variables
  */
@@ -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)
@@ -964,6 +983,7 @@ recalc:
 		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);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 2ed787f..f571a6e 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -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)
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 02/16] x86 idle: rename global pm_idle to static x86_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10  5:58   ` [PATCH 03/16] sh idle: rename global pm_idle to static sh_idle Len Brown
                     ` (14 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, x86

From: Len Brown <len.brown@intel.com>

(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.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: x86@kernel.org
---
 arch/x86/kernel/process.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index f571a6e..ceb05db 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -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")) {
 		/*
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 03/16] sh idle: rename global pm_idle to static sh_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
  2013-02-10  5:58   ` [PATCH 02/16] x86 idle: rename global pm_idle to static x86_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10  5:58   ` [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle Len Brown
                     ` (13 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-sh

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-sh@vger.kernel.org
---
 arch/sh/kernel/idle.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index 0c91016..3d5a1b3 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -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)
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
  2013-02-10  5:58   ` [PATCH 02/16] x86 idle: rename global pm_idle to static x86_idle Len Brown
  2013-02-10  5:58   ` [PATCH 03/16] sh idle: rename global pm_idle to static sh_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10 23:08     ` David Miller
  2013-02-10  5:58   ` [PATCH 05/16] blackfin idle: delete pm_idle Len Brown
                     ` (12 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, sparclinux

From: Len Brown <len.brown@intel.com>

(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...

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: sparclinux@vger.kernel.org
---
 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(-)

diff --git a/arch/sparc/include/asm/processor.h b/arch/sparc/include/asm/processor.h
index 2fe99e6..34baa35 100644
--- a/arch/sparc/include/asm/processor.h
+++ b/arch/sparc/include/asm/processor.h
@@ -7,5 +7,6 @@
 #endif
 
 #define nop() 		__asm__ __volatile__ ("nop")
+extern void (*sparc_idle)(void);
 
 #endif
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 348fa1a..eefda32 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -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)" : "");
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c
index 4e17432..708bca4 100644
--- a/arch/sparc/kernel/leon_pmc.c
+++ b/arch/sparc/kernel/leon_pmc.c
@@ -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");
 	}
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index dcbb62f..8b7297f 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -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);
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index be8e862..62eede1 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -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();
 		}
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (2 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-18 16:28     ` Lars-Peter Clausen
  2013-02-10  5:58   ` [PATCH 06/16] ARM idle: delete pm_idle Len Brown
                     ` (11 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, uclinux-dist-devel

From: Len Brown <len.brown@intel.com>

pm_idle is dead code on blackfin.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---
 arch/blackfin/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 3e16ad9..8061426 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -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()))
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 06/16] ARM idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (3 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 05/16] blackfin idle: delete pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-11 16:02     ` Catalin Marinas
  2013-02-12 22:04     ` Kevin Hilman
  2013-02-10  5:58   ` [PATCH 07/16] ARM64 " Len Brown
                     ` (10 subsequent siblings)
  15 siblings, 2 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-arm-kernel

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/kernel/process.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index c6dec5f..047d3e4 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -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());
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 07/16] ARM64 idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (4 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 06/16] ARM idle: delete pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-12 11:03     ` Catalin Marinas
  2013-02-10  5:58   ` [PATCH 08/16] cris idle: delete idle and pm_idle Len Brown
                     ` (9 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-arm-kernel

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm64/kernel/process.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index cb0956b..c7002d4 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -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());
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 08/16] cris idle: delete idle and pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (5 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 07/16] ARM64 " Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-11  8:42     ` Jesper Nilsson
  2013-02-10  5:58   ` [PATCH 09/16] ia64 idle: delete pm_idle Len Brown
                     ` (8 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-cris-kernel

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-cris-kernel@axis.com
---
 arch/cris/kernel/process.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 7f65be6..104ff4d 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -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();
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 09/16] ia64 idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (6 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 08/16] cris idle: delete idle and pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-21 10:15     ` Lars-Peter Clausen
  2013-02-10  5:58   ` [PATCH 10/16] m32r idle: delete pm_idle, and other dead idle code Len Brown
                     ` (7 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-ia64

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-ia64@vger.kernel.org
---
 arch/ia64/kernel/process.c | 3 ---
 arch/ia64/kernel/setup.c   | 1 -
 2 files changed, 4 deletions(-)

diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 31360cb..e34f565 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -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)();
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index aaefd9b..2029cc0 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -1051,7 +1051,6 @@ cpu_init (void)
 		max_num_phys_stacked = num_phys_stacked;
 	}
 	platform_cpu_init();
-	pm_idle = default_idle;
 }
 
 void __init
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 10/16] m32r idle: delete pm_idle, and other dead idle code
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (7 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 09/16] ia64 idle: delete pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10  5:58   ` [PATCH 11/16] microblaze idle: delete pm_idle Len Brown
                     ` (6 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-m32r

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-m32r@ml.linux-m32r.org
---
 arch/m32r/kernel/process.c | 51 ++--------------------------------------------
 1 file changed, 2 insertions(+), 49 deletions(-)

diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index 765d0f5..bde899e 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -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");
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 11/16] microblaze idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (8 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 10/16] m32r idle: delete pm_idle, and other dead idle code Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-21 10:15     ` [PATCH] microblaze idle: Fix compile error Lars-Peter Clausen
  2013-02-10  5:58   ` [PATCH 12/16] mn10300 idle: delete pm_idle Len Brown
                     ` (5 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, microblaze-uclinux

From: Len Brown <len.brown@intel.com>

pm_idle on microblaze served no purpose.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: microblaze-uclinux@itee.uq.edu.au
---
 arch/microblaze/kernel/process.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index a5b74f7..6ff2dcf 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -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;
 
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 12/16] mn10300 idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (9 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 11/16] microblaze idle: delete pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10  5:58   ` [PATCH 13/16] openrisc " Len Brown
                     ` (4 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux-am33-list

From: Len Brown <len.brown@intel.com>

pm_idle on mn10300 served no purpose.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-am33-list@redhat.com
---
 arch/mn10300/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index eb09f5a..84f4e97 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -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;
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 13/16] openrisc idle: delete pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (10 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 12/16] mn10300 idle: delete pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10 17:31     ` [ORLinux] " Jonas Bonn
  2013-02-10  5:58   ` [PATCH 14/16] unicore32 idle: delete stray pm_idle comment Len Brown
                     ` (3 subsequent siblings)
  15 siblings, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, linux

From: Len Brown <len.brown@intel.com>

pm_idle() on openrisc was dead code.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux@lists.openrisc.net
---
 arch/openrisc/kernel/idle.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/openrisc/kernel/idle.c b/arch/openrisc/kernel/idle.c
index 7d618fe..5e8a3b6 100644
--- a/arch/openrisc/kernel/idle.c
+++ b/arch/openrisc/kernel/idle.c
@@ -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);
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 14/16] unicore32 idle: delete stray pm_idle comment
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (11 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 13/16] openrisc " Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10  5:58   ` [PATCH 15/16] PM idle: remove global declaration of pm_idle Len Brown
                     ` (2 subsequent siblings)
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, Guan Xuetao

From: Len Brown <len.brown@intel.com>

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

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
---
 arch/unicore32/kernel/process.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 62bad9f..872d7e2 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -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 */
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 15/16] PM idle: remove global declaration of pm_idle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (12 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 14/16] unicore32 idle: delete stray pm_idle comment Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-10  5:58   ` [PATCH 16/16] xen idle: make xen-specific macro xen-specific Len Brown
  2013-02-11  9:18   ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Daniel Lezcano
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown

From: Len Brown <len.brown@intel.com>

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.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: linux-pm@vger.kernel.org
---
 include/linux/pm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index 03d7bb1..97bcf23 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -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);
 
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 16/16] xen idle: make xen-specific macro xen-specific
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (13 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 15/16] PM idle: remove global declaration of pm_idle Len Brown
@ 2013-02-10  5:58   ` Len Brown
  2013-02-11  9:18   ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Daniel Lezcano
  15 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-10  5:58 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Len Brown, xen-devel

From: Len Brown <len.brown@intel.com>

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

> set_pm_idle_to_default()
< xen_set_default_idle()

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: xen-devel@lists.xensource.com
---
 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(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 888184b..c2f7f47 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -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);
 
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index ceb05db..b86de21 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -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();
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 8971a26..2b73b5c 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -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;
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [ORLinux] [PATCH 13/16] openrisc idle: delete pm_idle
  2013-02-10  5:58   ` [PATCH 13/16] openrisc " Len Brown
@ 2013-02-10 17:31     ` Jonas Bonn
  0 siblings, 0 replies; 46+ messages in thread
From: Jonas Bonn @ 2013-02-10 17:31 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, Len Brown, linux-kernel, linux

On 02/10/13 06:58, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
>
> pm_idle() on openrisc was dead code.
>
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: linux@lists.openrisc.net
> ---
>   arch/openrisc/kernel/idle.c | 5 -----
>   1 file changed, 5 deletions(-)

Thanks, Len.  Will apply.
/Jonas

> diff --git a/arch/openrisc/kernel/idle.c b/arch/openrisc/kernel/idle.c
> index 7d618fe..5e8a3b6 100644
> --- a/arch/openrisc/kernel/idle.c
> +++ b/arch/openrisc/kernel/idle.c
> @@ -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);


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle
  2013-02-10  5:58   ` [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle Len Brown
@ 2013-02-10 23:08     ` David Miller
  0 siblings, 0 replies; 46+ messages in thread
From: David Miller @ 2013-02-10 23:08 UTC (permalink / raw)
  To: lenb; +Cc: linux-pm, linux-kernel, len.brown, sparclinux

From: Len Brown <lenb@kernel.org>
Date: Sun, 10 Feb 2013 00:58:11 -0500

> From: Len Brown <len.brown@intel.com>
> 
> (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...
> 
> Signed-off-by: Len Brown <len.brown@intel.com>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 08/16] cris idle: delete idle and pm_idle
  2013-02-10  5:58   ` [PATCH 08/16] cris idle: delete idle and pm_idle Len Brown
@ 2013-02-11  8:42     ` Jesper Nilsson
  0 siblings, 0 replies; 46+ messages in thread
From: Jesper Nilsson @ 2013-02-11  8:42 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, Len Brown, linux-kernel, linux-cris-kernel

On Sun, Feb 10, 2013 at 06:58:15AM +0100, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> pm_idle() and idle() served no purpose on cris --
> invoke default_idle() directly.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: linux-cris-kernel@axis.com

Looks good!

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

> ---
>  arch/cris/kernel/process.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
> index 7f65be6..104ff4d 100644
> --- a/arch/cris/kernel/process.c
> +++ b/arch/cris/kernel/process.c
> @@ -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();
> -- 
> 1.8.1.3.535.ga923c31

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle
  2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
                     ` (14 preceding siblings ...)
  2013-02-10  5:58   ` [PATCH 16/16] xen idle: make xen-specific macro xen-specific Len Brown
@ 2013-02-11  9:18   ` Daniel Lezcano
  2013-02-11 22:50     ` Len Brown
  2013-02-11 23:03     ` APM: Request to Test Len Brown
  15 siblings, 2 replies; 46+ messages in thread
From: Daniel Lezcano @ 2013-02-11  9:18 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, linux-kernel, Len Brown, Jiri Kosina

On 02/10/2013 06:58 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> 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.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: Jiri Kosina <jkosina@suse.cz>
> ---

[ ... ]

>  
> +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 */
> +			.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;

>  /*
>   * Local variables
>   */
> @@ -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)
> @@ -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 ?

> +	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);
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 2ed787f..f571a6e 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -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)
> 


-- 
 <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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 06/16] ARM idle: delete pm_idle
  2013-02-10  5:58   ` [PATCH 06/16] ARM idle: delete pm_idle Len Brown
@ 2013-02-11 16:02     ` Catalin Marinas
  2013-02-11 16:11       ` Russell King - ARM Linux
  2013-02-12 22:04     ` Kevin Hilman
  1 sibling, 1 reply; 46+ messages in thread
From: Catalin Marinas @ 2013-02-11 16:02 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, Len Brown, linux-kernel, linux-arm-kernel

On Sun, Feb 10, 2013 at 05:58:13AM +0000, Len Brown wrote:
> 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.

-- 
Catalin

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 06/16] ARM idle: delete pm_idle
  2013-02-11 16:02     ` Catalin Marinas
@ 2013-02-11 16:11       ` Russell King - ARM Linux
  2013-02-11 22:42         ` Len Brown
  0 siblings, 1 reply; 46+ messages in thread
From: Russell King - ARM Linux @ 2013-02-11 16:11 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Len Brown, Len Brown, linux-kernel, linux-arm-kernel, linux-pm

On Mon, Feb 11, 2013 at 04:02:30PM +0000, Catalin Marinas wrote:
> On Sun, Feb 10, 2013 at 05:58:13AM +0000, Len Brown wrote:
> > 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.

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.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 06/16] ARM idle: delete pm_idle
  2013-02-11 16:11       ` Russell King - ARM Linux
@ 2013-02-11 22:42         ` Len Brown
  0 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-11 22:42 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Catalin Marinas, linux-kernel, linux-arm-kernel, linux-pm

On 02/11/2013 11:11 AM, Russell King - ARM Linux wrote:
> On Mon, Feb 11, 2013 at 04:02:30PM +0000, Catalin Marinas wrote:
>> On Sun, Feb 10, 2013 at 05:58:13AM +0000, Len Brown wrote:
>>> 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.
> 
> 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

> 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.
> 


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle
  2013-02-11  9:18   ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Daniel Lezcano
@ 2013-02-11 22:50     ` Len Brown
  2013-02-11 23:03     ` APM: Request to Test Len Brown
  1 sibling, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-11 22:50 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: linux-pm, linux-kernel, Len Brown, Jiri Kosina

On 02/11/2013 04:18 AM, Daniel Lezcano wrote:
> On 02/10/2013 06:58 AM, Len Brown wrote:
>> From: Len Brown <len.brown@intel.com>
>>
>> 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.
>>
>> Signed-off-by: Len Brown <len.brown@intel.com>
>> Cc: Jiri Kosina <jkosina@suse.cz>
>> ---
> 

>> +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,
> }

yup, good catch.

>> -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 */
...
>> @@ -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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* APM: Request to Test
  2013-02-11  9:18   ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Daniel Lezcano
  2013-02-11 22:50     ` Len Brown
@ 2013-02-11 23:03     ` Len Brown
  2013-02-11 23:03       ` [PATCH v2] APM idle: register apm_cpu_idle via cpuidle Len Brown
  1 sibling, 1 reply; 46+ messages in thread
From: Len Brown @ 2013-02-11 23:03 UTC (permalink / raw)
  To: linux-acpi, linux-pm; +Cc: linux-kernel

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
  2013-02-11 23:03     ` APM: Request to Test Len Brown
@ 2013-02-11 23:03       ` Len Brown
  2013-02-12 15:00         ` Daniel Lezcano
  2013-02-18 13:30         ` Jiri Kosina
  0 siblings, 2 replies; 46+ messages in thread
From: Len Brown @ 2013-02-11 23:03 UTC (permalink / raw)
  To: linux-acpi, linux-pm; +Cc: linux-kernel, Len Brown, Jiri Kosina

From: Len Brown <len.brown@intel.com>

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.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Jiri Kosina <jkosina@suse.cz>
---
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(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 225543b..1b63586 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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.
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index d65464e..f9f8afc 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -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 */
+			.target_residency = 500,	/* WAG */
+			.enter = &apm_cpu_idle
+		},
+	},
+	.state_count = 2,
+};
+
+static struct cpuidle_device apm_cpuidle_device = {
+	.state_count = 2,
+};
+
+
 /*
  * 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);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 2ed787f..f571a6e 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -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)
-- 
1.8.1.3.535.ga923c31


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 07/16] ARM64 idle: delete pm_idle
  2013-02-10  5:58   ` [PATCH 07/16] ARM64 " Len Brown
@ 2013-02-12 11:03     ` Catalin Marinas
  0 siblings, 0 replies; 46+ messages in thread
From: Catalin Marinas @ 2013-02-12 11:03 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, Len Brown, linux-kernel, linux-arm-kernel

On Sun, Feb 10, 2013 at 05:58:14AM +0000, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> pm_idle() on arm64 was a synonym for default_idle(),
> so remove it and invoke default_idle() directly.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: linux-arm-kernel@lists.infradead.org

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
  2013-02-11 23:03       ` [PATCH v2] APM idle: register apm_cpu_idle via cpuidle Len Brown
@ 2013-02-12 15:00         ` Daniel Lezcano
  2013-02-18 13:30         ` Jiri Kosina
  1 sibling, 0 replies; 46+ messages in thread
From: Daniel Lezcano @ 2013-02-12 15:00 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, linux-pm, linux-kernel, Len Brown, Jiri Kosina

On 02/12/2013 12:03 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> 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.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: Jiri Kosina <jkosina@suse.cz>
> ---
> 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(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 225543b..1b63586 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -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.
> diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
> index d65464e..f9f8afc 100644
> --- a/arch/x86/kernel/apm_32.c
> +++ b/arch/x86/kernel/apm_32.c
> @@ -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 */
> +			.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 :

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>


>  /*
>   * 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);
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 2ed787f..f571a6e 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -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)
> 


-- 
 <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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 06/16] ARM idle: delete pm_idle
  2013-02-10  5:58   ` [PATCH 06/16] ARM idle: delete pm_idle Len Brown
  2013-02-11 16:02     ` Catalin Marinas
@ 2013-02-12 22:04     ` Kevin Hilman
  1 sibling, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2013-02-12 22:04 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, Len Brown, linux-kernel, linux-arm-kernel

Len Brown <lenb@kernel.org> writes:

> From: Len Brown <len.brown@intel.com>
>
> pm_idle() on ARM was a synonym for default_idle(),
> so simply invoke default_idle() directly.
>
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: linux-arm-kernel@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:

Reviewed-by: Kevin Hilman <khilman@linaro.org>
Tested-by: Kevin Hilman <khilman@linaro.org>

Kevin

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
  2013-02-11 23:03       ` [PATCH v2] APM idle: register apm_cpu_idle via cpuidle Len Brown
  2013-02-12 15:00         ` Daniel Lezcano
@ 2013-02-18 13:30         ` Jiri Kosina
  2013-02-20 17:48           ` Len Brown
  1 sibling, 1 reply; 46+ messages in thread
From: Jiri Kosina @ 2013-02-18 13:30 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, linux-pm, linux-kernel, Len Brown

On Mon, 11 Feb 2013, Len Brown wrote:

> From: Len Brown <len.brown@intel.com>
> 
> 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?

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-10  5:58   ` [PATCH 05/16] blackfin idle: delete pm_idle Len Brown
@ 2013-02-18 16:28     ` Lars-Peter Clausen
  2013-02-20 17:53       ` Len Brown
  2013-02-20 19:52       ` Rafael J. Wysocki
  0 siblings, 2 replies; 46+ messages in thread
From: Lars-Peter Clausen @ 2013-02-18 16:28 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, linux-kernel, Len Brown, uclinux-dist-devel

On 02/10/2013 06:58 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> pm_idle is dead code on blackfin.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: uclinux-dist-devel@blackfin.uclinux.org
> ---
>  arch/blackfin/kernel/process.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> index 3e16ad9..8061426 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -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;

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.

diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 8061426..9782c03 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
  2013-02-18 13:30         ` Jiri Kosina
@ 2013-02-20 17:48           ` Len Brown
  0 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-20 17:48 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-acpi, linux-pm, linux-kernel, Len Brown

On 02/18/2013 08:30 AM, Jiri Kosina wrote:
> On Mon, 11 Feb 2013, Len Brown wrote:
> 
>> From: Len Brown <len.brown@intel.com>
>>
>> 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?

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-18 16:28     ` Lars-Peter Clausen
@ 2013-02-20 17:53       ` Len Brown
  2013-02-20 19:52       ` Rafael J. Wysocki
  1 sibling, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-02-20 17:53 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-pm, linux-kernel, Len Brown, uclinux-dist-devel


> 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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-18 16:28     ` Lars-Peter Clausen
  2013-02-20 17:53       ` Len Brown
@ 2013-02-20 19:52       ` Rafael J. Wysocki
  2013-02-20 19:53         ` Lars-Peter Clausen
  1 sibling, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2013-02-20 19:52 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Len Brown, linux-pm, linux-kernel, Len Brown, uclinux-dist-devel

On Monday, February 18, 2013 05:28:19 PM Lars-Peter Clausen wrote:
> On 02/10/2013 06:58 AM, Len Brown wrote:
> > From: Len Brown <len.brown@intel.com>
> > 
> > pm_idle is dead code on blackfin.
> > 
> > Signed-off-by: Len Brown <len.brown@intel.com>
> > Cc: uclinux-dist-devel@blackfin.uclinux.org
> > ---
> >  arch/blackfin/kernel/process.c | 7 -------
> >  1 file changed, 7 deletions(-)
> > 
> > diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> > index 3e16ad9..8061426 100644
> > --- a/arch/blackfin/kernel/process.c
> > +++ b/arch/blackfin/kernel/process.c
> > @@ -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;
> 
> 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.

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

Rafael


> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> index 8061426..9782c03 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-20 19:52       ` Rafael J. Wysocki
@ 2013-02-20 19:53         ` Lars-Peter Clausen
  2013-02-20 19:59           ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Lars-Peter Clausen @ 2013-02-20 19:53 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, linux-pm, linux-kernel, Len Brown, uclinux-dist-devel

On 02/20/2013 08:52 PM, Rafael J. Wysocki wrote:
> On Monday, February 18, 2013 05:28:19 PM Lars-Peter Clausen wrote:
>> On 02/10/2013 06:58 AM, Len Brown wrote:
>>> From: Len Brown <len.brown@intel.com>
>>>
>>> pm_idle is dead code on blackfin.
>>>
>>> Signed-off-by: Len Brown <len.brown@intel.com>
>>> Cc: uclinux-dist-devel@blackfin.uclinux.org
>>> ---
>>>  arch/blackfin/kernel/process.c | 7 -------
>>>  1 file changed, 7 deletions(-)
>>>
>>> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
>>> index 3e16ad9..8061426 100644
>>> --- a/arch/blackfin/kernel/process.c
>>> +++ b/arch/blackfin/kernel/process.c
>>> @@ -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;
>>
>> 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.
> 
> 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


>> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
>> index 8061426..9782c03 100644
>> --- a/arch/blackfin/kernel/process.c
>> +++ b/arch/blackfin/kernel/process.c
>> @@ -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();
>>
>>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-20 19:53         ` Lars-Peter Clausen
@ 2013-02-20 19:59           ` Rafael J. Wysocki
  2013-02-20 20:21             ` Lars-Peter Clausen
  0 siblings, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2013-02-20 19:59 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Len Brown, linux-pm, linux-kernel, Len Brown, uclinux-dist-devel

On Wednesday, February 20, 2013 08:53:38 PM Lars-Peter Clausen wrote:
> On 02/20/2013 08:52 PM, Rafael J. Wysocki wrote:
> > On Monday, February 18, 2013 05:28:19 PM Lars-Peter Clausen wrote:
> >> On 02/10/2013 06:58 AM, Len Brown wrote:
> >>> From: Len Brown <len.brown@intel.com>
> >>>
> >>> pm_idle is dead code on blackfin.
> >>>
> >>> Signed-off-by: Len Brown <len.brown@intel.com>
> >>> Cc: uclinux-dist-devel@blackfin.uclinux.org
> >>> ---
> >>>  arch/blackfin/kernel/process.c | 7 -------
> >>>  1 file changed, 7 deletions(-)
> >>>
> >>> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> >>> index 3e16ad9..8061426 100644
> >>> --- a/arch/blackfin/kernel/process.c
> >>> +++ b/arch/blackfin/kernel/process.c
> >>> @@ -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;
> >>
> >> 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.
> > 
> > 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


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-20 19:59           ` Rafael J. Wysocki
@ 2013-02-20 20:21             ` Lars-Peter Clausen
  2013-02-20 21:18               ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Lars-Peter Clausen @ 2013-02-20 20:21 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, linux-pm, linux-kernel, Len Brown, uclinux-dist-devel

On 02/20/2013 08:59 PM, Rafael J. Wysocki wrote:
> On Wednesday, February 20, 2013 08:53:38 PM Lars-Peter Clausen wrote:
>> On 02/20/2013 08:52 PM, Rafael J. Wysocki wrote:
>>> On Monday, February 18, 2013 05:28:19 PM Lars-Peter Clausen wrote:
>>>> On 02/10/2013 06:58 AM, Len Brown wrote:
>>>>> From: Len Brown <len.brown@intel.com>
>>>>>
>>>>> pm_idle is dead code on blackfin.
>>>>>
>>>>> Signed-off-by: Len Brown <len.brown@intel.com>
>>>>> Cc: uclinux-dist-devel@blackfin.uclinux.org
>>>>> ---
>>>>>  arch/blackfin/kernel/process.c | 7 -------
>>>>>  1 file changed, 7 deletions(-)
>>>>>
>>>>> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
>>>>> index 3e16ad9..8061426 100644
>>>>> --- a/arch/blackfin/kernel/process.c
>>>>> +++ b/arch/blackfin/kernel/process.c
>>>>> @@ -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;
>>>>
>>>> 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.
>>>
>>> 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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/16] blackfin idle: delete pm_idle
  2013-02-20 20:21             ` Lars-Peter Clausen
@ 2013-02-20 21:18               ` Rafael J. Wysocki
  2013-02-21  9:56                 ` [PATCH] blackfin idle: Fix compile error Lars-Peter Clausen
  0 siblings, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2013-02-20 21:18 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Len Brown, linux-pm, linux-kernel, Len Brown, uclinux-dist-devel

On Wednesday, February 20, 2013 09:21:16 PM Lars-Peter Clausen wrote:
> On 02/20/2013 08:59 PM, Rafael J. Wysocki wrote:
> > On Wednesday, February 20, 2013 08:53:38 PM Lars-Peter Clausen wrote:
> >> On 02/20/2013 08:52 PM, Rafael J. Wysocki wrote:
> >>> On Monday, February 18, 2013 05:28:19 PM Lars-Peter Clausen wrote:
> >>>> On 02/10/2013 06:58 AM, Len Brown wrote:
> >>>>> From: Len Brown <len.brown@intel.com>
> >>>>>
> >>>>> pm_idle is dead code on blackfin.
> >>>>>
> >>>>> Signed-off-by: Len Brown <len.brown@intel.com>
> >>>>> Cc: uclinux-dist-devel@blackfin.uclinux.org
> >>>>> ---
> >>>>>  arch/blackfin/kernel/process.c | 7 -------
> >>>>>  1 file changed, 7 deletions(-)
> >>>>>
> >>>>> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> >>>>> index 3e16ad9..8061426 100644
> >>>>> --- a/arch/blackfin/kernel/process.c
> >>>>> +++ b/arch/blackfin/kernel/process.c
> >>>>> @@ -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;
> >>>>
> >>>> 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.
> >>>
> >>> 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.

That will be fine.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH] blackfin idle: Fix compile error
  2013-02-20 21:18               ` Rafael J. Wysocki
@ 2013-02-21  9:56                 ` Lars-Peter Clausen
  2013-02-21 16:24                   ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Lars-Peter Clausen @ 2013-02-21  9:56 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, linux-pm, linux-kernel, uclinux-dist-devel,
	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.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 arch/blackfin/kernel/process.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 8061426..9782c03 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -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();
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH] microblaze idle: Fix compile error
  2013-02-10  5:58   ` [PATCH 11/16] microblaze idle: delete pm_idle Len Brown
@ 2013-02-21 10:15     ` Lars-Peter Clausen
  2013-02-21 16:25       ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Lars-Peter Clausen @ 2013-02-21 10:15 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, linux-pm, linux-kernel, microblaze-uclinux,
	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'

This patch fixes it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 arch/microblaze/kernel/process.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 6ff2dcf..08f8734 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -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();
 
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 09/16] ia64 idle: delete pm_idle
  2013-02-10  5:58   ` [PATCH 09/16] ia64 idle: delete pm_idle Len Brown
@ 2013-02-21 10:15     ` Lars-Peter Clausen
  2013-03-26  3:12       ` Brown, Len
  0 siblings, 1 reply; 46+ messages in thread
From: Lars-Peter Clausen @ 2013-02-21 10:15 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, linux-kernel, Len Brown, linux-ia64

On 02/10/2013 06:58 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> pm_idle() on ia64 was a synonym for default_idle().
> So simply invoke default_idle() directly.
> 
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: linux-ia64@vger.kernel.org
> ---
>  arch/ia64/kernel/process.c | 3 ---
>  arch/ia64/kernel/setup.c   | 1 -
>  2 files changed, 4 deletions(-)
> 
> diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
> index 31360cb..e34f565 100644
> --- a/arch/ia64/kernel/process.c
> +++ b/arch/ia64/kernel/process.c
> @@ -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)

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

>  				idle = default_idle;
>  			(*idle)();
> diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
> index aaefd9b..2029cc0 100644
> --- a/arch/ia64/kernel/setup.c
> +++ b/arch/ia64/kernel/setup.c
> @@ -1051,7 +1051,6 @@ cpu_init (void)
>  		max_num_phys_stacked = num_phys_stacked;
>  	}
>  	platform_cpu_init();
> -	pm_idle = default_idle;
>  }
>  
>  void __init


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH] blackfin idle: Fix compile error
  2013-02-21  9:56                 ` [PATCH] blackfin idle: Fix compile error Lars-Peter Clausen
@ 2013-02-21 16:24                   ` Rafael J. Wysocki
  0 siblings, 0 replies; 46+ messages in thread
From: Rafael J. Wysocki @ 2013-02-21 16:24 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Len Brown, linux-pm, linux-kernel, uclinux-dist-devel

On Thursday, February 21, 2013 10:56:43 AM Lars-Peter Clausen wrote:
> 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.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

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

Thanks,
Rafael


> ---
>  arch/blackfin/kernel/process.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> index 8061426..9782c03 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -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();
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH] microblaze idle: Fix compile error
  2013-02-21 10:15     ` [PATCH] microblaze idle: Fix compile error Lars-Peter Clausen
@ 2013-02-21 16:25       ` Rafael J. Wysocki
  0 siblings, 0 replies; 46+ messages in thread
From: Rafael J. Wysocki @ 2013-02-21 16:25 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Len Brown, linux-pm, linux-kernel, microblaze-uclinux

On Thursday, February 21, 2013 11:15:31 AM Lars-Peter Clausen wrote:
> 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.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

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

Thanks,
Rafael


> ---
>  arch/microblaze/kernel/process.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
> index 6ff2dcf..08f8734 100644
> --- a/arch/microblaze/kernel/process.c
> +++ b/arch/microblaze/kernel/process.c
> @@ -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();
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* RE: [PATCH 09/16] ia64 idle: delete pm_idle
  2013-02-21 10:15     ` Lars-Peter Clausen
@ 2013-03-26  3:12       ` Brown, Len
  2013-03-26  4:29         ` [PATCH] ia64 idle: delete (*idle)() Len Brown
  0 siblings, 1 reply; 46+ messages in thread
From: Brown, Len @ 2013-03-26  3:12 UTC (permalink / raw)
  To: Lars-Peter Clausen, Len Brown; +Cc: linux-pm, linux-kernel, linux-ia64

> > -			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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH] ia64 idle: delete (*idle)()
  2013-03-26  3:12       ` Brown, Len
@ 2013-03-26  4:29         ` Len Brown
  0 siblings, 0 replies; 46+ messages in thread
From: Len Brown @ 2013-03-26  4:29 UTC (permalink / raw)
  To: Luck, Tony; +Cc: Lars-Peter Clausen, linux-pm, linux-kernel, linux-ia64

From: Len Brown <len.brown@intel.com>

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

Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 arch/ia64/kernel/process.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index e34f565..6f7dc8b 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -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
-- 


^ permalink raw reply related	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2013-03-26  4:29 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-10  5:58 pm_idle cleanup patch series Len Brown
2013-02-10  5:58 ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Len Brown
2013-02-10  5:58   ` [PATCH 02/16] x86 idle: rename global pm_idle to static x86_idle Len Brown
2013-02-10  5:58   ` [PATCH 03/16] sh idle: rename global pm_idle to static sh_idle Len Brown
2013-02-10  5:58   ` [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle Len Brown
2013-02-10 23:08     ` David Miller
2013-02-10  5:58   ` [PATCH 05/16] blackfin idle: delete pm_idle Len Brown
2013-02-18 16:28     ` Lars-Peter Clausen
2013-02-20 17:53       ` Len Brown
2013-02-20 19:52       ` Rafael J. Wysocki
2013-02-20 19:53         ` Lars-Peter Clausen
2013-02-20 19:59           ` Rafael J. Wysocki
2013-02-20 20:21             ` Lars-Peter Clausen
2013-02-20 21:18               ` Rafael J. Wysocki
2013-02-21  9:56                 ` [PATCH] blackfin idle: Fix compile error Lars-Peter Clausen
2013-02-21 16:24                   ` Rafael J. Wysocki
2013-02-10  5:58   ` [PATCH 06/16] ARM idle: delete pm_idle Len Brown
2013-02-11 16:02     ` Catalin Marinas
2013-02-11 16:11       ` Russell King - ARM Linux
2013-02-11 22:42         ` Len Brown
2013-02-12 22:04     ` Kevin Hilman
2013-02-10  5:58   ` [PATCH 07/16] ARM64 " Len Brown
2013-02-12 11:03     ` Catalin Marinas
2013-02-10  5:58   ` [PATCH 08/16] cris idle: delete idle and pm_idle Len Brown
2013-02-11  8:42     ` Jesper Nilsson
2013-02-10  5:58   ` [PATCH 09/16] ia64 idle: delete pm_idle Len Brown
2013-02-21 10:15     ` Lars-Peter Clausen
2013-03-26  3:12       ` Brown, Len
2013-03-26  4:29         ` [PATCH] ia64 idle: delete (*idle)() Len Brown
2013-02-10  5:58   ` [PATCH 10/16] m32r idle: delete pm_idle, and other dead idle code Len Brown
2013-02-10  5:58   ` [PATCH 11/16] microblaze idle: delete pm_idle Len Brown
2013-02-21 10:15     ` [PATCH] microblaze idle: Fix compile error Lars-Peter Clausen
2013-02-21 16:25       ` Rafael J. Wysocki
2013-02-10  5:58   ` [PATCH 12/16] mn10300 idle: delete pm_idle Len Brown
2013-02-10  5:58   ` [PATCH 13/16] openrisc " Len Brown
2013-02-10 17:31     ` [ORLinux] " Jonas Bonn
2013-02-10  5:58   ` [PATCH 14/16] unicore32 idle: delete stray pm_idle comment Len Brown
2013-02-10  5:58   ` [PATCH 15/16] PM idle: remove global declaration of pm_idle Len Brown
2013-02-10  5:58   ` [PATCH 16/16] xen idle: make xen-specific macro xen-specific Len Brown
2013-02-11  9:18   ` [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle Daniel Lezcano
2013-02-11 22:50     ` Len Brown
2013-02-11 23:03     ` APM: Request to Test Len Brown
2013-02-11 23:03       ` [PATCH v2] APM idle: register apm_cpu_idle via cpuidle Len Brown
2013-02-12 15:00         ` Daniel Lezcano
2013-02-18 13:30         ` Jiri Kosina
2013-02-20 17:48           ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).