* [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code
@ 2012-05-07 17:59 Thomas Gleixner
2012-05-07 17:59 ` [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation Thomas Gleixner
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra
cpu_idle_wait() is available in several identical copies all over
arch/ plus a broken variant.
This series fixes the broken one first and then replaces all the
identical ones with a generic version.
Thanks,
tglx
----
arch/arm/Kconfig | 3 ---
arch/arm/include/asm/processor.h | 2 --
arch/arm/kernel/process.c | 20 --------------------
arch/ia64/include/asm/processor.h | 1 -
arch/ia64/kernel/process.c | 20 --------------------
arch/powerpc/Kconfig | 4 ----
arch/powerpc/include/asm/processor.h | 1 -
arch/powerpc/kernel/idle.c | 23 -----------------------
arch/sh/Kconfig | 3 ---
arch/sh/include/asm/processor.h | 1 -
arch/sh/kernel/idle.c | 20 --------------------
arch/x86/Kconfig | 3 ---
arch/x86/include/asm/processor.h | 2 --
arch/x86/kernel/apm_32.c | 2 +-
arch/x86/kernel/process.c | 20 --------------------
drivers/cpuidle/cpuidle.c | 13 +------------
include/linux/smp.h | 4 ++++
kernel/smp.c | 23 +++++++++++++++++++++++
18 files changed, 29 insertions(+), 136 deletions(-)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:25 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 2/8] smp: Implement kick_all_cpus_sync() Thomas Gleixner
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML
Cc: Peter Zijlstra, Deepthi Dharwar, Trinabh Gupta, Arun R Bharadwaj,
Benjamin Herrenschmidt
[-- Attachment #1: power-fix-broken-cpu-idle-wait.patch --]
[-- Type: text/plain, Size: 2050 bytes --]
commit 771dae818 (powerpc/cpuidle: Add cpu_idle_wait() to allow
switching of idle routines) implemented cpu_idle_wait() for powerpc.
The changelog says:
"The equivalent routine for x86 is in arch/x86/kernel/process.c
but the powerpc implementation is different.":
Unfortunately the changelog is completely useless as it does not tell
_WHY_ it is different.
Aside of being different the implementation is patently wrong.
The rescheduling IPI is async. That means that there is no guarantee,
that the other cores have executed the IPI when cpu_idle_wait()
returns. But that's the whole purpose of this function: to guarantee
that no CPU uses the old idle handler anymore.
Use the smp_functional_call() based implementation, which fulfils the
requirements.
[ This code is going to replaced by a core version to remove all the
pointless copies in arch/*, but this one should go to stable ]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Cc: Trinabh Gupta <g.trinabh@gmail.com>
Cc: Arun R Bharadwaj <arun.r.bharadwaj@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/idle.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
Index: tip/arch/powerpc/kernel/idle.c
===================================================================
--- tip.orig/arch/powerpc/kernel/idle.c
+++ tip/arch/powerpc/kernel/idle.c
@@ -113,6 +113,9 @@ void cpu_idle(void)
}
}
+static void do_nothing(void *unused)
+{
+}
/*
* cpu_idle_wait - Used to ensure that all the CPUs come out of the old
@@ -123,16 +126,9 @@ void cpu_idle(void)
*/
void cpu_idle_wait(void)
{
- int cpu;
smp_mb();
-
- /* kick all the CPUs so that they exit out of old idle routine */
- get_online_cpus();
- for_each_online_cpu(cpu) {
- if (cpu != smp_processor_id())
- smp_send_reschedule(cpu);
- }
- put_online_cpus();
+ /* kick all the CPUs so that they exit out of pm_idle */
+ smp_call_function(do_nothing, NULL, 1);
}
EXPORT_SYMBOL_GPL(cpu_idle_wait);
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 3/8] cpuidle: Use kick_all_cpus_sync()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
2012-05-07 17:59 ` [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation Thomas Gleixner
2012-05-07 17:59 ` [patch 2/8] smp: Implement kick_all_cpus_sync() Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:26 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 5/8] arm: Remove unused cpu_idle_wait() Thomas Gleixner
` (5 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra
[-- Attachment #1: cpuidle-use-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 1097 bytes --]
kick_all_cpus_sync() is the core implementation of cpu_idle_wait()
which is copied all over the arch code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/cpuidle/cpuidle.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
Index: tip/drivers/cpuidle/cpuidle.c
===================================================================
--- tip.orig/drivers/cpuidle/cpuidle.c
+++ tip/drivers/cpuidle/cpuidle.c
@@ -40,17 +40,6 @@ void disable_cpuidle(void)
off = 1;
}
-#if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT)
-static void cpuidle_kick_cpus(void)
-{
- cpu_idle_wait();
-}
-#elif defined(CONFIG_SMP)
-# error "Arch needs cpu_idle_wait() equivalent here"
-#else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT && !CONFIG_SMP */
-static void cpuidle_kick_cpus(void) {}
-#endif
-
static int __cpuidle_register_device(struct cpuidle_device *dev);
static inline int cpuidle_enter(struct cpuidle_device *dev,
@@ -186,7 +175,7 @@ void cpuidle_uninstall_idle_handler(void
{
if (enabled_devices) {
initialized = 0;
- cpuidle_kick_cpus();
+ kick_all_cpus_sync();
}
}
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 2/8] smp: Implement kick_all_cpus_sync()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
2012-05-07 17:59 ` [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:26 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 3/8] cpuidle: Use kick_all_cpus_sync() Thomas Gleixner
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra
[-- Attachment #1: smp-implement-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 1859 bytes --]
Will replace the misnomed cpu_idle_wait() function which is copied a
gazillion times all over arch/*
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/smp.h | 4 ++++
kernel/smp.c | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+)
Index: tip/include/linux/smp.h
===================================================================
--- tip.orig/include/linux/smp.h
+++ tip/include/linux/smp.h
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpui
int smp_call_function_any(const struct cpumask *mask,
smp_call_func_t func, void *info, int wait);
+void kick_all_cpus_sync(void);
+
/*
* Generic and arch helpers
*/
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpuma
return smp_call_function_single(0, func, info, wait);
}
+static inline void kick_all_cpus_sync(void) { }
+
#endif /* !SMP */
/*
Index: tip/kernel/smp.c
===================================================================
--- tip.orig/kernel/smp.c
+++ tip/kernel/smp.c
@@ -795,3 +795,26 @@ void on_each_cpu_cond(bool (*cond_func)(
}
}
EXPORT_SYMBOL(on_each_cpu_cond);
+
+static void do_nothing(void *unused)
+{
+}
+
+/**
+ * kick_all_cpus_sync - Force all cpus out of idle
+ *
+ * Used to synchronize the update of pm_idle function pointer. It's
+ * called after the pointer is updated and returns after the dummy
+ * callback function has been executed on all cpus. The execution of
+ * the function can only happen on the remote cpus after they have
+ * left the idle function which had been called via pm_idle function
+ * pointer. So it's guaranteed that nothing uses the previous pointer
+ * anymore.
+ */
+void kick_all_cpus_sync(void)
+{
+ /* Make sure the change is visible before we kick the cpus */
+ smp_mb();
+ smp_call_function(do_nothing, NULL, 1);
+}
+EXPORT_SYMBOL_GPL(kick_all_cpus_sync);
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 4/8] x86: Use kick_all_cpus_sync()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
` (3 preceding siblings ...)
2012-05-07 17:59 ` [patch 5/8] arm: Remove unused cpu_idle_wait() Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:27 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 6/8] powerpc: Remove unused cpu_idle_wait() Thomas Gleixner
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra, x86
[-- Attachment #1: x86-use-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 2652 bytes --]
Use kick_all_cpus_sync() and remove cpu_idle_wait().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
---
arch/x86/Kconfig | 3 ---
arch/x86/include/asm/processor.h | 2 --
arch/x86/kernel/apm_32.c | 2 +-
arch/x86/kernel/process.c | 20 --------------------
4 files changed, 1 insertion(+), 26 deletions(-)
Index: tip/arch/x86/Kconfig
===================================================================
--- tip.orig/arch/x86/Kconfig
+++ tip/arch/x86/Kconfig
@@ -161,9 +161,6 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM
def_bool X86_XADD
-config ARCH_HAS_CPU_IDLE_WAIT
- def_bool y
-
config GENERIC_CALIBRATE_DELAY
def_bool y
Index: tip/arch/x86/include/asm/processor.h
===================================================================
--- tip.orig/arch/x86/include/asm/processor.h
+++ tip/arch/x86/include/asm/processor.h
@@ -974,8 +974,6 @@ extern bool cpu_has_amd_erratum(const in
#define cpu_has_amd_erratum(x) (false)
#endif /* CONFIG_CPU_SUP_AMD */
-void cpu_idle_wait(void);
-
extern unsigned long arch_align_stack(unsigned long sp);
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
Index: tip/arch/x86/kernel/apm_32.c
===================================================================
--- tip.orig/arch/x86/kernel/apm_32.c
+++ tip/arch/x86/kernel/apm_32.c
@@ -2401,7 +2401,7 @@ static void __exit apm_exit(void)
* (pm_idle), Wait for all processors to update cached/local
* copies of pm_idle before proceeding.
*/
- cpu_idle_wait();
+ kick_all_cpus_sync();
}
if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0)
&& (apm_info.connection_version > 0x0100)) {
Index: tip/arch/x86/kernel/process.c
===================================================================
--- tip.orig/arch/x86/kernel/process.c
+++ tip/arch/x86/kernel/process.c
@@ -525,26 +525,6 @@ void stop_this_cpu(void *dummy)
}
}
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
/* Default MONITOR/MWAIT with no hints, used for default C1 state */
static void mwait_idle(void)
{
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 5/8] arm: Remove unused cpu_idle_wait()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
` (2 preceding siblings ...)
2012-05-07 17:59 ` [patch 3/8] cpuidle: Use kick_all_cpus_sync() Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:28 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 4/8] x86: Use kick_all_cpus_sync() Thomas Gleixner
` (4 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra, Russell King
[-- Attachment #1: arm-use-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 2038 bytes --]
cpuidle uses a generic function now. Remove the unused code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
---
arch/arm/Kconfig | 3 ---
arch/arm/include/asm/processor.h | 2 --
arch/arm/kernel/process.c | 20 --------------------
3 files changed, 25 deletions(-)
Index: tip/arch/arm/Kconfig
===================================================================
--- tip.orig/arch/arm/Kconfig
+++ tip/arch/arm/Kconfig
@@ -160,9 +160,6 @@ config ARCH_HAS_CPUFREQ
and that the relevant menu configurations are displayed for
it.
-config ARCH_HAS_CPU_IDLE_WAIT
- def_bool y
-
config GENERIC_HWEIGHT
bool
default y
Index: tip/arch/arm/include/asm/processor.h
===================================================================
--- tip.orig/arch/arm/include/asm/processor.h
+++ tip/arch/arm/include/asm/processor.h
@@ -88,8 +88,6 @@ unsigned long get_wchan(struct task_stru
#define cpu_relax() barrier()
#endif
-void cpu_idle_wait(void);
-
/*
* Create a new kernel thread
*/
Index: tip/arch/arm/kernel/process.c
===================================================================
--- tip.orig/arch/arm/kernel/process.c
+++ tip/arch/arm/kernel/process.c
@@ -157,26 +157,6 @@ EXPORT_SYMBOL(pm_power_off);
void (*arm_pm_restart)(char str, const char *cmd) = null_restart;
EXPORT_SYMBOL_GPL(arm_pm_restart);
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
/*
* This is our default idle handler.
*/
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 7/8] ia64: Remove unused cpu_idle_wait()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
` (5 preceding siblings ...)
2012-05-07 17:59 ` [patch 6/8] powerpc: Remove unused cpu_idle_wait() Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:29 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 8/8] sh: Remove cpu_idle_wait() Thomas Gleixner
2012-05-07 20:06 ` [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Peter Zijlstra
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra, Tony Luck
[-- Attachment #1: ia64-use-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 1737 bytes --]
IA64 does not set CONFIG_ARCH_HAVE_IDLE_WAIT and cpuidle uses a
generic function now. Remove the unused code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
---
arch/ia64/include/asm/processor.h | 1 -
arch/ia64/kernel/process.c | 20 --------------------
2 files changed, 21 deletions(-)
Index: tip/arch/ia64/include/asm/processor.h
===================================================================
--- tip.orig/arch/ia64/include/asm/processor.h
+++ tip/arch/ia64/include/asm/processor.h
@@ -723,7 +723,6 @@ extern unsigned long boot_option_idle_ov
enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT,
IDLE_NOMWAIT, IDLE_POLL};
-void cpu_idle_wait(void);
void default_idle(void);
#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
Index: tip/arch/ia64/kernel/process.c
===================================================================
--- tip.orig/arch/ia64/kernel/process.c
+++ tip/arch/ia64/kernel/process.c
@@ -273,26 +273,6 @@ static inline void play_dead(void)
}
#endif /* CONFIG_HOTPLUG_CPU */
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
void __attribute__((noreturn))
cpu_idle (void)
{
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 6/8] powerpc: Remove unused cpu_idle_wait()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
` (4 preceding siblings ...)
2012-05-07 17:59 ` [patch 4/8] x86: Use kick_all_cpus_sync() Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:30 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 7/8] ia64: " Thomas Gleixner
` (2 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra, Benjamin Herrenschmidt
[-- Attachment #1: powerpc-use-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 2035 bytes --]
cpuidle uses a generic function now. Remove the cruft.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/Kconfig | 4 ----
arch/powerpc/include/asm/processor.h | 1 -
arch/powerpc/kernel/idle.c | 19 -------------------
3 files changed, 24 deletions(-)
Index: tip/arch/powerpc/Kconfig
===================================================================
--- tip.orig/arch/powerpc/Kconfig
+++ tip/arch/powerpc/Kconfig
@@ -87,10 +87,6 @@ config ARCH_HAS_ILOG2_U64
bool
default y if 64BIT
-config ARCH_HAS_CPU_IDLE_WAIT
- bool
- default y
-
config GENERIC_HWEIGHT
bool
default y
Index: tip/arch/powerpc/include/asm/processor.h
===================================================================
--- tip.orig/arch/powerpc/include/asm/processor.h
+++ tip/arch/powerpc/include/asm/processor.h
@@ -386,7 +386,6 @@ extern unsigned long cpuidle_disable;
enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
extern int powersave_nap; /* set if nap mode can be used in idle loop */
-void cpu_idle_wait(void);
#ifdef CONFIG_PSERIES_IDLE
extern void update_smt_snooze_delay(int snooze);
Index: tip/arch/powerpc/kernel/idle.c
===================================================================
--- tip.orig/arch/powerpc/kernel/idle.c
+++ tip/arch/powerpc/kernel/idle.c
@@ -113,25 +113,6 @@ void cpu_idle(void)
}
}
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs come out of the old
- * idle loop and start using the new idle loop.
- * Required while changing idle handler on SMP systems.
- * Caller must have changed idle handler to the new value before the call.
- * This window may be larger on shared systems.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
int powersave_nap;
#ifdef CONFIG_SYSCTL
^ permalink raw reply [flat|nested] 18+ messages in thread
* [patch 8/8] sh: Remove cpu_idle_wait()
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
` (6 preceding siblings ...)
2012-05-07 17:59 ` [patch 7/8] ia64: " Thomas Gleixner
@ 2012-05-07 17:59 ` Thomas Gleixner
2012-05-08 12:31 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 20:06 ` [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Peter Zijlstra
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2012-05-07 17:59 UTC (permalink / raw)
To: LKML; +Cc: Peter Zijlstra, Paul Mundt
[-- Attachment #1: sh-use-kick_all_cpus_sync.patch --]
[-- Type: text/plain, Size: 2095 bytes --]
cpuidle uses the generic kick_all_cpus_sync() now. Remove the unused
code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul Mundt <lethal@linux-sh.org>
---
arch/sh/Kconfig | 3 ---
arch/sh/include/asm/processor.h | 1 -
arch/sh/kernel/idle.c | 20 --------------------
3 files changed, 24 deletions(-)
Index: tip/arch/sh/Kconfig
===================================================================
--- tip.orig/arch/sh/Kconfig
+++ tip/arch/sh/Kconfig
@@ -153,9 +153,6 @@ config ARCH_NO_VIRT_TO_BUS
config ARCH_HAS_DEFAULT_IDLE
def_bool y
-config ARCH_HAS_CPU_IDLE_WAIT
- def_bool y
-
config NO_IOPORT
def_bool !PCI
depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN
Index: tip/arch/sh/include/asm/processor.h
===================================================================
--- tip.orig/arch/sh/include/asm/processor.h
+++ tip/arch/sh/include/asm/processor.h
@@ -98,7 +98,6 @@ extern struct sh_cpuinfo cpu_data[];
#define cpu_relax() barrier()
void default_idle(void);
-void cpu_idle_wait(void);
void stop_this_cpu(void *);
/* Forward decl */
Index: tip/arch/sh/kernel/idle.c
===================================================================
--- tip.orig/arch/sh/kernel/idle.c
+++ tip/arch/sh/kernel/idle.c
@@ -132,10 +132,6 @@ void __init select_idle_routine(void)
pm_idle = poll_idle;
}
-static void do_nothing(void *unused)
-{
-}
-
void stop_this_cpu(void *unused)
{
local_irq_disable();
@@ -144,19 +140,3 @@ void stop_this_cpu(void *unused)
for (;;)
cpu_sleep();
}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
` (7 preceding siblings ...)
2012-05-07 17:59 ` [patch 8/8] sh: Remove cpu_idle_wait() Thomas Gleixner
@ 2012-05-07 20:06 ` Peter Zijlstra
8 siblings, 0 replies; 18+ messages in thread
From: Peter Zijlstra @ 2012-05-07 20:06 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: LKML
On Mon, 2012-05-07 at 17:59 +0000, Thomas Gleixner wrote:
> cpu_idle_wait() is available in several identical copies all over
> arch/ plus a broken variant.
>
> This series fixes the broken one first and then replaces all the
> identical ones with a generic version.
>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] powerpc: Fix broken cpu_idle_wait() implementation
2012-05-07 17:59 ` [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation Thomas Gleixner
@ 2012-05-08 12:25 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, g.trinabh, peterz, benh,
arun.r.bharadwaj, tglx, deepthi
Commit-ID: 9cd75e13de2dcf32ecc21c7f277cff3c0ced059e
Gitweb: http://git.kernel.org/tip/9cd75e13de2dcf32ecc21c7f277cff3c0ced059e
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:47 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:05 +0200
powerpc: Fix broken cpu_idle_wait() implementation
commit 771dae818 (powerpc/cpuidle: Add cpu_idle_wait() to allow
switching of idle routines) implemented cpu_idle_wait() for powerpc.
The changelog says:
"The equivalent routine for x86 is in arch/x86/kernel/process.c
but the powerpc implementation is different.":
Unfortunately the changelog is completely useless as it does not tell
_WHY_ it is different.
Aside of being different the implementation is patently wrong.
The rescheduling IPI is async. That means that there is no guarantee,
that the other cores have executed the IPI when cpu_idle_wait()
returns. But that's the whole purpose of this function: to guarantee
that no CPU uses the old idle handler anymore.
Use the smp_functional_call() based implementation, which fulfils the
requirements.
[ This code is going to replaced by a core version to remove all the
pointless copies in arch/*, but this one should go to stable ]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Cc: Trinabh Gupta <g.trinabh@gmail.com>
Cc: Arun R Bharadwaj <arun.r.bharadwaj@gmail.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Link: http://lkml.kernel.org/r/20120507175651.980164748@linutronix.de
Cc: stable@vger.kernel.org
---
arch/powerpc/kernel/idle.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 6d2209a..04d7909 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -113,6 +113,9 @@ void cpu_idle(void)
}
}
+static void do_nothing(void *unused)
+{
+}
/*
* cpu_idle_wait - Used to ensure that all the CPUs come out of the old
@@ -123,16 +126,9 @@ void cpu_idle(void)
*/
void cpu_idle_wait(void)
{
- int cpu;
smp_mb();
-
- /* kick all the CPUs so that they exit out of old idle routine */
- get_online_cpus();
- for_each_online_cpu(cpu) {
- if (cpu != smp_processor_id())
- smp_send_reschedule(cpu);
- }
- put_online_cpus();
+ /* kick all the CPUs so that they exit out of pm_idle */
+ smp_call_function(do_nothing, NULL, 1);
}
EXPORT_SYMBOL_GPL(cpu_idle_wait);
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] smp: Implement kick_all_cpus_sync()
2012-05-07 17:59 ` [patch 2/8] smp: Implement kick_all_cpus_sync() Thomas Gleixner
@ 2012-05-08 12:26 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:26 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx
Commit-ID: f37f435f33717dcf15fd4bb422da739da7fc2052
Gitweb: http://git.kernel.org/tip/f37f435f33717dcf15fd4bb422da739da7fc2052
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:48 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:06 +0200
smp: Implement kick_all_cpus_sync()
Will replace the misnomed cpu_idle_wait() function which is copied a
gazillion times all over arch/*
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120507175652.049316594@linutronix.de
---
include/linux/smp.h | 4 ++++
kernel/smp.c | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 24360de..717fb74 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data,
int smp_call_function_any(const struct cpumask *mask,
smp_call_func_t func, void *info, int wait);
+void kick_all_cpus_sync(void);
+
/*
* Generic and arch helpers
*/
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
return smp_call_function_single(0, func, info, wait);
}
+static inline void kick_all_cpus_sync(void) { }
+
#endif /* !SMP */
/*
diff --git a/kernel/smp.c b/kernel/smp.c
index a61294c..d0ae5b2 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -795,3 +795,26 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
}
}
EXPORT_SYMBOL(on_each_cpu_cond);
+
+static void do_nothing(void *unused)
+{
+}
+
+/**
+ * kick_all_cpus_sync - Force all cpus out of idle
+ *
+ * Used to synchronize the update of pm_idle function pointer. It's
+ * called after the pointer is updated and returns after the dummy
+ * callback function has been executed on all cpus. The execution of
+ * the function can only happen on the remote cpus after they have
+ * left the idle function which had been called via pm_idle function
+ * pointer. So it's guaranteed that nothing uses the previous pointer
+ * anymore.
+ */
+void kick_all_cpus_sync(void)
+{
+ /* Make sure the change is visible before we kick the cpus */
+ smp_mb();
+ smp_call_function(do_nothing, NULL, 1);
+}
+EXPORT_SYMBOL_GPL(kick_all_cpus_sync);
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] cpuidle: Use kick_all_cpus_sync()
2012-05-07 17:59 ` [patch 3/8] cpuidle: Use kick_all_cpus_sync() Thomas Gleixner
@ 2012-05-08 12:26 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:26 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx
Commit-ID: 4a1625133d4faaefcec0dc175941f49b186918d9
Gitweb: http://git.kernel.org/tip/4a1625133d4faaefcec0dc175941f49b186918d9
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:48 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:06 +0200
cpuidle: Use kick_all_cpus_sync()
kick_all_cpus_sync() is the core implementation of cpu_idle_wait()
which is copied all over the arch code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120507175652.119842173@linutronix.de
---
drivers/cpuidle/cpuidle.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 2f0083a..d90519c 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -40,17 +40,6 @@ void disable_cpuidle(void)
off = 1;
}
-#if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT)
-static void cpuidle_kick_cpus(void)
-{
- cpu_idle_wait();
-}
-#elif defined(CONFIG_SMP)
-# error "Arch needs cpu_idle_wait() equivalent here"
-#else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT && !CONFIG_SMP */
-static void cpuidle_kick_cpus(void) {}
-#endif
-
static int __cpuidle_register_device(struct cpuidle_device *dev);
static inline int cpuidle_enter(struct cpuidle_device *dev,
@@ -186,7 +175,7 @@ void cpuidle_uninstall_idle_handler(void)
{
if (enabled_devices) {
initialized = 0;
- cpuidle_kick_cpus();
+ kick_all_cpus_sync();
}
}
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] x86: Use kick_all_cpus_sync()
2012-05-07 17:59 ` [patch 4/8] x86: Use kick_all_cpus_sync() Thomas Gleixner
@ 2012-05-08 12:27 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:27 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx
Commit-ID: 85f7f656274fa0ba109dd8774db3887d42de5c6b
Gitweb: http://git.kernel.org/tip/85f7f656274fa0ba109dd8774db3887d42de5c6b
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:49 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:06 +0200
x86: Use kick_all_cpus_sync()
Use kick_all_cpus_sync() and remove cpu_idle_wait().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120507175652.190382227@linutronix.de
Cc: x86@kernel.org
---
arch/x86/Kconfig | 3 ---
arch/x86/include/asm/processor.h | 2 --
arch/x86/kernel/apm_32.c | 2 +-
arch/x86/kernel/process.c | 20 --------------------
4 files changed, 1 insertions(+), 26 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 046bf4b..98876f5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -161,9 +161,6 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM
def_bool X86_XADD
-config ARCH_HAS_CPU_IDLE_WAIT
- def_bool y
-
config GENERIC_CALIBRATE_DELAY
def_bool y
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 4fa7dcc..ccbb1ea 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -974,8 +974,6 @@ extern bool cpu_has_amd_erratum(const int *);
#define cpu_has_amd_erratum(x) (false)
#endif /* CONFIG_CPU_SUP_AMD */
-void cpu_idle_wait(void);
-
extern unsigned long arch_align_stack(unsigned long sp);
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 459e78c..07b0c0d 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -2401,7 +2401,7 @@ static void __exit apm_exit(void)
* (pm_idle), Wait for all processors to update cached/local
* copies of pm_idle before proceeding.
*/
- cpu_idle_wait();
+ kick_all_cpus_sync();
}
if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0)
&& (apm_info.connection_version > 0x0100)) {
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 8aa532f..8215458 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -525,26 +525,6 @@ void stop_this_cpu(void *dummy)
}
}
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
/* Default MONITOR/MWAIT with no hints, used for default C1 state */
static void mwait_idle(void)
{
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] arm: Remove unused cpu_idle_wait()
2012-05-07 17:59 ` [patch 5/8] arm: Remove unused cpu_idle_wait() Thomas Gleixner
@ 2012-05-08 12:28 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:28 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, linux, peterz, tglx
Commit-ID: 448eca90932d97856b6a6097fc50eef96d77dec0
Gitweb: http://git.kernel.org/tip/448eca90932d97856b6a6097fc50eef96d77dec0
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:49 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:06 +0200
arm: Remove unused cpu_idle_wait()
cpuidle uses a generic function now. Remove the unused code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>
Link: http://lkml.kernel.org/r/20120507175652.260797846@linutronix.de
---
arch/arm/Kconfig | 3 ---
arch/arm/include/asm/processor.h | 2 --
arch/arm/kernel/process.c | 20 --------------------
3 files changed, 0 insertions(+), 25 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cb253ce..a3ad496 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -160,9 +160,6 @@ config ARCH_HAS_CPUFREQ
and that the relevant menu configurations are displayed for
it.
-config ARCH_HAS_CPU_IDLE_WAIT
- def_bool y
-
config GENERIC_HWEIGHT
bool
default y
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 5ac8d3d..d7038fa 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -88,8 +88,6 @@ unsigned long get_wchan(struct task_struct *p);
#define cpu_relax() barrier()
#endif
-void cpu_idle_wait(void);
-
/*
* Create a new kernel thread
*/
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 2b7b017..19c95ea 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -157,26 +157,6 @@ EXPORT_SYMBOL(pm_power_off);
void (*arm_pm_restart)(char str, const char *cmd) = null_restart;
EXPORT_SYMBOL_GPL(arm_pm_restart);
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
/*
* This is our default idle handler.
*/
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] ia64: Remove unused cpu_idle_wait()
2012-05-07 17:59 ` [patch 7/8] ia64: " Thomas Gleixner
@ 2012-05-08 12:29 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:29 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tony.luck, tglx
Commit-ID: bbe78cbd729f85c4da6e04f45c8b2de43c3573f1
Gitweb: http://git.kernel.org/tip/bbe78cbd729f85c4da6e04f45c8b2de43c3573f1
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:50 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:06 +0200
ia64: Remove unused cpu_idle_wait()
IA64 does not set CONFIG_ARCH_HAVE_IDLE_WAIT and cpuidle uses a
generic function now. Remove the unused code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/20120507175652.392394511@linutronix.de
---
arch/ia64/include/asm/processor.h | 1 -
arch/ia64/kernel/process.c | 20 --------------------
2 files changed, 0 insertions(+), 21 deletions(-)
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 483f6c6..f92f67a 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -723,7 +723,6 @@ extern unsigned long boot_option_idle_override;
enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT,
IDLE_NOMWAIT, IDLE_POLL};
-void cpu_idle_wait(void);
void default_idle(void);
#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index ce74e14..5e0e86d 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -273,26 +273,6 @@ static inline void play_dead(void)
}
#endif /* CONFIG_HOTPLUG_CPU */
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
void __attribute__((noreturn))
cpu_idle (void)
{
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] powerpc: Remove unused cpu_idle_wait()
2012-05-07 17:59 ` [patch 6/8] powerpc: Remove unused cpu_idle_wait() Thomas Gleixner
@ 2012-05-08 12:30 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:30 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, benh, peterz, tglx
Commit-ID: c9b92b840705542a1ae50b5407154a5595d17359
Gitweb: http://git.kernel.org/tip/c9b92b840705542a1ae50b5407154a5595d17359
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:50 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:07 +0200
powerpc: Remove unused cpu_idle_wait()
cpuidle uses a generic function now. Remove the cruft.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Link: http://lkml.kernel.org/r/20120507175652.330322737@linutronix.de
---
arch/powerpc/Kconfig | 4 ----
arch/powerpc/include/asm/processor.h | 1 -
arch/powerpc/kernel/idle.c | 19 -------------------
3 files changed, 0 insertions(+), 24 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c815535..296e4f9 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -87,10 +87,6 @@ config ARCH_HAS_ILOG2_U64
bool
default y if 64BIT
-config ARCH_HAS_CPU_IDLE_WAIT
- bool
- default y
-
config GENERIC_HWEIGHT
bool
default y
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 8e2d037..48a26d3 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -386,7 +386,6 @@ extern unsigned long cpuidle_disable;
enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
extern int powersave_nap; /* set if nap mode can be used in idle loop */
-void cpu_idle_wait(void);
#ifdef CONFIG_PSERIES_IDLE
extern void update_smt_snooze_delay(int snooze);
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 04d7909..2099d9a 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -113,25 +113,6 @@ void cpu_idle(void)
}
}
-static void do_nothing(void *unused)
-{
-}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs come out of the old
- * idle loop and start using the new idle loop.
- * Required while changing idle handler on SMP systems.
- * Caller must have changed idle handler to the new value before the call.
- * This window may be larger on shared systems.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
-
int powersave_nap;
#ifdef CONFIG_SYSCTL
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [tip:smp/hotplug] sh: Remove cpu_idle_wait()
2012-05-07 17:59 ` [patch 8/8] sh: Remove cpu_idle_wait() Thomas Gleixner
@ 2012-05-08 12:31 ` tip-bot for Thomas Gleixner
0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:31 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, lethal, tglx
Commit-ID: 86627c93b35082f7a0e4d3111546943984b932c7
Gitweb: http://git.kernel.org/tip/86627c93b35082f7a0e4d3111546943984b932c7
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:51 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:07 +0200
sh: Remove cpu_idle_wait()
cpuidle uses generic kick_all_cpus_sync() now. Remove the unused code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Link: http://lkml.kernel.org/r/20120507175652.461648208@linutronix.de
---
arch/sh/Kconfig | 3 ---
arch/sh/include/asm/processor.h | 1 -
arch/sh/kernel/idle.c | 20 --------------------
3 files changed, 0 insertions(+), 24 deletions(-)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 244cfd0..04a8cb4 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -153,9 +153,6 @@ config ARCH_NO_VIRT_TO_BUS
config ARCH_HAS_DEFAULT_IDLE
def_bool y
-config ARCH_HAS_CPU_IDLE_WAIT
- def_bool y
-
config NO_IOPORT
def_bool !PCI
depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 6d87912..6dbc1be 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -98,7 +98,6 @@ extern struct sh_cpuinfo cpu_data[];
#define cpu_relax() barrier()
void default_idle(void);
-void cpu_idle_wait(void);
void stop_this_cpu(void *);
/* Forward decl */
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index ee226e2..0c91016 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -132,10 +132,6 @@ void __init select_idle_routine(void)
pm_idle = poll_idle;
}
-static void do_nothing(void *unused)
-{
-}
-
void stop_this_cpu(void *unused)
{
local_irq_disable();
@@ -144,19 +140,3 @@ void stop_this_cpu(void *unused)
for (;;)
cpu_sleep();
}
-
-/*
- * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
- * pm_idle and update to new pm_idle value. Required while changing pm_idle
- * handler on SMP systems.
- *
- * Caller must have changed pm_idle to the new value before the call. Old
- * pm_idle value will not be used by any CPU after the return of this function.
- */
-void cpu_idle_wait(void)
-{
- smp_mb();
- /* kick all the CPUs so that they exit out of pm_idle */
- smp_call_function(do_nothing, NULL, 1);
-}
-EXPORT_SYMBOL_GPL(cpu_idle_wait);
^ permalink raw reply related [flat|nested] 18+ messages in thread
end of thread, other threads:[~2012-05-08 12:31 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
2012-05-07 17:59 ` [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation Thomas Gleixner
2012-05-08 12:25 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 2/8] smp: Implement kick_all_cpus_sync() Thomas Gleixner
2012-05-08 12:26 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 3/8] cpuidle: Use kick_all_cpus_sync() Thomas Gleixner
2012-05-08 12:26 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 5/8] arm: Remove unused cpu_idle_wait() Thomas Gleixner
2012-05-08 12:28 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 4/8] x86: Use kick_all_cpus_sync() Thomas Gleixner
2012-05-08 12:27 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 6/8] powerpc: Remove unused cpu_idle_wait() Thomas Gleixner
2012-05-08 12:30 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 7/8] ia64: " Thomas Gleixner
2012-05-08 12:29 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 8/8] sh: Remove cpu_idle_wait() Thomas Gleixner
2012-05-08 12:31 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 20:06 ` [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox