cpuidle: Fix and replace cpu_idle_wait copied code
Subsystems (6)
cover cpuidle: Fix and replace cpu_idle_wait copied code
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(-)
PATCH 1/8 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 ]
--- arch/powerpc/kernel/idle.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
arch/powerpc/kernel/idle.c +5 -9
@@ -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);
[tip:smp/hotplug] powerpc: Fix broken cpu_idle_wait() implementation
Commit-ID: 9cd75e13de2dcf32ecc21c7f277cff3c0ced059e Gitweb: http://git.kernel.org/tip/9cd75e13de2dcf32ecc21c7f277cff3c0ced059e Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:47 +0000 Committer: Thomas Gleixner <[email protected]> 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 ]
--- arch/powerpc/kernel/idle.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
arch/powerpc/kernel/idle.c +5 -9
@@ -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);
PATCH 2/8 smp: Implement kick_all_cpus_sync()
In reply to Thomas GleixnerWill replace the misnomed cpu_idle_wait() function which is copied a gazillion times all over arch/*
--- include/linux/smp.h | 4 ++++ kernel/smp.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+)
include/linux/smp.h +4 -0
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuiint 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 */ /*
kernel/smp.c +23 -0
@@ -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);
[tip:smp/hotplug] smp: Implement kick_all_cpus_sync()
Commit-ID: f37f435f33717dcf15fd4bb422da739da7fc2052 Gitweb: http://git.kernel.org/tip/f37f435f33717dcf15fd4bb422da739da7fc2052 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:48 +0000 Committer: Thomas Gleixner <[email protected]> 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/*
--- include/linux/smp.h | 4 ++++ kernel/smp.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-)
include/linux/smp.h +4 -0
@@ -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 */ /*
kernel/smp.c +23 -0
@@ -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);
PATCH 3/8 cpuidle: Use kick_all_cpus_sync()
In reply to Thomas Gleixnerkick_all_cpus_sync() is the core implementation of cpu_idle_wait() which is copied all over the arch code.
--- drivers/cpuidle/cpuidle.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/cpuidle/cpuidle.c +1 -12
@@ -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 (); } }
[tip:smp/hotplug] cpuidle: Use kick_all_cpus_sync()
Commit-ID: 4a1625133d4faaefcec0dc175941f49b186918d9 Gitweb: http://git.kernel.org/tip/4a1625133d4faaefcec0dc175941f49b186918d9 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:48 +0000 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/cpuidle/cpuidle.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)
drivers/cpuidle/cpuidle.c +1 -12
@@ -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 (); } }
PATCH 4/8 x86: Use kick_all_cpus_sync()
In reply to Thomas GleixnerUse kick_all_cpus_sync() and remove cpu_idle_wait().
--- 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(-)
arch/x86/Kconfig +0 -3
@@ -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
arch/x86/include/asm/processor.h +0 -2
@@ -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);
arch/x86/kernel/apm_32.c +1 -1
@@ -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 )) {
arch/x86/kernel/process.c +0 -20
@@ -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 ) {
[tip:smp/hotplug] x86: Use kick_all_cpus_sync()
Commit-ID: 85f7f656274fa0ba109dd8774db3887d42de5c6b Gitweb: http://git.kernel.org/tip/85f7f656274fa0ba109dd8774db3887d42de5c6b Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:49 +0000 Committer: Thomas Gleixner <[email protected]> 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().
--- 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(-)
arch/x86/Kconfig +0 -3
@@ -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
arch/x86/include/asm/processor.h +0 -2
@@ -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);
arch/x86/kernel/apm_32.c +1 -1
@@ -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 )) {
arch/x86/kernel/process.c +0 -20
@@ -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 ) {
PATCH 5/8 arm: Remove unused cpu_idle_wait()
In reply to Thomas Gleixnercpuidle uses a generic function now. Remove the unused code.
--- arch/arm/Kconfig | 3 --- arch/arm/include/asm/processor.h | 2 -- arch/arm/kernel/process.c | 20 -------------------- 3 files changed, 25 deletions(-)
arch/arm/Kconfig +0 -3
@@ -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
arch/arm/include/asm/processor.h +0 -2
@@ -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 */
arch/arm/kernel/process.c +0 -20
@@ -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. */
[tip:smp/hotplug] arm: Remove unused cpu_idle_wait()
Commit-ID: 448eca90932d97856b6a6097fc50eef96d77dec0 Gitweb: http://git.kernel.org/tip/448eca90932d97856b6a6097fc50eef96d77dec0 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:49 +0000 Committer: Thomas Gleixner <[email protected]> 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.
--- arch/arm/Kconfig | 3 --- arch/arm/include/asm/processor.h | 2 -- arch/arm/kernel/process.c | 20 -------------------- 3 files changed, 0 insertions(+), 25 deletions(-)
arch/arm/Kconfig +0 -3
@@ -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
arch/arm/include/asm/processor.h +0 -2
@@ -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 */
arch/arm/kernel/process.c +0 -20
@@ -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. */
PATCH 6/8 powerpc: Remove unused cpu_idle_wait()
In reply to Thomas Gleixnercpuidle uses a generic function now. Remove the cruft.
--- arch/powerpc/Kconfig | 4 ---- arch/powerpc/include/asm/processor.h | 1 - arch/powerpc/kernel/idle.c | 19 ------------------- 3 files changed, 24 deletions(-)
arch/powerpc/Kconfig +0 -4
@@ -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
arch/powerpc/include/asm/processor.h +0 -1
@@ -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);
arch/powerpc/kernel/idle.c +0 -19
@@ -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
[tip:smp/hotplug] powerpc: Remove unused cpu_idle_wait()
Commit-ID: c9b92b840705542a1ae50b5407154a5595d17359 Gitweb: http://git.kernel.org/tip/c9b92b840705542a1ae50b5407154a5595d17359 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:50 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 8 May 2012 12:35:07 +0200
powerpc: Remove unused cpu_idle_wait()
cpuidle uses a generic function now. Remove the cruft.
--- arch/powerpc/Kconfig | 4 ---- arch/powerpc/include/asm/processor.h | 1 - arch/powerpc/kernel/idle.c | 19 ------------------- 3 files changed, 0 insertions(+), 24 deletions(-)
arch/powerpc/Kconfig +0 -4
@@ -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
arch/powerpc/include/asm/processor.h +0 -1
@@ -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);
arch/powerpc/kernel/idle.c +0 -19
@@ -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
PATCH 7/8 ia64: Remove unused cpu_idle_wait()
In reply to Thomas GleixnerIA64 does not set CONFIG_ARCH_HAVE_IDLE_WAIT and cpuidle uses a generic function now. Remove the unused code.
--- arch/ia64/include/asm/processor.h | 1 - arch/ia64/kernel/process.c | 20 -------------------- 2 files changed, 21 deletions(-)
arch/ia64/include/asm/processor.h +0 -1
@@ -723,7 +723,6 @@ extern unsigned long boot_option_idle_ovenum 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)
arch/ia64/kernel/process.c +0 -20
@@ -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 ) {
[tip:smp/hotplug] ia64: Remove unused cpu_idle_wait()
Commit-ID: bbe78cbd729f85c4da6e04f45c8b2de43c3573f1 Gitweb: http://git.kernel.org/tip/bbe78cbd729f85c4da6e04f45c8b2de43c3573f1 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:50 +0000 Committer: Thomas Gleixner <[email protected]> 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.
--- arch/ia64/include/asm/processor.h | 1 - arch/ia64/kernel/process.c | 20 -------------------- 2 files changed, 0 insertions(+), 21 deletions(-)
arch/ia64/include/asm/processor.h +0 -1
@@ -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)
arch/ia64/kernel/process.c +0 -20
@@ -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 ) {
PATCH 8/8 sh: Remove cpu_idle_wait()
In reply to Thomas Gleixnercpuidle uses the generic kick_all_cpus_sync() now. Remove the unused code.
--- arch/sh/Kconfig | 3 --- arch/sh/include/asm/processor.h | 1 - arch/sh/kernel/idle.c | 20 -------------------- 3 files changed, 24 deletions(-)
arch/sh/Kconfig +0 -3
@@ -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
arch/sh/include/asm/processor.h +0 -1
@@ -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 */
arch/sh/kernel/idle.c +0 -20
@@ -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);
[tip:smp/hotplug] sh: Remove cpu_idle_wait()
Commit-ID: 86627c93b35082f7a0e4d3111546943984b932c7 Gitweb: http://git.kernel.org/tip/86627c93b35082f7a0e4d3111546943984b932c7 Author: Thomas Gleixner <[email protected]> AuthorDate: Mon, 7 May 2012 17:59:51 +0000 Committer: Thomas Gleixner <[email protected]> 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.
--- arch/sh/Kconfig | 3 --- arch/sh/include/asm/processor.h | 1 - arch/sh/kernel/idle.c | 20 -------------------- 3 files changed, 0 insertions(+), 24 deletions(-)
arch/sh/Kconfig +0 -3
@@ -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
arch/sh/include/asm/processor.h +0 -1
@@ -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 */
arch/sh/kernel/idle.c +0 -20
@@ -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);
Quoted 6 lines · Thomas Gleixner
cpu_idle_wait()is available in several identical copies all overarch/plus a broken variant.This series fixes the broken one first and then replaces all the identical ones with a generic version.