powersave_nap cleanup
Subsystems (2)
[ Please consider for 2.6.18. ]
Instead of having the machdep_calls.power_save routines (such as ppc6xx_idle and power4_idle) individually check the value of the powersave_nap sysctl variable, we can have the newly-consolidated idle loop check the value of powersave_nap when deciding whether to call machdep_calls.power_save. In this way, a platform can implement a machdep_calls.power_save method but still have threads go low-priority when idle if the user has set powersave_nap to 0.
Rename machdep_calls.power_save to machdep_calls.powersave_nap to make more apparent the connection with the powersave_nap sysctl.
Add some documentation to machdep_calls.powersave_nap to more completely describe its intended use.
Change cpu_idle to call ppc_md.powersave_nap only when the powersave_nap sysctl is set.
Remove tests of the powersave_nap variable from the ppc6xx_idle and power4_idle routines.
Set powersave_nap to 1 by default on pSeries when the shared processor firmware feature is present, preserving current behavior.
Remove a superfluous declaration of powersave_nap from platforms/powermac/feature.c.
arch/powerpc/kernel/idle.c +2 -2
@@ -53,7 +53,7 @@ void cpu_idle(void)while (!need_resched () && !cpu_should_die ()) {ppc64_runlatch_off (); -if (ppc_md.power_save) { +if (ppc_md.powersave_nap && powersave_nap) {clear_thread_flag (TIF_POLLING_NRFLAG );/* * smp_mb is so clearing of TIF_POLLING_NRFLAG
@@ -64,7 +64,7 @@ void cpu_idle(void)/* check again after disabling irqs */ if (!need_resched () && !cpu_should_die ()) - ppc_md.power_save (); + ppc_md.powersave_nap ();local_irq_enable ();set_thread_flag (TIF_POLLING_NRFLAG );
arch/powerpc/kernel/idle_6xx.S +1 -6
@@ -1,5 +1,5 @@ /* - * This file contains the power_save function for 6xx & 7xxx CPUs + * This file contains the powersave_nap function for 6xx & 7xxx CPUs * rewritten in assembler * * Warning ! This code assumes that if your machine has a 750fx
@@ -74,11 +74,6 @@ BEGIN_FTR_SECTION lwz r4,CPU_SPEC_FEATURES(r4) andi. r0,r4,CPU_FTR_CAN_NAP beq 1f - /* Now check if user or arch enabled NAP mode */ - lis r4,powersave_nap@ha - lwz r4,powersave_nap@l(r4) - cmpwi 0,r4,0 - beq 1f lis r3,HID0_NAP@h 1: END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
arch/powerpc/kernel/idle_power4.S +1 -7
@@ -1,5 +1,5 @@ /* - * This file contains the power_save function for 970-family CPUs. + * This file contains the powersave_nap function for 970-family CPUs. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License
@@ -24,12 +24,6 @@ _GLOBAL(power4_idle) BEGIN_FTR_SECTION blr END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP) - /* Now check if user or arch enabled NAP mode */ - LOAD_REG_ADDRBASE(r3,powersave_nap) - lwz r4,ADDROFF(powersave_nap)(r3) - cmpwi 0,r4,0 - beqlr - /* Go to NAP now */ BEGIN_FTR_SECTION DSSALL
arch/powerpc/kernel/setup_32.c +1 -1
@@ -142,7 +142,7 @@ void __init machine_init(unsigned long d#ifdef CONFIG_6xxif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) - ppc_md.power_save = ppc6xx_idle; + ppc_md.powersave_nap = ppc6xx_idle;#endif if (ppc_md.progress)
arch/powerpc/platforms/maple/setup.c +1 -1
@@ -292,7 +292,7 @@ define_machine(maple_md) { .get_rtc_time = maple_get_rtc_time, .calibrate_decr = generic_calibrate_decr, .progress = maple_progress, - .power_save = power4_idle, + .powersave_nap = power4_idle, #ifdef CONFIG_KEXEC .machine_kexec = default_machine_kexec, .machine_kexec_prepare = default_machine_kexec_prepare,
arch/powerpc/platforms/powermac/feature.c +0 -1
@@ -53,7 +53,6 @@extern int powersave_lowspeed;#endif -extern int powersave_nap;extern struct device_node *k2_skiplist[2 ];/*
arch/powerpc/platforms/powermac/setup.c +1 -1
@@ -740,7 +740,7 @@ define_machine(powermac) { .progress = udbg_progress,#ifdef CONFIG_PPC64 .pci_probe_mode = pmac_pci_probe_mode, - .power_save = power4_idle, + .powersave_nap = power4_idle, .enable_pmcs = power4_enable_pmcs, #ifdef CONFIG_KEXEC .machine_kexec = default_machine_kexec,
arch/powerpc/platforms/pseries/setup.c +4 -2
@@ -236,11 +236,13 @@ static void __init pSeries_setup_arch(vovpa_init (boot_cpuid);if (get_lppaca ()->shared_proc) {printk (KERN_INFO "Using shared processor idle loop\n" ); - ppc_md.power_save = pseries_shared_idle_sleep; + ppc_md.powersave_nap = pseries_shared_idle_sleep; }else {printk (KERN_INFO "Using dedicated idle loop\n" ); - ppc_md.power_save = pseries_dedicated_idle_sleep; + ppc_md.powersave_nap = pseries_dedicated_idle_sleep; } +/* We want this on by default. */ + powersave_nap =1 ; }else {printk (KERN_INFO "Using default idle loop\n" ); }
include/asm-powerpc/machdep.h +4 -3
@@ -160,10 +160,11 @@ struct machdep_calls {void (*idle_loop)(void );/* -* Function for waiting for work with reduced power in idle loop; -* called with interrupts disabled. +* Function for waiting for work with reduced power and/or cpu +* utilization in idle loop; called with interrupts disabled. +* Can be overriden by the powersave_nap sysctl. */ -void (*power_save)(void ); +void (*powersave_nap)(void );/* Function to enable performance monitor counters for this platform, called once per cpu. */
Quoted 2 lines · Nathan Lynch
Rename machdep_calls.power_save to machdep_calls.powersave_nap to make more apparent the connection with the
powersave_napsysctl.
Hmmm, it's possibly a bit confusing to have a variable and a function with the same name...
Paul.
Quoted 7 lines · Paul Mackerras
Quoted 2 lines · Nathan Lynch
Rename machdep_calls.power_save to machdep_calls.powersave_nap to make more apparent the connection with the
powersave_napsysctl.Hmmm, it's possibly a bit confusing to have a variable and a function with the same name...
Heh, I thought you had suggested doing that, maybe I misunderstood.
So, what to do? Leave the machdep_calls.power_save name as it is?