Re: [patch 1/2] x86: Add pm_play_dead funcptr to power-efficientlyoffline CPUs

From: Peter Zijlstra
Date: Sat May 23 2009 - 06:45:34 EST


On Fri, 2009-05-22 at 16:19 -0700, venkatesh.pallipadi@xxxxxxxxx wrote:
> plain text document attachment
> (0001-x86-Add-pm_play_dead-funcptr-to-power-efficiently-o.patch)
> Add a funcptr pm_play_dead (similar to pm_idle) that can take
> the offline CPUs to the most power efficient idle state.
>
> This patch just adds the func pointer. The pointer will get initialized
> by patch that follows.

Since the pm_idle function pointer has given us so much grief, I don't
think its wise to repeat that particular disaster.

I'd much rather see a framework where idle functions can be registered,
and selected from based on criteria such as wakeup latency as provided
by the pm_qos stuff, and power saving.

This framework should be shared between hotplug-idle and the regular
idle routines. Hotplug would of course not care about things like wakeup
latency and might therefore pick another idle routine.

> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@xxxxxxxxx>
> ---
> arch/x86/include/asm/smp.h | 2 ++
> arch/x86/kernel/smpboot.c | 7 ++++++-
> 2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> index 19e0d88..0388b81 100644
> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -148,6 +148,8 @@ static inline int num_booting_cpus(void)
> {
> return cpumask_weight(cpu_callout_mask);
> }
> +
> +extern void (*pm_play_dead)(void);
> #endif /* CONFIG_SMP */
>
> extern unsigned disabled_cpus __cpuinitdata;
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 58d24ef..4f8af6a 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1195,6 +1195,8 @@ __init void prefill_possible_map(void)
> nr_cpu_ids = possible;
> }
>
> +void (*pm_play_dead)(void) = NULL;
> +
> #ifdef CONFIG_HOTPLUG_CPU
>
> static void remove_siblinginfo(int cpu)
> @@ -1313,7 +1315,10 @@ void play_dead_common(void)
> void native_play_dead(void)
> {
> play_dead_common();
> - wbinvd_halt();
> + if (pm_play_dead)
> + pm_play_dead();
> + else
> + wbinvd_halt();
> }
>
> #else /* ... !CONFIG_HOTPLUG_CPU */
> --
> 1.6.0.6
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/