From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.54) id 1F8Fn4-0001mL-E3 for garchives@archives.gentoo.org; Sun, 12 Feb 2006 11:53:19 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id k1CBrB5D023106; Sun, 12 Feb 2006 11:53:11 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id k1CBr9hG024550 for ; Sun, 12 Feb 2006 11:53:10 GMT Message-Id: <200602121153.k1CBr9hG024550@robin.gentoo.org> Received: from lark.gentoo.osuosl.org ([140.211.166.177] helo=lark) by smtp.gentoo.org with smtp (Exim 4.54) id 1F8Fmv-0001hc-1i for gentoo-doc-cvs@lists.gentoo.org; Sun, 12 Feb 2006 11:53:09 +0000 Received: by lark (sSMTP sendmail emulation); Sun, 12 Feb 2006 11:53:08 +0000 From: "Josh Saddler" Date: Sun, 12 Feb 2006 11:53:08 +0000 To: gentoo-doc-cvs@lists.gentoo.org Subject: [gentoo-doc-cvs] cvs commit: power-management-guide.xml Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-doc-cvs@gentoo.org Reply-to: docs-team@lists.gentoo.org X-Archives-Salt: 08339b71-fe1b-41b9-9ae3-cb3779103c91 X-Archives-Hash: 5354ead1490efeaf22a379b9588be988 nightmorph 06/02/12 11:53:08 Modified: xml/htdocs/doc/en power-management-guide.xml Log: Power management guide updated for bug 122017 Revision Changes Path 1.17 +253 -123 xml/htdocs/doc/en/power-management-guide.xml file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/power-management-guide.xml?rev=1.17&content-type=text/x-cvsweb-markup&cvsroot=gentoo plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/power-management-guide.xml?rev=1.17&content-type=text/plain&cvsroot=gentoo diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/power-management-guide.xml.diff?r1=1.16&r2=1.17&cvsroot=gentoo Index: power-management-guide.xml =================================================================== RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- power-management-guide.xml 1 Jan 2006 11:51:43 -0000 1.16 +++ power-management-guide.xml 12 Feb 2006 11:53:08 -0000 1.17 @@ -1,11 +1,11 @@ - + Power Management Guide - Dennis Nienhüser + Dennis Nienhüser @@ -17,13 +17,12 @@ -1.25 -2005-10-02 +1.26 +2006-02-12 Introduction
-Why Power Management?

@@ -95,12 +94,11 @@ Prerequisites

-What has to be done first

-Before going into the details on making individual devices Power Management -aware, make sure certain requirements are met. After controlling the BIOS +Before discussing the details of making individual devices Power Management +aware, make sure certain requirements are met. After controlling BIOS settings, some kernel options want to be enabled - these are in short ACPI, sleep states and CPU frequency scaling. As power saving most of the time comes along with performance loss or increased latency, it should only be enabled @@ -125,6 +123,21 @@

+Setting USE flags + + +

+Please check that the acpi USE flag is set in +/etc/make.conf. Other USE flags that might be interesting for your +system are apm, lm_sensors, nforce2, nvidia, +pmu. See /usr/portage/profiles/use*.desc for details. If +you forgot to set one of these flags, you can recompile affected packages using +the --newuse flag in emerge, see man 1 emerge. +

+ + +
+
Configuring the kernel @@ -282,27 +295,27 @@ if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] then - logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." - exit 1 + logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." + exit 1 fi if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] then - logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." - exit 1 + logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." + exit 1 fi if on_ac_power then if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] - then - logger "Switching to ${RUNLEVEL_AC} runlevel" - /sbin/rc ${RUNLEVEL_AC} - fi + then + logger "Switching to ${RUNLEVEL_AC} runlevel" + /sbin/rc ${RUNLEVEL_AC} + fi elif [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] then - logger "Switching to ${RUNLEVEL_BATTERY} runlevel" - /sbin/rc ${RUNLEVEL_BATTERY} + logger "Switching to ${RUNLEVEL_BATTERY} runlevel" + /sbin/rc ${RUNLEVEL_BATTERY} fi @@ -394,6 +407,19 @@ CPU Power Management
+ + +

+Mobile processors can operate at different frequencies. Some allow changing +voltage as well. Most of the time your CPU doesn't need to run at full speed +and scaling it down will save much energy - often without any performance +decrease. +

+ + +
+ +
Some technical terms @@ -554,11 +580,14 @@ cpufreqd Daemon - Battery state, CPU load, temperature, running programs + Battery state, CPU load, temperature, running programs and more All available None - Sophisticated (but also complicated) setup. + Sophisticated (but somewhat complicated) setup. Extendible through plugins + like sensor monitoring (lm_sensors) or coordinating some NVidia based + graphics card memory and core. Cpufreqd is SMP aware and can optionally be + controlled manually at runtime. @@ -640,55 +669,64 @@ cpufreqd can be configured by editing /etc/cpufreqd.conf. The default one that ships with cpufreqd may look a bit confusing. I recommend replacing it with the one from Gentoo developer Henrik Brix Andersen (see -below). +below). Please notice that you need cpufreqd-2.0.0 or later. Earlier versions +have a different syntax for the config file.

-
+
 [General]
 pidfile=/var/run/cpufreqd.pid
-poll_interval=2
-pm_type=acpi
+poll_interval=3
+enable_plugins=acpi_ac, acpi_battery
 verbosity=5
+[/General]
 
 [Profile]
 name=ondemand
 minfreq=0%
 maxfreq=100%
 policy=ondemand
+[/Profile]
 
 [Profile]
 name=conservative
 minfreq=0%
 maxfreq=100%
 policy=conservative
+[/Profile]
 
 [Profile]
 name=powersave
 minfreq=0%
 maxfreq=100%
 policy=powersave
+[/Profile]
 
 [Profile]
 name=performance
 minfreq=0%
 maxfreq=100%
 policy=performance
+[/Profile]
 
 [Rule]
 name=battery
 ac=off
 profile=conservative
+[/Rule]
 
 [Rule]
 name=battery_low
 ac=off
 battery_interval=0-10
 profile=powersave
+[/Rule]
 
 [Rule]
 name=ac
 ac=on
 profile=ondemand
+[/Rule]
 

@@ -701,6 +739,15 @@ # rc

+

+Sometimes it can be desirable to select another policy than the daemon chooses, +for example when battery power is low, but you know that AC will be available +soon. In that case you can turn on cpufreqd's manual mode with +cpufreqd-set manual and select one of your configured policies (as +listed by cpufreqd-get). You can leave manual mode by executing +cpufreqd-set dynamic. +

+ Do not run more than one of the above programs at the same time. It may cause confusion like switching between two frequencies all the time. @@ -746,7 +793,6 @@ LCD Power Management
-Energy consumer no. 1

@@ -757,13 +803,19 @@ possibility to control the backlight dimming.

+ +
+
+Standby settings + +

-First thing to check is the standby/suspend/off timings of the display. As this -depends heavily on your windowmanager, I'll let you figure it out yourself. -Just two common places: Blanking the terminal can be done with setterm --blank <number-of-minutesM>, setterm -powersave on and -setterm -powerdown <number-of-minutesM>. -For X.org, modify /etc/X11/xorg.conf similar to this: +The first thing to check is the standby/suspend/off timings of the display. As +this depends heavily on your windowmanager, I'll let you figure it out +yourself. Just two common places: Blanking the terminal can be done with +setterm -blank <number-of-minutesM>, setterm -powersave on +and setterm -powerdown <number-of-minutesM>. For X.org, modify +/etc/X11/xorg.conf similar to this:

@@ -790,12 +842,19 @@
 This is the same for XFree86 and /etc/X11/XF86Config.
 

+ +
+
+Backlight dimming + +

Probably more important is the backlight dimming. If you have access to the dimming settings via a tool, write a small script that dims the backlight in battery mode and place it in your battery runlevel. The following script -should work on most IBM Thinkpads. It needs the app-laptop/ibm-acpi -package or the appropriate option in your kernel has to be enabled. +should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the +appropriate option in your kernel (IBM Thinkpads only). For Toshiba laptops, install +app-laptop/acpitool and skip configuration of ibm_acpi as described below.

@@ -811,7 +870,6 @@
 (Please read the warnings above before doing this!)
-# emerge ibm-acpi
 # echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi
 # /sbin/modules-update
 # echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6
@@ -827,7 +885,7 @@
 
 
 # See /proc/acpi/ibm/brightness for available values
-# Please read /usr/share/doc/ibm-acpi-*/README.gz
+# Please read /usr/src/linux/Documentation/ibm-acpi.txt
 
 # brigthness level in ac mode. Default is 7.
 BRIGHTNESS_AC=7
@@ -852,9 +910,15 @@
         ebegin "Setting LCD brightness"
         echo "level ${LEVEL}" > /proc/acpi/ibm/brightness
         eend $?
+    elif [[ -e /usr/bin/acpitool && -n $(acpitool -T | grep "LCD brightness") ]]
+    then
+        ebegin "Setting LCD brightness"
+        acpitool -l $LEVEL >/dev/null || ewarn "Unable to set lcd brightness"
+        eend $?
     else
         ewarn "Setting LCD brightness is not supported."
-        ewarn "Check that ibm_acpi is loaded into the kernel"
+        ewarn "For IBM Thinkpads, check that ibm_acpi is loaded into the kernel"
+        ewarn "For Toshiba laptops, you've got to install app-laptop/acpitool"
     fi
 }
 
@@ -885,59 +949,141 @@
 
 Disk Power Management
 
-Sleep when idle + +

+Hard disks consume less energy in sleep mode. Therefore it makes sense to +activate power saving features whenever the hard disk is not used for a certain +amount of time. I'll show you two alternative possibilities to do it. First, +laptop-mode will save most energy due to several measures which prevent or at +least delay write accesses. The drawback is that due to the delayed write +accesses a power outage or kernel crash will be more dangerous for data loss. +If you don't like this, you have to make sure that there are no processes which +write to your hard disk frequently. Afterwards you can enable power saving +features of your hard disk with hdparm as the second alternative. +

+ + +
+ +
+Increasing idle time - laptop-mode

-Let's bring the hard disk to sleep as early as possible whenever it is not -needed. I'll show you two possibilities to do it. First cpudyn supports -Disk Power Management. Uncomment the lines in the "Disk Options" section in -/etc/conf.d/cpudyn. To put your first disk to sleep after 60 -seconds of no activity, you would modify it like this: +Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches) +include the so-called laptop-mode. When activated, dirty buffers are +written to disk on read calls or after 10 minutes (instead of 30 seconds). This +minimizes the time the hard disk needs to be spun up.

-
-################################################
-# DISK OPTIONS
-# (disabled by default)
-################################################
+
+# emerge laptop-mode-tools
+
-# -# Timeout to put the disk in standby mode if there was no -# io during that period (in seconds) -# -
-TIMEOUT=60 - -# -# Specified disks to spindown (comma separated devices) -# - -DISKS=/dev/hda +

+laptop-mode-tools has its configuration file in +/etc/laptop-mode/laptop-mode.conf. Adjust it the way you like it, +it's well commented. Run rc-update add laptop_mode battery to start it +automatically. +

+ +

+Recent versions (1.11 and later) of laptop-mode-tools include a new tool +lm-profiler. It will monitor your system's disk usage and running +network services and suggests to disable unneeded ones. You can either disable +them through laptop-mode-tools builtin runlevel support (which will be reverted +by Gentoo's /sbin/rc) or use your default/battery +runlevels (recommended). +

+ +
+# lm-profiler
+Profiling session started.
+Time remaining: 600 seconds
+[4296896.602000] amarokapp
+Time remaining: 599 seconds
+[4296897.714000] sort
+[4296897.970000] mv
+Time remaining: 598 seconds
+Time remaining: 597 seconds
+[4296900.482000] reiserfs/0
+
+ +

+After profiling your system for ten minutes, lm-profiler will present a list of +services which might have caused disk accesses during that time. +

+ +
+Program:     "atd"
+Reason:      standard recommendation (program may not be running)
+Init script: /etc/init.d/atd (GUESSED)
+
+Do you want to disable this service in battery mode? [y/N]: n
 

-The second possibility is using a small script and hdparm. Create -/etc/init.d/pm.hda like this: +To disable atd as suggested in the example above, you would run rc-update +del atd battery. Be careful not to disable services that are needed for +your system to run properly - lm-profiler is likely to generate some false +positives. Do not disable a service if you are unsure whether it's needed. +

+ + +
+ +
+Limiting write accesses + + +

+If you don't want to use laptop-mode, you must take special care to disable +services that write to your disk frequently - syslogd is a good +candidate, for example. You probably don't want to shut it down completely, but +it's possible to modify the config file so that "unnecessary" things don't get +logged and thus don't create disk traffic. Cups writes to disk periodically, so +consider shutting it down and only enable it manually when needed. +

+ +
+# rc-update del cupsd battery
+
+ +

+You can also use lm-profiler from laptop-mode-tools (see above) to find +services to disable. Once you eliminated all of them, go on with configuring +hdparm. +

+ + +
+ +
+hdparm + + +

+The second possibility is using a small script and hdparm. Skip this if you +are using laptop-mode. Otherwise, create /etc/init.d/pmg_hda:

 #!/sbin/runscript
 
 depend() {
-  after hdparm
+after hdparm
 }
 
 start() {
-  ebegin "Activating Power Management for Hard Drives"
-  hdparm -q -S12 /dev/hda
-  eend $?
+ebegin "Activating Power Management for Hard Drives"
+hdparm -q -S12 /dev/hda
+eend $?
 }
 
 stop () {
-  ebegin "Deactivating Power Management for Hard Drives"
-  hdparm -q -S253 /dev/hda
-  eend $?
+ebegin "Deactivating Power Management for Hard Drives"
+hdparm -q -S253 /dev/hda
+eend $?
 }
 
@@ -947,9 +1093,9 @@

-# chmod +x /etc/init.d/pm.hda
+# chmod +x /etc/init.d/pmg_hda
 # /sbin/depscan.sh
-# rc-update add pm.hda battery
+# rc-update add pmg_hda battery
 
@@ -959,49 +1105,12 @@
-
-Increasing idle time - laptop-mode - - -

-Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches) -include the so-called laptop-mode. When activated, dirty buffers are -written to disk on read calls or after 10 minutes (instead of 30 seconds). This -minimizes the time the hard disk needs to be spun up. -

-
-# emerge laptop-mode-tools
-
- -

-laptop-mode-tools has it's configuration file in -/etc/laptop-mode/laptop-mode.conf. Adjust it the way you like it, -it's well commented. Run rc-update add laptop_mode battery to start it -automatically. -

- - -
Other tricks

-Besides putting your disk to sleep state as early as possible, it is a good -idea to minimize disk accesses. Have a look at processes that write to your -disk frequently - the syslogd is a good candidate. You probably don't want to -shut it down completely, but it's possible to modify the config file so that -"unnecessary" things don't get logged and thus don't create disk traffic. Cups -writes to disk periodically, so consider shutting it down and only enable it -manually when needed. -

- -
-# rc-update del cupsd battery
-
- -

Another possibility is to deactivate swap in battery mode. Before writing a swapon/swapoff switcher, make sure there is enough RAM and swap isn't used heavily, otherwise you'll be in big problems. @@ -1063,15 +1172,20 @@

-Wireless LAN cards consume quite a few energy. Put them in Power Management -mode in analogy to the pm.hda script. +Wireless LAN cards consume quite a bit of energy. Put them in Power Management +mode in analogy to the pmg_hda script.

+ +This script assumes your wireless interface is called wlan0; replace +this with the actual name of your interface. + +
 #!/sbin/runscript
 start() {
   ebegin "Activating Power Management for Wireless LAN"
-  iwconfig wlan0 power on power max period 3
+  iwconfig wlan0 power on
   eend $?
 }
 
@@ -1083,18 +1197,18 @@
 

-Starting this script will put wlan0 in Power Management mode, going to sleep at -the latest three seconds after no traffic. -Save it as /etc/init.d/pm.wlan0 and add it to the battery runlevel -like the disk script above. See man iwconfig for details and more -options. If your driver and access point support changing the beacon time, this -is a good starting point to save even more energy. +Starting this script will activate power saving features for wlan0. Save it as +/etc/init.d/pmg_wlan0 and add it to the battery runlevel like the +disk script above. See man iwconfig for details and more options like +the period between wakeups or timeout settings. If your driver and access point +support changing the beacon time, this is a good starting point to save even +more energy.

-# chmod +x /etc/init.d/pm.wlan0
+# chmod +x /etc/init.d/pmg_wlan0
 # /sbin/depscan.sh
-# rc-update add pm.wlan0 battery
+# rc-update add pmg_wlan0 battery
 
@@ -1128,7 +1242,6 @@ Sleep states: sleep, standby, suspend to disk
-Overview

@@ -1167,7 +1280,7 @@

-Once your kernel is prepared like above, you can use the +Once your kernel is properly configured, you can use the hibernate-script to activate suspend or sleep mode. Let's install that first.

@@ -1396,7 +1509,6 @@ Troubleshooting
-If things go wrong...

@@ -1488,6 +1600,21 @@

+Q: My system logger reports things like "logger: ACPI group battery / action +battery is not defined". +

+ +

+A: This message is generated by the /etc/acpi/default.sh script that is +shipped with acpid. You can safely ignore it. If you like to get rid of it, you +can comment the appropriate line in /etc/acpi/default.sh as shown below: +

+ +
+        *)      # logger "ACPI action $action is not defined"
+
+ +

Q: I have a Dell Inspiron 51XX and I don't get any ACPI events.

@@ -1552,8 +1679,11 @@

-A: Don't fear to contact me, Dennis -Nienhüser, directly. +A: Don't fear to contact me, Dennis +Nienhüser, directly. The +Gentoo Forums are a good place to +get help as well. If you prefer IRC, try the #gentoo-laptop channel at +irc.freenode.net.

-- gentoo-doc-cvs@gentoo.org mailing list