Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 45082 Details for
Bug 69734
Update for Power Management Guide (new version 1.18)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
power-management-guide.diff
power-management-guide.diff.txt (text/plain), 13.48 KB, created by
Dennis Nienhüser (RETIRED)
on 2004-12-01 14:04:15 UTC
(
hide
)
Description:
power-management-guide.diff
Filename:
MIME Type:
Creator:
Dennis Nienhüser (RETIRED)
Created:
2004-12-01 14:04:15 UTC
Size:
13.48 KB
patch
obsolete
>--- power-management-guide-1.17.xml 2004-10-15 22:33:00.000000000 +0200 >+++ power-management-guide.xml 2004-12-01 22:58:16.161976088 +0100 >@@ -5,7 +5,7 @@ > <title>Power Management Guide</title> > > <author title="Author"> >- <mail link="fragfred@gmx.de">Dennis Nienhüser</mail> >+ <mail link="fragfred@gmx.de">Dennis Nienhüser</mail> > </author> > > <abstract> >@@ -17,8 +17,8 @@ > <!-- See http://creativecommons.org/licenses/by-sa/2.0 --> > <license/> > >-<version>1.17</version> >-<date>October 10, 2004</date> >+<version>1.18</version> >+<date>December 01, 2004</date> > > <chapter> > <title>Introduction</title> >@@ -170,9 +170,19 @@ > </pre> > > <p> >-Decide yourself whether you want to enable Software Suspend, Suspend-to-Disk >-and Sleep States (see below). If you own an ASUS, Medion or Toshiba laptop, >-enable the appropriate section. >+Decide yourself whether you want to enable Software Suspend, Suspend-to-Disk and >+Sleep States (see below). If you own an ASUS, Medion or Toshiba laptop, enable >+the appropriate section. Recent kernel versions (2.6.9 and later) include an >+<e>'ondemand' governor</e> for CPU Frequency Scaling, activate it as well when >+using such a kernel. >+</p> >+ >+<p> >+The kernel has to know how to enable CPU frequency scaling on your processor. As >+each type of CPU has a different interface, you've got to choose the right >+driver for your processor. Be careful here - enabling <e>Intel Pentium 4 clock >+modulation</e> on a Pentium M system will lead to strange results for example. >+Consult the kernel documentation if you're unsure which one to take. > </p> > > <p> >@@ -230,70 +240,106 @@ > > <p> > Typical ACPI events are closing the lid, changing the power source or pressing >-the sleep button. Every acpi event recognized by the kernel is catched by acpid >-which calls <path>/etc/acpi/default.sh</path>. Here is a basic modification >-supporting runlevel switching: >-</p> >- >-<pre caption="Event driven runlevel switching with acpid"> >-#!/bin/sh >- >-set $* >- >-group=${1/\/*/} >-action=${1/*\//} >- >-<comment># runlevel to use in AC mode</comment> >-RLVL_AC="default" >-<comment># runlevel to use in battery mode</comment> >-RLVL_BATTERY="battery" >- >-<comment># file indicating the AC state. Verify the filename before using</comment> >-AC_STATE="/proc/acpi/ac_adapter/AC/state" >-<comment># this string means running on AC</comment> >-AC_ON="on-line" >-<comment># this string means running on batteries</comment> >-AC_OFF="off-line" >+the sleep button. Create the following files to switch between <e>default</e> >+and <e>battery</e> runlevel depending on the power source: >+</p> >+ >+<pre caption="/etc/acpi/switch_runlevel.conf"> >+#!/bin/bash >+ >+# This runlevel will be used in AC mode >+#RUNLEVEL_AC="default" >+ >+# This runlevel will be used in battery mode >+#RUNLEVEL_BATTERY="battery" >+ >+# This file indicates the AC state >+# It's location may vary on your system. The script checks for >+# /proc/acpi/ac_adapter/AC/state, /proc/acpi/ac_adapter/AC0/state, >+# /proc/acpi/ac_adapter/AC1/state and /proc/acpi/ac_adapter/AC2/state >+# If it is something else on your system, uncomment the next line >+# and change appropriately. >+#AC_STATE="/proc/acpi/ac_adapter/AC/state" >+</pre> >+ >+<pre caption="/etc/acpi/switch_runlevel.sh"> >+#!/bin/bash >+ >+RUNLEVEL_AC="default" >+RUNLEVEL_BATTERY="battery" >+ >+if [ -f '/proc/acpi/ac_adapter/AC0/state' ] >+then >+ AC_STATE="/proc/acpi/ac_adapter/AC0/state" >+elif [ -f '/proc/acpi/ac_adapter/AC1/state' ] >+then >+ AC_STATE="/proc/acpi/ac_adapter/AC1/state" >+elif [ -f '/proc/acpi/ac_adapter/AC2/state' ] >+then >+ AC_STATE="/proc/acpi/ac_adapter/AC2/state" >+else >+ AC_STATE="/proc/acpi/ac_adapter/AC/state" >+fi >+ >+ >+source /etc/acpi/switch_runlevel.conf > > function SwitchRunlevel() { >- if [[ "$(grep ${AC_OFF} ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RLVL_BATTERY}" ]] >+ >+ if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] > then >- logger "Switching to ${RLVL_BATTERY} runlevel" >- /sbin/rc ${RLVL_BATTERY} >- elif [[ "$(grep ${AC_ON} ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RLVL_AC}" ]] >+ logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." >+ exit 1 >+ fi >+ >+ >+ if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] > then >- logger "Switching to ${RLVL_AC} runlevel" >- /sbin/rc ${RLVL_AC} >+ logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." >+ exit 1 >+ fi >+ >+ if [ ! -f "${AC_STATE}" ] >+ then >+ logger "${0}: File ${AC_STATE} does not exist. Aborting" >+ exit 1 >+ fi >+ >+ >+ if [[ "$(grep off-line ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] >+ then >+ logger "Switching to ${RUNLEVEL_BATTERY} runlevel" >+ /sbin/rc ${RUNLEVEL_BATTERY} >+ elif [[ "$(grep on-line ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] >+ then >+ logger "Switching to ${RUNLEVEL_AC} runlevel" >+ /sbin/rc ${RUNLEVEL_AC} > fi > } >+</pre> > >+<pre caption="/etc/acpi/events/pmg_ac_adapter"> >+event=ac_adapter.* >+action=/etc/acpi/actions/pmg_ac_adapter.sh %e >+</pre> > >-case "$group" in >- battery) >- case "$action" in >- battery) >- SwitchRunlevel >- ;; >- *) >- logger "ACPI group battery / action $action is not defined" >- ;; >- esac >- ;; >- >- ac_adapter) >- case "$action" in >- ac_adapter) >- SwitchRunlevel >- ;; >- *) >- logger "ACPI group ac_adapter / action $action is not defined" >- ;; >- esac >- ;; >- *) >- logger "ACPI group $group / action $action is not defined" >- ;; >-esac >+<pre caption="/etc/acpi/events/pmg_battery"> >+event=battery.* >+action=/etc/acpi/actions/pmg_battery.sh %e >+</pre> >+ >+<pre caption="/etc/acpi/actions/pmg_ac_adapter.sh"> >+#! /bin/bash >+ >+source /etc/acpi/switch_runlevel.sh >+SwitchRunlevel >+</pre> >+ >+<pre caption="/etc/acpi/actions/pmg_battery.sh"> >+#! /bin/bash >+ >+source /etc/acpi/switch_runlevel.sh >+SwitchRunlevel > </pre> > > <p> >@@ -313,7 +359,7 @@ > > <pre caption="Runlevel switch at boot time by editing local.start"> > <comment># Fake acpi event to switch runlevel if running on batteries</comment> >-/etc/acpi/default.sh "battery/battery" >+/etc/acpi/actions/pmg_battery.sh "battery/battery" > </pre> > > <p> >@@ -328,6 +374,43 @@ > <chapter> > <title>CPU Power Management</title> > <section> >+<title>Some technical terms</title> >+<body> >+ >+<p> >+CPU frequency scaling brings up some technical terms that might be unknown to >+you. Here's a quick introduction. >+</p> >+ >+<p> >+First of all, the kernel has to be able to change the processor's frequency. The >+<e>CPUfreq processor driver</e> knows the commands to do it on your CPU. Thus >+it's important to choose the right one in your kernel. You should already have >+done it above. Once the kernel knows how to change frequencies, it has to know >+which frequency it should set. This is done according to the <e>policy</e> which >+consists of <e>CPUfreq policy</e> and a <e>governor</e>. A CPUfreq policy are >+just two numbers which define a range the frequency has to stay between - >+minimal and maximal frequency. The governor now decides which of the available >+frequencies in between minimal and maximal frequency to choose. For example, the >+<e>powersave governor</e> always chooses the lowest frequency available, the >+<e>performance governor</e> the highest one. The <e>userspace governor</e> makes >+no decision but chooses whatever the user (or a program in userspace) wants - >+which means it reads the frequency from >+<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>. >+</p> >+ >+<p> >+This doesn't sound like dynamic frequency changes yet and in fact it isn't. >+Dynamics however can be accomplished with various approaches. For example, >+the <e>ondemand governor</e> makes its decisions depending on the current CPU >+load. The same is done by various userland tools like <c>cpudyn</c>, >+<c>speedfreq</c>, <c>powernowd</c> and many more. ACPI events can be used to >+enable or disable dynamic frequency changes depending on power source. >+</p> >+ >+</body> >+</section> >+<section> > <title>Setting the frequency manually</title> > <body> > >@@ -394,39 +477,101 @@ > > <p> > The above is quite nice, but not doable in daily life. Better let your system >-set the appropriate frequency automatically. A couple of user space programs >-like to do it for you. The following table gives a quick overview to help you >-decide on one of them. >+set the appropriate frequency automatically. There are many different approaches >+to do this. The following table gives a quick overview to help you decide on one >+of them. It's roughly seperated in three categories <e>kernel</e> for approaches >+that only need kernel support, <e>daemon</e> for programs that run in the >+background and <e>graphical</e> for programs that provide a GUI for easy >+configuration and changes. > </p> > > <table> > <tr> > <th>Name</th> >- <th>Pro</th> >- <th>Con</th> >+ <th>Category</th> >+ <th>Switch decision</th> >+ <th>Kernel governors</th> >+ <th>Further governors</th> >+ <th>Comments</th> >+</tr> >+<tr> >+ <ti>'ondemand' governor</ti> >+ <ti>Kernel</ti> >+ <ti>CPU load</ti> >+ <ti>N.A.</ti> >+ <ti>N.A.</ti> >+ <ti> >+ Further tuning through files in >+ <path>/sys/devices/system/cpu/cpu0/cpufreq/ondemand/</path>. Still requires >+ userland tools (programs, scripts) if governor switching or similar is >+ desired. >+ </ti> > </tr> > <tr> > <ti><uri link="http://mnm.uib.es/~gallir/cpudyn/">cpudyn</uri></ti> >- <ti>Also supports disk standby</ti> >- <ti></ti> >+ <ti>Daemon</ti> >+ <ti>CPU load</ti> >+ <ti>None</ti> >+ <ti>Dynamic</ti> >+ <ti> >+ Also supports disk standby - notice however that <e>laptop mode</e> in most >+ cases will do a better job. >+ </ti> > </tr> > <tr> >- <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreq</uri></ti> >- <ti>Sophisticated setup possible</ti> >- <ti>Complicated setup</ti> >+ <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreqd</uri></ti> >+ <ti>Daemon</ti> >+ <ti>Battery state, CPU load, running programs</ti> >+ <ti>All available</ti> >+ <ti>None</ti> >+ <ti> >+ Sophisticated (but also complicated) setup. An optimal configuration >+ requires detailed knowledge of your system. >+ </ti> >+</tr> >+<tr> >+ <ti> >+ <uri link="http://www.deater.net/john/powernowd.html">powernowd</uri> >+ </ti> >+ <ti>Daemon</ti> >+ <ti>CPU load</ti> >+ <ti>None</ti> >+ <ti>Passive, sine, aggressive</ti> >+ <ti> >+ Supports SMP. >+ </ti> > </tr> > <tr> > <ti><uri link="http://www.goop.org/~jeremy/speedfreq/">speedfreq</uri></ti> >+ <ti>Daemon</ti> >+ <ti>CPU load</ti> >+ <ti>None</ti> >+ <ti>Dynamic, powersave, performance, fixed speed</ti> >+ <ti> >+ Small yet powerful with an useful client/server interface. Requires a 2.6 >+ kernel. >+ </ti> >+</tr> >+<tr> >+ <ti><uri link="http://cpuspeedy.sourceforge.net/">gtk-cpuspeedy</uri></ti> >+ <ti>Graphical</ti> >+ <ti>None</ti> >+ <ti>None</ti> >+ <ti>None</ti> > <ti> >- Small yet powerful<br /> >- Useful client/server interface >+ Gnome application, a graphical tool to set CPU frequency manually. It does >+ not offer any automation and is mainly listed for the sake of completeness. > </ti> >- <ti>Kernel 2.6 series only</ti> > </tr> > <tr> >- <ti><uri link="http://www.deater.net/john/powernowd.html">powernowd</uri></ti> >- <ti>Supports SMP</ti> >- <ti></ti> >+ <ti>klaptopdaemon</ti> >+ <ti>Graphical</ti> >+ <ti>Battery state</ti> >+ <ti>All available</ti> >+ <ti>None</ti> >+ <ti> >+ KDE only, 'ondemand' governor required for dynamic frequency scaling. >+ </ti> > </tr> > </table> > >@@ -548,9 +693,17 @@ > <c>speedfreq</c>. > </p> > >+</body> >+</section> >+ >+<section> >+<title>Verifying the result</title> >+ >+<body> >+ > <p> > The last thing to check is that your new policies do a good job. An easy way to >-do so is monitoring the CPU speed while working with your laptop: >+do so is monitoring CPU speed while working with your laptop: > </p> > > <pre caption="Monitoring CPU speed"> >@@ -716,23 +869,21 @@ > > <p> > <!-- FIXME: bug #45593 --> >-To start and stop laptop-mode, create a script /etc/init.d/laptop-mode. You can >-take the one included in >-<path>/usr/src/linux/Documentation/laptop-mode.txt</path>. Onces it's ready, >-make sure it gets called. >+Besides kernel support you also need a script that controls starting and >+stopping of laptop-mode. The package <c>laptop-mode-tools</c> contains it. > </p> > > <pre caption="Automatic start of laptop-mode"> >-# <i>rc-update add laptop-mode battery</i> >+# <i>emerge laptop-mode-tools</i> > </pre> > >-<warn> >-Once again: Be careful with sleep/spin down settings of your hard drive. >-Setting it to small values might wear out your drive and lose warranty. Be sure >-to read the documentation in laptop-mode.txt. Make sure to stop laptop-mode >-before your battery runs out of power and data gets written to disk - otherwise >-you will at least lose the last 10 minutes of your work. >-</warn> >+<p> >+<c>laptop-mode-tools</c> has it's configuration file in >+<path>/etc/laptop-mode/laptop-mode.conf</path>. Adjust it the way you like it, >+it's well commented. If you have <e>apm</e> or <e>acpi</e> in your USE flags, >+laptop-mode will be started automatically in battery mode. Otherwise you can >+automate it by running <c>rc-update add laptop-mode battery</c>. >+</p> > > </body> > </section> >@@ -1049,6 +1200,16 @@ > </p> > > <p> >+<e>Q:</e> When configuring the kernel, powersave, performance and userspace >+governors show up, but that ondemand thing is missing. Where do I get it? >+</p> >+ >+<p> >+<e>A:</e> The ondemand governor is only included in recent kernel sources. Try >+updating them. >+</p> >+ >+<p> > <e>Q:</e> Battery life time seems to be worse than before. > </p> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 69734
:
43080
|
45082
|
47385
|
47563
|
47586
|
47703