pm_idle cleanup patch series
Subsystems (13)
Len Brown
reviewerPATCH 1/16 APM idle: register apm_cpu_idle via cpuidle
In reply to Len BrownFrom: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting pm_idle to modules on x86.
The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.
Compile-tested only.
--- arch/x86/Kconfig | 1 + arch/x86/kernel/apm_32.c | 58 +++++++++++++++++++++++++++++------------------ arch/x86/kernel/process.c | 3 --- 3 files changed, 37 insertions(+), 25 deletions(-)
arch/x86/Kconfig +1 -0
@@ -1912,6 +1912,7 @@ config APM_DO_ENABLE this feature. config APM_CPU_IDLE + depends on CPU_IDLE bool "Make CPU Idle calls when idle" ---help--- Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.
arch/x86/kernel/apm_32.c +36 -22
124 lines not on this page · raw message
arch/x86/kernel/process.c +0 -3
@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);* Powermanagement idle function, if any.. */ void (*pm_idle)(void ); -#ifdef CONFIG_APM_MODULE -EXPORT_SYMBOL (pm_idle); -#endif #ifndef CONFIG_SMP static inline void play_dead (void )
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 2/16 x86 idle: rename global pm_idle to static x86_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
(pm_idle)() is being removed from linux/pm.h
because Linux does not have such a cross-architecture concept.
x86 uses an idle function pointer in its architecture specific code as a backup to cpuidle. So we re-name x86 use of pm_idle to x86_idle, and make it static to x86.
--- arch/x86/kernel/process.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
arch/x86/kernel/process.c +12 -16
@@ -268,10 +268,7 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,unsigned long boot_option_idle_override =IDLE_NO_OVERRIDE ;EXPORT_SYMBOL (boot_option_idle_override); -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ); +static void (*x86_idle)(void );#ifndef CONFIG_SMP static inline void play_dead (void )
@@ -348,7 +345,7 @@ void cpu_idle(void)rcu_idle_enter ();if (cpuidle_idle_call ()) -pm_idle (); +x86_idle ();rcu_idle_exit ();start_critical_timings ();
@@ -395,9 +392,9 @@ EXPORT_SYMBOL(default_idle);bool set_pm_idle_to_default (void ) { -bool ret = !!pm_idle; +bool ret = !!x86_idle; - pm_idle = default_idle; + x86_idle = default_idle;return ret; }
@@ -564,11 +561,10 @@ static void amd_e400_idle(void)void __cpuinit select_idle_routine (const struct cpuinfo_x86 *c) {#ifdef CONFIG_SMP -if (pm_idle == poll_idle && smp_num_siblings >1 ) { +if (x86_idle == poll_idle && smp_num_siblings >1 )pr_warn_once ("WARNING: polling idle and HT enabled, performance may degrade\n" ); - }#endif -if (pm_idle) +if (x86_idle)return ;if (cpu_has (c,X86_FEATURE_MWAIT ) &&mwait_usable (c)) {
@@ -576,19 +572,19 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)* One CPU supports mwait => All CPUs supports mwait */ pr_info ("using mwait in idle threads\n" ); - pm_idle = mwait_idle; + x86_idle = mwait_idle; }else if (cpu_has_amd_erratum (amd_erratum_400)) {/* E400: APIC timer interrupt does not wake up CPU from C1e */ pr_info ("using AMD E400 aware idle routine\n" ); - pm_idle = amd_e400_idle; + x86_idle = amd_e400_idle; }else - pm_idle = default_idle; + x86_idle = default_idle; }void __init init_amd_e400_c1e_mask (void ) {/* If we're using amd_e400_idle, we need to allocate amd_e400_c1e_mask. */ -if (pm_idle == amd_e400_idle) +if (x86_idle == amd_e400_idle)zalloc_cpumask_var (&amd_e400_c1e_mask,GFP_KERNEL ); }
@@ -599,7 +595,7 @@ static int __init idle_setup(char *str)if (!strcmp (str,"poll" )) {pr_info ("using polling idle threads\n" ); - pm_idle = poll_idle; + x86_idle = poll_idle; boot_option_idle_override =IDLE_POLL ; }else if (!strcmp (str,"mwait" )) { boot_option_idle_override =IDLE_FORCE_MWAIT ;
@@ -612,7 +608,7 @@ static int __init idle_setup(char *str)* To continue to load the CPU idle driver, don't touch * the boot_option_idle_override. */ - pm_idle = default_idle; + x86_idle = default_idle; boot_option_idle_override =IDLE_HALT ; }else if (!strcmp (str,"nomwait" )) {/*
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 3/16 sh idle: rename global pm_idle to static sh_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
SH idle code could use some simplification. This patch enables that by guaranteeing
that "sh_idle" is local, and thus architecture specific.
--- arch/sh/kernel/idle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/sh/kernel/idle.c +6 -6
@@ -22,7 +22,7 @@#include <asm/smp.h> #include <asm/bl_bit.h> -void (*pm_idle)(void ); +static void (*sh_idle)(void );static int hlt_counter;
@@ -103,9 +103,9 @@ void cpu_idle(void)/* Don't trace irqs off for idle */ stop_critical_timings ();if (cpuidle_idle_call ()) -pm_idle (); +sh_idle ();/* -* Sanity check to ensure that pm_idle() returns +* Sanity check to ensure that sh_idle() returns * with IRQs enabled */ WARN_ON (irqs_disabled ());
@@ -123,13 +123,13 @@ void __init select_idle_routine(void)/* * If a platform has set its own idle routine, leave it alone. */ -if (pm_idle) +if (sh_idle)return ;if (hlt_works ()) - pm_idle = default_idle; + sh_idle = default_idle;else - pm_idle = poll_idle; + sh_idle = poll_idle; }void stop_this_cpu (void *unused)
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 4/16 sparc idle: rename pm_idle to sparc_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
(pm_idle)() is being removed from linux/pm.h
because Linux does not have such a cross-architecture concept.
sparc uses an idle function pointer in its architecture specific code. So we re-name sparc use of pm_idle to sparc_idle.
Maybe some day, SPARC will cut over to cpuidle...
--- arch/sparc/include/asm/processor.h | 1 + arch/sparc/kernel/apc.c | 3 ++- arch/sparc/kernel/leon_pmc.c | 5 +++-- arch/sparc/kernel/pmc.c | 3 ++- arch/sparc/kernel/process_32.c | 7 +++---- 5 files changed, 11 insertions(+), 8 deletions(-)
arch/sparc/include/asm/processor.h +1 -0
@@ -7,5 +7,6 @@#endif #define nop () __asm__ __volatile__ ("nop") +extern void (*sparc_idle)(void );#endif
arch/sparc/kernel/apc.c +2 -1
@@ -20,6 +20,7 @@#include <asm/uaccess.h> #include <asm/auxio.h> #include <asm/apc.h> +#include <asm/processor.h> /* Debugging *
@@ -158,7 +159,7 @@ static int apc_probe(struct platform_device *op)/* Assign power management IDLE handler */ if (!apc_no_idle) - pm_idle = apc_swift_idle; + sparc_idle = apc_swift_idle;printk (KERN_INFO "%s: power management initialized%s\n" ,APC_DEVNAME , apc_no_idle ?" (CPU idle disabled)" :"" );
arch/sparc/kernel/leon_pmc.c +3 -2
@@ -9,6 +9,7 @@#include <asm/leon_amba.h> #include <asm/cpu_type.h> #include <asm/leon.h> +#include <asm/processor.h> /* List of Systems that need fixup instructions around power-down instruction */ unsigned int pmc_leon_fixup_ids[] = {
@@ -69,9 +70,9 @@ static int __init leon_pmc_install(void)if (sparc_cpu_model = sparc_leon) {/* Assign power management IDLE handler */ if (pmc_leon_need_fixup ()) - pm_idle = pmc_leon_idle_fixup; + sparc_idle = pmc_leon_idle_fixup;else - pm_idle = pmc_leon_idle; + sparc_idle = pmc_leon_idle;printk (KERN_INFO "leon: power management initialized\n" ); }
arch/sparc/kernel/pmc.c +2 -1
@@ -17,6 +17,7 @@#include <asm/oplib.h> #include <asm/uaccess.h> #include <asm/auxio.h> +#include <asm/processor.h> /* Debug *
@@ -63,7 +64,7 @@ static int pmc_probe(struct platform_device *op)#ifndef PMC_NO_IDLE /* Assign power management IDLE handler */ - pm_idle = pmc_swift_idle; + sparc_idle = pmc_swift_idle;#endif printk (KERN_INFO "%s: power management initialized\n" ,PMC_DEVNAME );
arch/sparc/kernel/process_32.c +3 -4
@@ -43,8 +43,7 @@* Power management idle function * Set in pm platform drivers (apc.c and pmc.c) */ -void (*pm_idle)(void ); -EXPORT_SYMBOL (pm_idle); +void (*sparc_idle)(void );/* * Power-off handler instantiation for pm.h compliance
@@ -75,8 +74,8 @@ void cpu_idle(void)/* endless idle loop with no priority at all */ for (;;) {while (!need_resched ()) { -if (pm_idle) - (*pm_idle)(); +if (sparc_idle) + (*sparc_idle)();else cpu_relax (); }
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 5/16 blackfin idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle is dead code on blackfin.
--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)
arch/blackfin/kernel/process.c +0 -7
@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);
@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;#ifdef CONFIG_HOTPLUG_CPU if (cpu_is_offline (smp_processor_id ()))
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 6/16 ARM idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle() on ARM was a synonym for default_idle(), so simply invoke default_idle() directly.
--- arch/arm/kernel/process.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/arm/kernel/process.c +4 -9
@@ -172,14 +172,9 @@ static void default_idle(void)local_irq_enable (); } -void (*pm_idle)(void ) = default_idle; -EXPORT_SYMBOL (pm_idle); -/* -* The idle thread, has rather strange semantics for calling pm_idle, -* but this is what x86 does and we need to do the same, so that -* things like cpuidle get called in the same way. The only difference -* is that we always respect 'hlt_counter' to prevent low power idle. +* The idle thread. +* We always respect 'hlt_counter' to prevent low power idle. */ void cpu_idle (void ) {
@@ -210,10 +205,10 @@ void cpu_idle(void) }else if (!need_resched ()) {stop_critical_timings ();if (cpuidle_idle_call ()) -pm_idle (); +default_idle ();start_critical_timings ();/* -* pm_idle functions must always +* default_idle functions must always * return with IRQs enabled. */ WARN_ON (irqs_disabled ());
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 7/16 ARM64 idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle() on arm64 was a synonym for default_idle(), so remove it and invoke default_idle() directly.
--- arch/arm64/kernel/process.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/arm64/kernel/process.c +4 -9
@@ -97,14 +97,9 @@ static void default_idle(void)local_irq_enable (); } -void (*pm_idle)(void ) = default_idle; -EXPORT_SYMBOL_GPL (pm_idle); -/* -* The idle thread, has rather strange semantics for calling pm_idle, -* but this is what x86 does and we need to do the same, so that -* things like cpuidle get called in the same way. The only difference -* is that we always respect 'hlt_counter' to prevent low power idle. +* The idle thread. +* We always respect 'hlt_counter' to prevent low power idle. */ void cpu_idle (void ) {
@@ -122,10 +117,10 @@ void cpu_idle(void)local_irq_disable ();if (!need_resched ()) {stop_critical_timings (); -pm_idle (); +default_idle ();start_critical_timings ();/* -* pm_idle functions should always return +* default_idle functions should always return * with IRQs enabled. */ WARN_ON (irqs_disabled ());
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 8/16 cris idle: delete idle and pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle() and idle() served no purpose on cris --
invoke default_idle() directly.
--- arch/cris/kernel/process.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
arch/cris/kernel/process.c +1 -10
@@ -54,11 +54,6 @@ void enable_hlt(void)EXPORT_SYMBOL (enable_hlt); -/* -* The following aren't currently used. -*/ -void (*pm_idle)(void ); -extern void default_idle (void );void (*pm_power_off)(void );
@@ -77,16 +72,12 @@ void cpu_idle (void)while (1 ) {rcu_idle_enter ();while (!need_resched ()) { -void (*idle)(void );/* * Mark this as an RCU critical section so that * synchronize_kernel() in the unload path waits * for our completion. */ - idle = pm_idle; -if (!idle) - idle = default_idle; -idle (); +default_idle (); }rcu_idle_exit ();schedule_preempt_disabled ();
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 9/16 ia64 idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle() on ia64 was a synonym for default_idle(). So simply invoke default_idle() directly.
--- arch/ia64/kernel/process.c | 3 --- arch/ia64/kernel/setup.c | 1 - 2 files changed, 4 deletions(-)
arch/ia64/kernel/process.c +0 -3
@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);unsigned long boot_option_idle_override =IDLE_NO_OVERRIDE ;EXPORT_SYMBOL (boot_option_idle_override); -void (*pm_idle) (void ); -EXPORT_SYMBOL (pm_idle);void (*pm_power_off) (void );EXPORT_SYMBOL (pm_power_off);
@@ -301,7 +299,6 @@ cpu_idle (void)if (mark_idle) (*mark_idle)(1 ); - idle = pm_idle;if (!idle) idle = default_idle; (*idle)();
arch/ia64/kernel/setup.c +0 -1
@@ -1051,7 +1051,6 @@ cpu_init (void) max_num_phys_stacked = num_phys_stacked; }platform_cpu_init (); - pm_idle = default_idle; }void __init
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 10/16 m32r idle: delete pm_idle, and other dead idle code
In reply to Len BrownFrom: Len Brown <[email protected]>
All paths on m32r lead to cpu_relax().
So delete the dead code and simply call cpu_relax() directly.
--- arch/m32r/kernel/process.c | 51 ++-------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-)
arch/m32r/kernel/process.c +2 -49
@@ -44,36 +44,10 @@ unsigned long thread_saved_pc(struct task_struct *tsk)return tsk->thread.lr; } -/* -* Powermanagement idle function, if any.. -*/ -static void (*pm_idle)(void ) =NULL ; -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);/* -* We use this is we don't have any better -* idle routine.. -*/ -static void default_idle (void ) -{ -/* M32R_FIXME: Please use "cpu_sleep" mode. */ -cpu_relax (); -} - -/* -* On SMP it's slightly faster (but much more power-consuming!) -* to poll the ->work.need_resched flag instead of waiting for the -* cross-CPU IPI to arrive. Use this option with caution. -*/ -static void poll_idle (void ) -{ -/* M32R_FIXME */ -cpu_relax (); -} - -/* * The idle thread. There's no useful work to be * done, so just try to conserve power and have a * low exit latency (ie sit in a loop waiting for
@@ -84,14 +58,8 @@ void cpu_idle (void)/* endless idle loop with no priority at all */ while (1 ) {rcu_idle_enter (); -while (!need_resched ()) { -void (*idle)(void ) = pm_idle; - -if (!idle) - idle = default_idle; - -idle (); - } +while (!need_resched ()) +cpu_relax ();rcu_idle_exit ();schedule_preempt_disabled (); }
@@ -120,21 +88,6 @@ void machine_power_off(void)/* M32R_FIXME */ } -static int __init idle_setup (char *str) -{ -if (!strncmp (str,"poll" ,4 )) { -printk ("using poll in idle threads.\n" ); - pm_idle = poll_idle; - }else if (!strncmp (str,"sleep" ,4 )) { -printk ("using sleep in idle threads.\n" ); - pm_idle = default_idle; - } - -return 1 ; -} - -__setup ("idle=" , idle_setup); -void show_regs (struct pt_regs * regs) {printk ("\n" );
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 11/16 microblaze idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle on microblaze served no purpose.
--- arch/microblaze/kernel/process.c | 3 --- 1 file changed, 3 deletions(-)
arch/microblaze/kernel/process.c +0 -3
@@ -41,7 +41,6 @@ void show_regs(struct pt_regs *regs) regs->msr, regs->ear, regs->esr, regs->fsr); } -void (*pm_idle)(void );void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);
@@ -98,8 +97,6 @@ void cpu_idle(void)/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle; -if (!idle) idle = default_idle;
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 12/16 mn10300 idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle on mn10300 served no purpose.
--- arch/mn10300/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)
arch/mn10300/kernel/process.c +0 -7
@@ -37,12 +37,6 @@#include "internal.h" /* -* power management idle function, if any.. -*/ -void (*pm_idle)(void ); -EXPORT_SYMBOL (pm_idle); - -/* * return saved PC of a blocked thread. */ unsigned long thread_saved_pc (struct task_struct *tsk)
@@ -113,7 +107,6 @@ void cpu_idle(void)void (*idle)(void );smp_rmb (); - idle = pm_idle;if (!idle) {#if defined(CONFIG_SMP ) && !defined(CONFIG_HOTPLUG_CPU ) idle = poll_idle;
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 13/16 openrisc idle: delete pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle() on openrisc was dead code.
--- arch/openrisc/kernel/idle.c | 5 ----- 1 file changed, 5 deletions(-)
arch/openrisc/kernel/idle.c +0 -5
@@ -39,11 +39,6 @@void (*powersave) (void ) =NULL ; -static inline void pm_idle (void ) -{ -barrier (); -} -void cpu_idle (void ) {set_thread_flag (TIF_POLLING_NRFLAG );
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 15/16 PM idle: remove global declaration of pm_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
pm_idle appears in no generic Linux code,
it appears only in architecture-specific code.
Thus, pm_idle should not be declared in pm.h.
Architectures that use an idle function pointer
should delcare one local to their architecture,
and/or use cpuidle.
--- include/linux/pm.h | 1 - 1 file changed, 1 deletion(-)
include/linux/pm.h +0 -1
@@ -31,7 +31,6 @@/* * Callbacks for platform drivers to implement. */ -extern void (*pm_idle)(void );extern void (*pm_power_off)(void );extern void (*pm_power_off_prepare)(void );
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerPATCH 16/16 xen idle: make xen-specific macro xen-specific
In reply to Len BrownFrom: Len Brown <[email protected]>
This macro is only invoked by Xen,
so make its definition specific to Xen.
Quoted 1 line
set_pm_idle_to_default()
< xen_set_default_idle()
--- arch/x86/include/asm/processor.h | 6 +++++- arch/x86/kernel/process.c | 4 +++- arch/x86/xen/setup.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/include/asm/processor.h +5 -1
@@ -998,7 +998,11 @@ extern unsigned long arch_align_stack(unsigned long sp);extern void free_init_pages (char *what,unsigned long begin,unsigned long end);void default_idle (void ); -bool set_pm_idle_to_default (void ); +#ifdef CONFIG_XEN +bool xen_set_default_idle (void ); +#else +#define xen_set_default_idle 0 +#endif void stop_this_cpu (void *dummy);
arch/x86/kernel/process.c +3 -1
@@ -390,7 +390,8 @@ void default_idle(void)EXPORT_SYMBOL (default_idle);#endif -bool set_pm_idle_to_default (void ) +#ifdef CONFIG_XEN +bool xen_set_default_idle (void ) {bool ret = !!x86_idle;
@@ -398,6 +399,7 @@ bool set_pm_idle_to_default(void) return ret; } +#endif void stop_this_cpu (void *dummy) {local_irq_disable ();
arch/x86/xen/setup.c +1 -1
@@ -561,7 +561,7 @@ void __init xen_arch_setup(void)#endif disable_cpuidle ();disable_cpufreq (); -WARN_ON (set_pm_idle_to_default ()); +WARN_ON (xen_set_default_idle ());fiddle_vdso ();#ifdef CONFIG_NUMA numa_off =1 ;
Signature · 1 line
1.8.1.3.535.ga923c31
Len Brown
reviewerUse 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
Len Brown
reviewerPATCH 14/16 unicore32 idle: delete stray pm_idle comment
From: Len Brown <[email protected]>
as pm_idle() has already been deleted from this code, the comment was a stray.
--- arch/unicore32/kernel/process.c | 5 ----- 1 file changed, 5 deletions(-)
arch/unicore32/kernel/process.c +0 -5
@@ -45,11 +45,6 @@ static const char * const processor_modes[] = { "UK18", "UK19", "UK1A", "EXTN", "UK1C", "UK1D", "UK1E", "SUSR" }; -/* -* The idle thread, has rather strange semantics for calling pm_idle, -* but this is what x86 does and we need to do the same, so that -* things like cpuidle get called in the same way. -*/ void cpu_idle (void ) {/* endless idle loop with no priority at all */
Signature · 1 line
1.8.1.3.535.ga923c31
Jonas Bonn
maintainerRe: [ORLinux] [PATCH 13/16] openrisc idle: delete pm_idle
In reply to Len BrownQuoted 9 lines · Len Brown
From: Len Brown <[email protected]>
pm_idle()on openrisc was dead code.Signed-off-by Len Brown <[email protected]>--- arch/openrisc/kernel/idle.c | 5 ----- 1 file changed, 5 deletions(-)
Thanks, Len. Will apply.
/Jonas
Quoted 16 lines
arch/openrisc/kernel/idle.c +0
-5@@ -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 );
Re: [PATCH 04/16] sparc idle: rename pm_idle to sparc_idle
In reply to Len BrownFrom: Len Brown <[email protected]>
Date: Sun, 10 Feb 2013 00:58:11 -0500
Quoted 11 lines
From: Len Brown <[email protected]>
(pm_idle)() is being removed from
linux/pm.h
because Linux does not have such a cross-architecture concept.sparc uses an idle function pointer in its architecture specific code. So we re-name sparc use of
pm_idletosparc_idle.Maybe some day, SPARC will cut over to cpuidle...
Signed-off-by Len Brown <[email protected]>
Re: [PATCH 08/16] cris idle: delete idle and pm_idle
In reply to Len BrownQuoted 7 lines · Len Brown
From: Len Brown <[email protected]>
pm_idle()andidle()served no purpose on cris --
invokedefault_idle()directly.Signed-off-by Len Brown <[email protected]>
Looks good!
Quoted 40 lines
--- arch/cris/kernel/process.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)arch/cris/kernel/process.c +1
-10@@ -54,11 +54,6 @@ void enable_hlt(void)EXPORT_SYMBOL (enable_hlt); -/* -* The following aren't currently used. -*/ -void (*pm_idle)(void ); -extern void default_idle (void );void (*pm_power_off)(void );@@ -77,16 +72,12 @@ void cpu_idle (void)while (1 ) {rcu_idle_enter ();while (!need_resched ()) { -void (*idle)(void );/* * Mark this as an RCU critical section so that * synchronize_kernel() in the unload path waits * for our completion. */ - idle = pm_idle; -if (!idle) - idle = default_idle; -idle (); +default_idle (); }rcu_idle_exit ();schedule_preempt_disabled ();Signature · 1 line
1.8.1.3.535.ga923c31
/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
Re: [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle
In reply to Len BrownQuoted 13 lines · Len Brown
From: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting
pm_idleto modules on x86.The
Kconfigsub-option,APM_CPU_IDLE, now depends on onCPU_IDLE.Compile-tested only.
Signed-off-by Len Brown <[email protected]>Cc Jiri Kosina <[email protected]>---
[ ... ]
Quoted 14 lines
arch/x86/kernel/apm_32.c +13
-0+static int apm_cpu_idle (struct cpuidle_device *dev, +struct cpuidle_driver *drv,int index); + +static struct cpuidle_driver apm_idle_driver = { + .name ="apm_idle" , + .owner =THIS_MODULE , + .en_core_tk_irqen =1 , + .states = { + {/* entry 0 is for polling */ }, + {/* entry 1 is for APM idle */ + .name ="APM" , + .desc ="APM idle" , + .flags =CPUIDLE_FLAG_TIME_VALID ,
arch/x86/kernel/apm_32.c struct apm_user { · line 392
Quoted 10 lines
arch/x86/kernel/apm_32.c +10
-0+ .exit_latency = 250, /* WAG */ + .target_residency = 500, /* WAG */ + .enter = &apm_cpu_idle + }, + }, +}; + +static struct cpuidle_device apm_cpuidle_device = { + .state_count =2 , +};
This will make the cpuidle_register_driver to fail because the state_count field of the cpuidle_driver is zero, no ?
static struct cpuidle_driver apm_idle_driver = {
.name = "apm_idle",
...
.states = {
...
},
.state_count = 2,
}static struct cpuidle_device apm_cpuidle_device;
Quoted 51 lines
/*
* Local variables
*/arch/x86/kernel/apm_32.c +3
-9@@ -377,7 +402,6 @@ static struct {static int clock_slowed;static int idle_threshold__read_mostly =DEFAULT_IDLE_THRESHOLD ;static int idle_period__read_mostly =DEFAULT_IDLE_PERIOD ; -static int set_pm_idle;static int suspends_pending;static int standbys_pending;static int ignore_sys_suspend;@@ -884,8 +908,6 @@ static void apm_do_busy(void)#define IDLE_CALC_LIMIT (HZ * 100)#define IDLE_LEAKY_MAX 16 -static void (*original_pm_idle)(void )__read_mostly ; -/** * apm_cpu_idle - cpu idling for APM capable Linux * @@ -894,7 +916,8 @@ static void (*original_pm_idle)(void) __read_mostly;* Furthermore it calls the system default idle routine. */ -static void apm_cpu_idle (void ) +static int apm_cpu_idle (struct cpuidle_device *dev, +struct cpuidle_driver *drv,int index) {static int use_apm_idle;/* = 0 */ static unsigned int last_jiffies;/* = 0 */ @@ -904,7 +927,6 @@ static void apm_cpu_idle(void)unsigned int jiffies_since_last_check = jiffies - last_jiffies;unsigned int bucket; -WARN_ONCE (1 ,"deprecated apm_cpu_idle will be deleted in 2012" ); recalc:if (jiffies_since_last_check >IDLE_CALC_LIMIT ) { use_apm_idle =0 ;@@ -950,10 +972,7 @@ recalc:break ; } } -if (original_pm_idle) -original_pm_idle (); -else -default_idle (); +default_idle ();local_irq_disable (); jiffies_since_last_check = jiffies - last_jiffies;if (jiffies_since_last_check > idle_period)
arch/x86/kernel/apm_32.c recalc: · line 985
Quoted 3 lines
arch/x86/kernel/apm_32.c +0
-0@@ -964,6 +983,7 @@ recalc:apm_do_busy ();local_irq_enable ();
^^^^^^^^
As the 'en_core_tk_irqen' flag has been enabled in the driver, the caller of this function will call 'local_irq_enable'. We can remove the this line no ?
Quoted 51 lines
arch/x86/kernel/apm_32.c +7
-12+return index; }/** @@ -2381,9 +2401,9 @@ static int __init apm_init(void)if (HZ !=100 ) idle_period = (idle_period *HZ ) /100 ;if (idle_threshold <100 ) { - original_pm_idle = pm_idle; - pm_idle = apm_cpu_idle; - set_pm_idle =1 ; +if (!cpuidle_register_driver (&apm_idle_driver)) +if (cpuidle_register_device (&apm_cpuidle_device)) +cpuidle_unregister_driver (&apm_idle_driver); }return 0 ;@@ -2393,15 +2413,9 @@ static void __exit apm_exit(void) {int error; -if (set_pm_idle) { - pm_idle = original_pm_idle; -/* -* We are about to unload the current idle thread pm callback -* (pm_idle), Wait for all processors to update cached/local -* copies of pm_idle before proceeding. -*/ -kick_all_cpus_sync (); - } +cpuidle_unregister_device (&apm_cpuidle_device); +cpuidle_unregister_driver (&apm_idle_driver); +if (((apm_info.bios.flags &APM_BIOS_DISENGAGED ) ==0 ) && (apm_info.connection_version >0x0100 )) { error =apm_engage_power_management (APM_DEVICE_ALL ,0 );arch/x86/kernel/process.c +0
-3@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);* Powermanagement idle function, if any.. */ void (*pm_idle)(void ); -#ifdef CONFIG_APM_MODULE -EXPORT_SYMBOL (pm_idle); -#endif #ifndef CONFIG_SMP static inline void play_dead (void )
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Catalin Marinas
maintainerRe: [PATCH 06/16] ARM idle: delete pm_idle
In reply to Len BrownQuoted 2 lines · Len Brown
pm_idle()on ARM was a synonym fordefault_idle(), so simply invokedefault_idle()directly.
The clean-up looks fine as we already have an arm_pm_idle but longer term I was thinking about having a common declaration similar to pm_power_off that code under drivers/power/(reset/) can override (and such driver may be shared by multiple architectures). OTOH, if you get rid of the generic linux/pm.h declaration architectures can use a common pm_idle name and type (though I think having it in the common header would be better). For ARM this would mean s/arm_pm_idle/pm_idle/ on top if your patch.
Do you have any plans with pm_power_off as well?
Thanks.
Signature · 1 line
Catalin
Re: [PATCH 06/16] ARM idle: delete pm_idle
Quoted 4 lines · Catalin Marinas
Quoted 2 lines · Len Brown
pm_idle()on ARM was a synonym fordefault_idle(), so simply invokedefault_idle()directly.
Quoted 8 lines
The clean-up looks fine as we already have an
arm_pm_idlebut longer term I was thinking about having a common declaration similar topm_power_offthat code under drivers/power/(reset/) can override (and such driver may be shared by multiple architectures). OTOH, if you get rid of the genericlinux/pm.hdeclaration architectures can use a commonpm_idlename 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.
Len Brown
reviewerRe: [PATCH 06/16] ARM idle: delete pm_idle
Quoted 14 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
Quoted 2 lines · Len Brown
pm_idle()on ARM was a synonym fordefault_idle(), so simply invokedefault_idle()directly.Quoted 8 lines
The clean-up looks fine as we already have an
arm_pm_idlebut longer term I was thinking about having a common declaration similar topm_power_offthat code under drivers/power/(reset/) can override (and such driver may be shared by multiple architectures). OTOH, if you get rid of the genericlinux/pm.hdeclaration architectures can use a commonpm_idlename and type (though I think having it in the common header would be better). For ARM this would mean s/arm_pm_idle/pm_idle/ on top if your patch.
Quoted 3 lines
pm_idle()was that common declaration - but it had the side effect that it was defined to be called with interrupts disabled, but return with interrupts enabled.
Yeah, I expect that grew out of the x86 idiom "STI;HLT", which dictated default_idle(), which in-turn dictated pm_idle(). x86's MWAIT instruction now has more flexibility WRT interrupts, but the cast was already set...
Please let me know if you Ack the patch as is,
or would like it changed.
thanks,
-Len Brown, Intel Open Source Technology Center
Quoted 5 lines
arm_pm_idle()"fixed" that weirdness such that it's now expected to return with IRQs in the same state that it was called.
pm_power_off()is a cross-arch hook already.
Len Brown
reviewerRe: [PATCH 01/16] APM idle: register apm_cpu_idle via cpuidle
In reply to Daniel LezcanoQuoted 23 lines · Daniel Lezcano
Quoted 15 lines · Len Brown
From: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting
pm_idleto modules on x86.The
Kconfigsub-option,APM_CPU_IDLE, now depends on onCPU_IDLE.Compile-tested only.
Signed-off-by Len Brown <[email protected]>Cc Jiri Kosina <[email protected]>---
arch/x86/kernel/apm_32.c struct apm_user { · line 392
Quoted 3 lines
arch/x86/kernel/apm_32.c +3
-0+static struct cpuidle_device apm_cpuidle_device = { + .state_count =2 , +};This will make the
cpuidle_register_driverto fail because thestate_countfield of thecpuidle_driveris zero, no ?
Quoted 8 lines
static struct cpuidle_driver apm_idle_driver = {
.name = "apm_idle",
...
.states = {
...
},
.state_count = 2,
}yup, good catch.
Quoted 6 lines
Quoted 6 lines
arch/x86/kernel/apm_32.c +2
-1-static void apm_cpu_idle (void ) +static int apm_cpu_idle (struct cpuidle_device *dev, +struct cpuidle_driver *drv,int index) {static int use_apm_idle;/* = 0 */ static unsigned int last_jiffies;/* = 0 */
...
Quoted 10 lines
arch/x86/kernel/apm_32.c recalc: · line 985
Quoted 4 lines
arch/x86/kernel/apm_32.c +0
-0@@ -964,6 +983,7 @@ recalc:apm_do_busy ();local_irq_enable ();^^^^^^^^As the '
en_core_tk_irqen' flag has been enabled in the driver, the caller of this function will call 'local_irq_enable'. We can remove the this line no ?
yup, this line is no longer necessary.
v2 on the way -- hoping somebody with an APM box can test it.
thanks,
-Len Brown, Intel Open Source Technology Center
Len Brown
reviewerAPM: Request to Test
In reply to Daniel LezcanoThanks, 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
Len Brown
reviewerPATCH v2 1/1 APM idle: register apm_cpu_idle via cpuidle
From: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting pm_idle to modules on x86.
The Kconfig sub-option, APM_CPU_IDLE, now depends on on CPU_IDLE.
Compile-tested only.
---
v2: updates from Daniel Lezcano's review
--- arch/x86/Kconfig | 1 + arch/x86/kernel/apm_32.c | 60 +++++++++++++++++++++++++++++------------------ arch/x86/kernel/process.c | 3 --- 3 files changed, 38 insertions(+), 26 deletions(-)
arch/x86/Kconfig +1 -0
@@ -1912,6 +1912,7 @@ config APM_DO_ENABLE this feature. config APM_CPU_IDLE + depends on CPU_IDLE bool "Make CPU Idle calls when idle" ---help--- Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.
arch/x86/kernel/apm_32.c +37 -23
126 lines not on this page · raw message
arch/x86/kernel/process.c +0 -3
@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);* Powermanagement idle function, if any.. */ void (*pm_idle)(void ); -#ifdef CONFIG_APM_MODULE -EXPORT_SYMBOL (pm_idle); -#endif #ifndef CONFIG_SMP static inline void play_dead (void )
Signature · 1 line
1.8.1.3.535.ga923c31
Re: [PATCH 07/16] ARM64 idle: delete pm_idle
In reply to Len BrownQuoted 7 lines · Len Brown
From: Len Brown <[email protected]>
pm_idle()on arm64 was a synonym fordefault_idle(), so remove it and invokedefault_idle()directly.Signed-off-by Len Brown <[email protected]>Cc linux-arm-kernel at lists.infradead.org
For arm64:
Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
In reply to Len BrownQuoted 69 lines · Len Brown
From: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting
pm_idleto modules on x86.The
Kconfigsub-option,APM_CPU_IDLE, now depends on onCPU_IDLE.Compile-tested only.
Signed-off-by Len Brown <[email protected]>Cc Jiri Kosina <[email protected]>---
v2: updates from Daniel Lezcano's review--- arch/x86/Kconfig | 1 + arch/x86/kernel/apm_32.c | 60 +++++++++++++++++++++++++++++------------------ arch/x86/kernel/process.c | 3 --- 3 files changed, 38 insertions(+), 26 deletions(-)arch/x86/Kconfig +1
-0@@ -1912,6 +1912,7 @@ config APM_DO_ENABLE this feature. config APM_CPU_IDLE + depends on CPU_IDLE bool "Make CPU Idle calls when idle" ---help--- Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.arch/x86/kernel/apm_32.c +15
-1@@ -232,6 +232,7 @@#include <linux/acpi.h> #include <linux/syscore_ops.h> #include <linux/i8253.h> +#include <linux/cpuidle.h> #include <asm/uaccess.h> #include <asm/desc.h> @@ -360,13 +361,38 @@ struct apm_user {* idle percentage above which bios idle calls are done */ #ifdef CONFIG_APM_CPU_IDLE -#warning deprecated CONFIG_APM_CPU_IDLE will be deleted in 2012#define DEFAULT_IDLE_THRESHOLD 95#else #define DEFAULT_IDLE_THRESHOLD 100#endif #define DEFAULT_IDLE_PERIOD (100 / 3) +static int apm_cpu_idle (struct cpuidle_device *dev, +struct cpuidle_driver *drv,int index); + +static struct cpuidle_driver apm_idle_driver = { + .name ="apm_idle" , + .owner =THIS_MODULE , + .en_core_tk_irqen =1 , + .states = { + {/* entry 0 is for polling */ }, + {/* entry 1 is for APM idle */ + .name ="APM" , + .desc ="APM idle" , + .flags =CPUIDLE_FLAG_TIME_VALID , + .exit_latency =250 ,/* WAG */
arch/x86/kernel/apm_32.c struct apm_user { · line 393
Quoted 10 lines
arch/x86/kernel/apm_32.c +10
-0+ .target_residency = 500, /* WAG */ + .enter = &apm_cpu_idle + }, + }, + .state_count = 2, +}; + +static struct cpuidle_device apm_cpuidle_device = { + .state_count =2 , +};
Actually this initialization is not needed because when it is set to zero, the cpuidle_enable_device function will set it for us from the driver's state_count.
int cpuidle_enable_device(struct cpuidle_device *dev)
{
...
if (!dev->state_count)
dev->state_count = drv->state_count;
}It is useful to set a value when it differs from the driver's one.
Otherwise :
Quoted 106 lines
arch/x86/kernel/apm_32.c +10
-22/* * Local variables */ @@ -377,7 +403,6 @@ static struct {static int clock_slowed;static int idle_threshold__read_mostly =DEFAULT_IDLE_THRESHOLD ;static int idle_period__read_mostly =DEFAULT_IDLE_PERIOD ; -static int set_pm_idle;static int suspends_pending;static int standbys_pending;static int ignore_sys_suspend;@@ -884,8 +909,6 @@ static void apm_do_busy(void)#define IDLE_CALC_LIMIT (HZ * 100)#define IDLE_LEAKY_MAX 16 -static void (*original_pm_idle)(void )__read_mostly ; -/** * apm_cpu_idle - cpu idling for APM capable Linux * @@ -894,7 +917,8 @@ static void (*original_pm_idle)(void) __read_mostly;* Furthermore it calls the system default idle routine. */ -static void apm_cpu_idle (void ) +static int apm_cpu_idle (struct cpuidle_device *dev, +struct cpuidle_driver *drv,int index) {static int use_apm_idle;/* = 0 */ static unsigned int last_jiffies;/* = 0 */ @@ -904,7 +928,6 @@ static void apm_cpu_idle(void)unsigned int jiffies_since_last_check = jiffies - last_jiffies;unsigned int bucket; -WARN_ONCE (1 ,"deprecated apm_cpu_idle will be deleted in 2012" ); recalc:if (jiffies_since_last_check >IDLE_CALC_LIMIT ) { use_apm_idle =0 ;@@ -950,10 +973,7 @@ recalc:break ; } } -if (original_pm_idle) -original_pm_idle (); -else -default_idle (); +default_idle ();local_irq_disable (); jiffies_since_last_check = jiffies - last_jiffies;if (jiffies_since_last_check > idle_period)@@ -963,7 +983,7 @@ recalc:if (apm_idle_done)apm_do_busy (); -local_irq_enable (); +return index; }/** @@ -2381,9 +2401,9 @@ static int __init apm_init(void)if (HZ !=100 ) idle_period = (idle_period *HZ ) /100 ;if (idle_threshold <100 ) { - original_pm_idle = pm_idle; - pm_idle = apm_cpu_idle; - set_pm_idle =1 ; +if (!cpuidle_register_driver (&apm_idle_driver)) +if (cpuidle_register_device (&apm_cpuidle_device)) +cpuidle_unregister_driver (&apm_idle_driver); }return 0 ;@@ -2393,15 +2413,9 @@ static void __exit apm_exit(void) {int error; -if (set_pm_idle) { - pm_idle = original_pm_idle; -/* -* We are about to unload the current idle thread pm callback -* (pm_idle), Wait for all processors to update cached/local -* copies of pm_idle before proceeding. -*/ -kick_all_cpus_sync (); - } +cpuidle_unregister_device (&apm_cpuidle_device); +cpuidle_unregister_driver (&apm_idle_driver); +if (((apm_info.bios.flags &APM_BIOS_DISENGAGED ) ==0 ) && (apm_info.connection_version >0x0100 )) { error =apm_engage_power_management (APM_DEVICE_ALL ,0 );arch/x86/kernel/process.c +0
-3@@ -272,9 +272,6 @@ EXPORT_SYMBOL(boot_option_idle_override);* Powermanagement idle function, if any.. */ void (*pm_idle)(void ); -#ifdef CONFIG_APM_MODULE -EXPORT_SYMBOL (pm_idle); -#endif #ifndef CONFIG_SMP static inline void play_dead (void )
Signature · 10 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/16] ARM idle: delete pm_idle
In reply to Len BrownQuoted 7 lines · Len Brown
From: Len Brown <[email protected]>
pm_idle()on ARM was a synonym fordefault_idle(), so simply invokedefault_idle()directly.Signed-off-by Len Brown <[email protected]>Cc linux-arm-kernel at lists.infradead.org
Looks good to me.
Tested this patch along with 15/16 (removes global declaration) on an ARM platform (TI OMAP3) with and without CPUidle, and things continue to work as expected:
Kevin
Re: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
In reply to Len BrownQuoted 9 lines · Len Brown
From: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting
pm_idleto modules on x86.The
Kconfigsub-option,APM_CPU_IDLE, now depends on onCPU_IDLE.Compile-tested only.
I will test it on APM hardware and report back to you.
Do you then want me to take it through my tree, or are you going to push the whole patchset as a whole?
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: [PATCH 05/16] blackfin idle: delete pm_idle
In reply to Len BrownQuoted 28 lines · Len Brown
From: Len Brown <[email protected]>
pm_idleis dead code on blackfin.Signed-off-by Len Brown <[email protected]>--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)arch/blackfin/kernel/process.c +0
-6@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);
arch/blackfin/kernel/process.c void cpu_idle(void) · line 84
Quoted 4 lines
arch/blackfin/kernel/process.c +0
-1@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;
Hi,
This results in the following error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’
This change on top of your patch, fixes it.
arch/blackfin/kernel/process.c +1 -3
@@ -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
Len Brown
reviewerRe: [PATCH v2] APM idle: register apm_cpu_idle via cpuidle
In reply to Jiri KosinaQuoted 8 lines · Jiri Kosina
Quoted 6 lines · Len Brown
From: Len Brown <[email protected]>
Update APM to register its local idle routine with cpuidle.
This allows us to stop exporting
pm_idleto modules on x86.
Quoted 8 lines
Quoted 3 lines
The
Kconfigsub-option,APM_CPU_IDLE, now depends on onCPU_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
Len Brown
reviewerRe: [PATCH 05/16] blackfin idle: delete pm_idle
In reply to Lars-Peter ClausenQuoted 2 lines
Otherwise the patch seems to work fine.
Thanks for testing Lars!
Sorry about breaking the build w/ my slopyness --
will get that patched up.
cheers,
Len Brown, Intel Open Source Technology Center
Re: [PATCH 05/16] blackfin idle: delete pm_idle
In reply to Lars-Peter ClausenQuoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown
From: Len Brown <[email protected]>
pm_idleis dead code on blackfin.Signed-off-by Len Brown <[email protected]>--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)arch/blackfin/kernel/process.c +0
-6@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);arch/blackfin/kernel/process.c void cpu_idle(void) · line 84
Quoted 4 lines
arch/blackfin/kernel/process.c +0
-1@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;Hi,
This results in the following error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/blackfin/kernel/process.c:83: error: for each function it appears in.)arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’
Quoted 1 line
This change on top of your patch, fixes it.
Lars, I need your sign-off for the patch below. May I add it?
Rafael
Quoted 27 lines
arch/blackfin/kernel/process.c +1
-3@@ -80,12 +80,10 @@ void cpu_idle(void)if (cpu_is_offline (smp_processor_id ()))cpu_die ();#endif -if (!idle) - idle = default_idle;tick_nohz_idle_enter ();rcu_idle_enter ();while (!need_resched ()) -idle (); +default_idle ();rcu_idle_exit ();tick_nohz_idle_exit ();preempt_enable_no_resched ();Otherwise the patch seems to work fine.
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH 05/16] blackfin idle: delete pm_idle
Quoted 49 lines · Rafael J. Wysocki
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown
From: Len Brown <[email protected]>
pm_idleis dead code on blackfin.Signed-off-by Len Brown <[email protected]>--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)arch/blackfin/kernel/process.c +0
-6@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);arch/blackfin/kernel/process.c void cpu_idle(void) · line 84
Quoted 4 lines
arch/blackfin/kernel/process.c +0
-1@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;Hi,
This results in the following error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/blackfin/kernel/process.c:83: error: for each function it appears in.)arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’
Quoted 5 lines
Quoted 1 line
This change on top of your patch, fixes it.
Lars, I need your sign-off for the patch below. May I add it?
Rafael
Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.
- Lars
Quoted 20 lines
Quoted 20 lines
arch/blackfin/kernel/process.c +1
-3@@ -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 ();
Re: [PATCH 05/16] blackfin idle: delete pm_idle
Quoted 50 lines · Lars-Peter Clausen
Quoted 49 lines · Rafael J. Wysocki
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown
From: Len Brown <[email protected]>
pm_idleis dead code on blackfin.Signed-off-by Len Brown <[email protected]>--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)arch/blackfin/kernel/process.c +0
-6@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);arch/blackfin/kernel/process.c void cpu_idle(void) · line 84
Quoted 4 lines
arch/blackfin/kernel/process.c +0
-1@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;Hi,
This results in the following error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/blackfin/kernel/process.c:83: error: for each function it appears in.)arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This change on top of your patch, fixes it.
Lars, I need your sign-off for the patch below. May I add it?
Rafael
Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.
Please do now, if you can. Sorry for the trouble.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH 05/16] blackfin idle: delete pm_idle
Quoted 53 lines · Rafael J. Wysocki
Quoted 52 lines · Lars-Peter Clausen
Quoted 51 lines · Rafael J. Wysocki
Quoted 49 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown
From: Len Brown <[email protected]>
pm_idleis dead code on blackfin.Signed-off-by Len Brown <[email protected]>--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)arch/blackfin/kernel/process.c +0
-6@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);arch/blackfin/kernel/process.c void cpu_idle(void) · line 84
Quoted 4 lines
arch/blackfin/kernel/process.c +0
-1@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;Hi,
This results in the following error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/blackfin/kernel/process.c:83: error: for each function it appears in.)arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’This change on top of your patch, fixes it.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Lars, I need your sign-off for the patch below. May I add it?
Rafael
Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.
Please do now, if you can. Sorry for the trouble.
I can send it tomorrow morning, it's on my machine at work.
- Lars
Re: [PATCH 05/16] blackfin idle: delete pm_idle
Quoted 58 lines · Lars-Peter Clausen
Quoted 57 lines · Rafael J. Wysocki
Quoted 56 lines · Lars-Peter Clausen
Quoted 54 lines · Rafael J. Wysocki
Quoted 48 lines · Lars-Peter Clausen
Quoted 28 lines · Len Brown
From: Len Brown <[email protected]>
pm_idleis dead code on blackfin.Signed-off-by Len Brown <[email protected]>--- arch/blackfin/kernel/process.c | 7 ------- 1 file changed, 7 deletions(-)arch/blackfin/kernel/process.c +0
-6@@ -39,12 +39,6 @@ int nr_l1stack_tasks;void *l1_stack_base;unsigned long l1_stack_len; -/* -* Powermanagement idle function, if any.. -*/ -void (*pm_idle)(void ) =NULL ; -EXPORT_SYMBOL (pm_idle); -void (*pm_power_off)(void ) =NULL ;EXPORT_SYMBOL (pm_power_off);arch/blackfin/kernel/process.c void cpu_idle(void) · line 84
Quoted 4 lines
arch/blackfin/kernel/process.c +0
-1@@ -81,7 +75,6 @@ void cpu_idle(void) {/* endless idle loop with no priority at all */ while (1 ) { -void (*idle)(void ) = pm_idle;Hi,
This results in the following error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/blackfin/kernel/process.c:83: error: for each function it appears in.)arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’Quoted 1 line
This change on top of your patch, fixes it.
Lars, I need your sign-off for the patch below. May I add it?
Rafael
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Sure, I didn't realize the patches had already been merged, otherwise I'd have sent a proper patch.
Please do now, if you can. Sorry for the trouble.
I can send it tomorrow morning, it's on my machine at work.
That will be fine.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
PATCH 1/1 blackfin idle: Fix compile error
Commit 26bab0c ("blackfin idle: delete pm_idle") introduced the following
compile error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function) arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only once arch/blackfin/kernel/process.c:83: error: for each function it appears in.) arch/blackfin/kernel/process.c:88: error: implicit declaration of function ‘idle’
This patch fixes it.
--- arch/blackfin/kernel/process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/blackfin/kernel/process.c +1 -3
@@ -80,12 +80,10 @@ void cpu_idle(void)if (cpu_is_offline (smp_processor_id ()))cpu_die ();#endif -if (!idle) - idle = default_idle;tick_nohz_idle_enter ();rcu_idle_enter ();while (!need_resched ()) -idle (); +default_idle ();rcu_idle_exit ();tick_nohz_idle_exit ();preempt_enable_no_resched ();
Signature · 1 line
1.8.0
PATCH 1/1 microblaze idle: Fix compile error
In reply to Len BrownCommit def8203 ("microblaze idle: delete pm_idle") introduced the following compile error:
arch/microblaze/kernel/process.c: In function 'cpu_idle':
arch/microblaze/kernel/process.c:100: error: 'idle' undeclared (first use in this function) arch/microblaze/kernel/process.c:100: error: (Each undeclared identifier is reported only once arch/microblaze/kernel/process.c:100: error: for each function it appears in.) arch/microblaze/kernel/process.c:106: error: implicit declaration of function 'idle'
This patch fixes it.
--- arch/microblaze/kernel/process.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/microblaze/kernel/process.c +1 -4
@@ -97,13 +97,10 @@ void cpu_idle(void)/* endless idle loop with no priority at all */ while (1 ) { -if (!idle) - idle = default_idle; -tick_nohz_idle_enter ();rcu_idle_enter ();while (!need_resched ()) -idle (); +default_idle ();rcu_idle_exit ();tick_nohz_idle_exit ();
Signature · 1 line
1.8.0
Re: [PATCH 09/16] ia64 idle: delete pm_idle
In reply to Len BrownQuoted 26 lines · Len Brown
From: Len Brown <[email protected]>
pm_idle()on ia64 was a synonym fordefault_idle(). So simply invokedefault_idle()directly.Signed-off-by Len Brown <[email protected]>--- arch/ia64/kernel/process.c | 3 --- arch/ia64/kernel/setup.c | 1 - 2 files changed, 4 deletions(-)arch/ia64/kernel/process.c +0
-2@@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);unsigned long boot_option_idle_override =IDLE_NO_OVERRIDE ;EXPORT_SYMBOL (boot_option_idle_override); -void (*pm_idle) (void ); -EXPORT_SYMBOL (pm_idle);void (*pm_power_off) (void );EXPORT_SYMBOL (pm_power_off);
arch/ia64/kernel/process.c cpu_idle (void) · line 302
Quoted 5 lines
arch/ia64/kernel/process.c +0
-1@@ -301,7 +299,6 @@ cpu_idle (void)if (mark_idle) (*mark_idle)(1 ); - idle = pm_idle;if (!idle)
Hm, if I'm not mistaken idle will uninitialized at this point, so this could quite likely lead to a crash.
Quoted 14 lines
arch/ia64/kernel/process.c +0
-0idle = default_idle; (*idle)();arch/ia64/kernel/setup.c +0
-1@@ -1051,7 +1051,6 @@ cpu_init (void) max_num_phys_stacked = num_phys_stacked; }platform_cpu_init (); - pm_idle = default_idle; }void __init
Rafael J. Wysocki
AppliedRe: [PATCH] blackfin idle: Fix compile error
In reply to Lars-Peter ClausenQuoted 11 lines · Lars-Peter Clausen
Commit 26bab0c ("blackfin idle: delete
pm_idle") introduced the following
compile error:
arch/blackfin/kernel/process.c: In function ‘cpu_idle’:
arch/blackfin/kernel/process.c:83: error: ‘idle’ undeclared (first use in this function)arch/blackfin/kernel/process.c:83: error: (Each undeclared identifier is reported only oncearch/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 <[email protected]>
Applied to linux-pm.git/linux-next, I'm going to push it to Linus later this week.
Thanks,
Rafael
Quoted 23 lines
--- arch/blackfin/kernel/process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)arch/blackfin/kernel/process.c +1
-3@@ -80,12 +80,10 @@ void cpu_idle(void)if (cpu_is_offline (smp_processor_id ()))cpu_die ();#endif -if (!idle) - idle = default_idle;tick_nohz_idle_enter ();rcu_idle_enter ();while (!need_resched ()) -idle (); +default_idle ();rcu_idle_exit ();tick_nohz_idle_exit ();preempt_enable_no_resched ();
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Rafael J. Wysocki
AppliedRe: [PATCH] microblaze idle: Fix compile error
In reply to Lars-Peter ClausenQuoted 9 lines · Lars-Peter Clausen
Commit def8203 ("microblaze idle: delete
pm_idle") introduced the following compile error:
arch/microblaze/kernel/process.c: In function 'cpu_idle':
arch/microblaze/kernel/process.c:100: error: 'idle' undeclared (first use in this function)arch/microblaze/kernel/process.c:100: error: (Each undeclared identifier is reported only oncearch/microblaze/kernel/process.c:100: error: for each function it appears in.)arch/microblaze/kernel/process.c:106: error: implicit declaration of function 'idle'
Quoted 3 lines
This patch fixes it.
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied to linux-pm.git/linux-next, I'm going to push it to Linus later this week.
Thanks,
Rafael
Quoted 24 lines
--- arch/microblaze/kernel/process.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)arch/microblaze/kernel/process.c +1
-4@@ -97,13 +97,10 @@ void cpu_idle(void)/* endless idle loop with no priority at all */ while (1 ) { -if (!idle) - idle = default_idle; -tick_nohz_idle_enter ();rcu_idle_enter ();while (!need_resched ()) -idle (); +default_idle ();rcu_idle_exit ();tick_nohz_idle_exit ();
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
RE: [PATCH 09/16] ia64 idle: delete pm_idle
In reply to Lars-Peter ClausenQuoted 5 lines
arch/ia64/kernel/process.c cpu_idle (void) · line 302
Quoted 2 lines
arch/ia64/kernel/process.c +0
-1- idle = pm_idle;if (!idle)Hm, if I'm not mistaken idle will uninitialized at this point, so this could quite likely lead to a crash.
thanks,
will fix.
-Len
Len Brown
reviewerPATCH 1/1 ia64 idle: delete (*idle)()
From: Len Brown <[email protected]>
3e7fc708eb (ia64 idle: delete pm_idle) in 3.9-rc1
didn't finish the job, leaving an un-initialized
reference to (*idle)().
--- arch/ia64/kernel/process.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/ia64/kernel/process.c +1 -4
@@ -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