| 1 |
swift |
1.1 |
<?xml version='1.0' encoding="UTF-8"?>
|
| 2 |
|
|
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
|
| 3 |
nightmorph |
1.51 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.50 2011/09/30 15:07:46 cam Exp $ -->
|
| 4 |
nightmorph |
1.42 |
|
| 5 |
|
|
<guide>
|
| 6 |
swift |
1.1 |
<title>Power Management Guide</title>
|
| 7 |
|
|
|
| 8 |
swift |
1.4 |
<author title="Author">
|
| 9 |
swift |
1.49 |
<mail link="swift"/>
|
| 10 |
nightmorph |
1.26 |
</author>
|
| 11 |
swift |
1.1 |
|
| 12 |
|
|
<abstract>
|
| 13 |
swift |
1.49 |
In recent years, power management has become one of the differentiating
|
| 14 |
|
|
features in the quest for finding the perfect laptop. Yet, the operating system
|
| 15 |
|
|
must support the various power saving functionalities too. In this guide, we
|
| 16 |
|
|
cover how to setup your Gentoo installation so it manages power-hungry resources
|
| 17 |
|
|
in a flexible yet automated manner.
|
| 18 |
swift |
1.1 |
</abstract>
|
| 19 |
|
|
|
| 20 |
|
|
<!-- The content of this document is licensed under the CC-BY-SA license -->
|
| 21 |
so |
1.15 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
|
| 22 |
swift |
1.1 |
<license/>
|
| 23 |
|
|
|
| 24 |
nightmorph |
1.51 |
<version>6</version>
|
| 25 |
|
|
<date>2012-03-28</date>
|
| 26 |
swift |
1.1 |
|
| 27 |
|
|
<chapter>
|
| 28 |
|
|
<title>Introduction</title>
|
| 29 |
|
|
<section>
|
| 30 |
swift |
1.49 |
<title>About this document...</title>
|
| 31 |
swift |
1.1 |
<body>
|
| 32 |
|
|
|
| 33 |
swift |
1.49 |
<p>
|
| 34 |
|
|
This document describes the setup of power management features on your laptop.
|
| 35 |
|
|
Although some of the information in this guide can be applied to power
|
| 36 |
|
|
management for servers, it is not the intention of this document to go that
|
| 37 |
|
|
route. Please be careful when applying this on a non-laptop system.
|
| 38 |
|
|
</p>
|
| 39 |
swift |
1.48 |
|
| 40 |
swift |
1.1 |
<p>
|
| 41 |
swift |
1.49 |
Within this document, we will focus primarily on the laptop mode tools since it
|
| 42 |
|
|
offers a complete set of functionalities. However, we will also refer to other
|
| 43 |
|
|
tools that might offer a more detailed approach on individual settings. In such
|
| 44 |
|
|
cases, you will need to disable the feature from the laptop mode tools so that
|
| 45 |
|
|
both tools do not fight over the same resource control.
|
| 46 |
swift |
1.1 |
</p>
|
| 47 |
|
|
|
| 48 |
|
|
</body>
|
| 49 |
|
|
</section>
|
| 50 |
|
|
<section>
|
| 51 |
swift |
1.49 |
<title>About laptop_mode</title>
|
| 52 |
swift |
1.1 |
<body>
|
| 53 |
|
|
|
| 54 |
|
|
<p>
|
| 55 |
swift |
1.49 |
The <c>laptop_mode</c> setting is an in-kernel configuration setting that
|
| 56 |
|
|
optimizes I/O, allowing disks to spin down properly (and not be woken up
|
| 57 |
|
|
immediately afterwards for queued operations).
|
| 58 |
swift |
1.1 |
</p>
|
| 59 |
|
|
|
| 60 |
|
|
</body>
|
| 61 |
|
|
</section>
|
| 62 |
|
|
<section>
|
| 63 |
swift |
1.49 |
<title>About laptop-mode-tools</title>
|
| 64 |
swift |
1.1 |
<body>
|
| 65 |
|
|
|
| 66 |
|
|
<p>
|
| 67 |
swift |
1.49 |
The <e>Laptop Mode Tools</e> is a software package
|
| 68 |
|
|
(<c>app-laptop/laptop-mode-tools</c>) which allows the user to optimize power
|
| 69 |
|
|
saving functions. It allows managing the <c>laptop_mode</c> setting in the Linux
|
| 70 |
|
|
kernel, but has additional features allowing you to tweak other power-related
|
| 71 |
|
|
settings on the system.
|
| 72 |
swift |
1.1 |
</p>
|
| 73 |
|
|
|
| 74 |
|
|
</body>
|
| 75 |
|
|
</section>
|
| 76 |
|
|
</chapter>
|
| 77 |
|
|
|
| 78 |
|
|
<chapter>
|
| 79 |
swift |
1.49 |
<title>Linux Kernel Configuration</title>
|
| 80 |
swift |
1.1 |
<section>
|
| 81 |
swift |
1.49 |
<title>Minimum kernel setup</title>
|
| 82 |
swift |
1.1 |
<body>
|
| 83 |
|
|
|
| 84 |
|
|
<p>
|
| 85 |
swift |
1.49 |
There are different kernel sources in Portage. We recommend using
|
| 86 |
|
|
<c>gentoo-sources</c>, but if you want advanced hibernation support you might
|
| 87 |
|
|
need <c>tuxonice-sources</c>. To enable proper power management features in the
|
| 88 |
|
|
Linux kernel, enable at least the following settings:
|
| 89 |
swift |
1.1 |
</p>
|
| 90 |
|
|
|
| 91 |
nightmorph |
1.51 |
<pre caption="Minimum kernel setup for Power Management">
|
| 92 |
swift |
1.49 |
<![CDATA[
|
| 93 |
|
|
General setup --->
|
| 94 |
|
|
[*] Configure standard kernel features (expert users) --->
|
| 95 |
|
|
|
| 96 |
|
|
Power management and ACPI options --->
|
| 97 |
nightmorph |
1.51 |
[*] Run-time PM core functionality
|
| 98 |
swift |
1.49 |
[*] ACPI (Advanced Configuration and Power Interface) Support --->
|
| 99 |
|
|
<*> AC Adapter
|
| 100 |
|
|
<*> Battery
|
| 101 |
|
|
-*- Button
|
| 102 |
|
|
-*- Video
|
| 103 |
|
|
<*> Fan
|
| 104 |
|
|
<*> Processor
|
| 105 |
|
|
<*> Thermal Zone
|
| 106 |
|
|
[*] Power Management Timer Support
|
| 107 |
|
|
|
| 108 |
|
|
[*] CPU Frequency scaling --->
|
| 109 |
|
|
[*] CPU Frequency scaling
|
| 110 |
|
|
<*> 'performance' governor
|
| 111 |
|
|
<*> 'powersave' governor
|
| 112 |
|
|
<*> 'userspace' governor
|
| 113 |
|
|
<*> 'ondemand' governor
|
| 114 |
|
|
<*> 'conservative' governor
|
| 115 |
|
|
<*> ACPI Processor P-States driver
|
| 116 |
|
|
]]>
|
| 117 |
|
|
</pre>
|
| 118 |
swift |
1.1 |
|
| 119 |
|
|
<p>
|
| 120 |
swift |
1.49 |
Don't forget to enable the CPU frequency scaling driver for your CPU, located
|
| 121 |
|
|
right after the <e>ACPI Processor P-States driver</e> mentioned above.
|
| 122 |
swift |
1.1 |
</p>
|
| 123 |
|
|
|
| 124 |
nightmorph |
1.17 |
<p>
|
| 125 |
swift |
1.49 |
Build and install the new kernel (if necessary) and reboot.
|
| 126 |
nightmorph |
1.17 |
</p>
|
| 127 |
|
|
|
| 128 |
|
|
</body>
|
| 129 |
|
|
</section>
|
| 130 |
swift |
1.49 |
<!--
|
| 131 |
|
|
<section id="kernelconfig">
|
| 132 |
|
|
<title>Additional kernel configuration entries</title>
|
| 133 |
swift |
1.1 |
<body>
|
| 134 |
|
|
|
| 135 |
|
|
<p>
|
| 136 |
swift |
1.49 |
Further down this guide, additional kernel settings might be suggested. To
|
| 137 |
|
|
lessen the effort to maintain the guide, and to make sure settings are correctly
|
| 138 |
|
|
identified, we will use the kernel configuration short-hand notations. These
|
| 139 |
|
|
notations are simple strings, like <c>CONFIG_USB_SUSPEND</c>. But how to read
|
| 140 |
|
|
this?
|
| 141 |
swift |
1.1 |
</p>
|
| 142 |
|
|
|
| 143 |
|
|
<p>
|
| 144 |
swift |
1.49 |
Well, then you configure your kernel (through <c>make menuconfig</c>), you can
|
| 145 |
|
|
search through the configuration settings for a particular entry. Press <c>/</c>
|
| 146 |
|
|
while configuring the Linux kernel and type the setting
|
| 147 |
|
|
(<c>CONFIG_USB_SUSPEND</c>). The software will tell you what the setting is,
|
| 148 |
|
|
what it is for, when you can select it (i.e. on which settings it depends before
|
| 149 |
|
|
you can see it) but most importantly, where you can find it.
|
| 150 |
swift |
1.1 |
</p>
|
| 151 |
|
|
|
| 152 |
swift |
1.49 |
<pre caption="Result of a search operation during menuconfig">
|
| 153 |
|
|
<![CDATA[Symbol: USB_SUSPEND [=n]
|
| 154 |
|
|
Type : boolean
|
| 155 |
|
|
Prompt: USB runtime power management (autosuspend) and wakeup
|
| 156 |
|
|
Defined at drivers/usb/core/Kconfig:93
|
| 157 |
|
|
Depends on: USB_SUPPORT [=y] && USB [=y] && PM_RUNTIME [=n]
|
| 158 |
|
|
Location:
|
| 159 |
|
|
-> Device Drivers
|
| 160 |
|
|
-> USB support (USB_SUPPORT [=y])
|
| 161 |
|
|
-> Support for Host-side USB (USB [=y]) ]]>
|
| 162 |
|
|
</pre>
|
| 163 |
|
|
|
| 164 |
|
|
</body>
|
| 165 |
|
|
</section>
|
| 166 |
|
|
-->
|
| 167 |
|
|
</chapter>
|
| 168 |
rane |
1.20 |
|
| 169 |
swift |
1.49 |
<chapter>
|
| 170 |
|
|
<title>Using Laptop Mode Tools</title>
|
| 171 |
|
|
<section>
|
| 172 |
|
|
<title>Installation</title>
|
| 173 |
|
|
<body>
|
| 174 |
swift |
1.1 |
|
| 175 |
|
|
<p>
|
| 176 |
swift |
1.49 |
It comes to no surprise that installation of the <e>Laptop Mode Tools</e>
|
| 177 |
|
|
software is easily done through <c>emerge laptop-mode-tools</c>. However, this
|
| 178 |
|
|
package takes on additional, optional settings through USE flag configuration.
|
| 179 |
|
|
So let's first take a look at the supported USE flags and what they mean to the
|
| 180 |
|
|
package.
|
| 181 |
swift |
1.8 |
</p>
|
| 182 |
|
|
|
| 183 |
swift |
1.49 |
<table>
|
| 184 |
|
|
<tr>
|
| 185 |
|
|
<th>USE flag</th>
|
| 186 |
|
|
<th>Description</th>
|
| 187 |
|
|
<th>Suggested when...</th>
|
| 188 |
|
|
</tr>
|
| 189 |
|
|
<tr>
|
| 190 |
|
|
<ti>acpi</ti>
|
| 191 |
|
|
<ti>
|
| 192 |
|
|
Depend on <c>sys-power/acpid</c> so that changes in the system are
|
| 193 |
|
|
captured and power saving features are automatically enabled/disabled.
|
| 194 |
|
|
</ti>
|
| 195 |
|
|
<ti>your laptop is not too old (~ year 2003 and later)</ti>
|
| 196 |
|
|
</tr>
|
| 197 |
|
|
<tr>
|
| 198 |
|
|
<ti>apm</ti>
|
| 199 |
|
|
<ti>
|
| 200 |
|
|
Depend on <c>sys-apps/apmd</c> so that changes in the system are captured
|
| 201 |
|
|
and power saving features are automatically enabled/disabled.
|
| 202 |
|
|
</ti>
|
| 203 |
|
|
<ti>your laptop is very old</ti>
|
| 204 |
|
|
</tr>
|
| 205 |
|
|
<tr>
|
| 206 |
|
|
<ti>bluetooth</ti>
|
| 207 |
|
|
<ti>
|
| 208 |
|
|
Depend on <c>net-wireless/bluez</c>, enabling the <c>laptop-mode-tools</c>
|
| 209 |
|
|
to manage bluetooth settings (enabling/disabling the service based on
|
| 210 |
|
|
battery availability)
|
| 211 |
|
|
</ti>
|
| 212 |
|
|
<ti>your laptop (and kernel) supports bluetooth</ti>
|
| 213 |
|
|
</tr>
|
| 214 |
|
|
<tr>
|
| 215 |
|
|
<ti>scsi</ti>
|
| 216 |
|
|
<ti>
|
| 217 |
|
|
Depend on <c>sys-apps/sdparm</c>, enabling the <c>laptop-mode-tools</c> to
|
| 218 |
|
|
manage SCSI (<e>and not</e> SATA) disk parameters.
|
| 219 |
|
|
</ti>
|
| 220 |
|
|
<ti>your laptop uses SCSI disks</ti>
|
| 221 |
|
|
</tr>
|
| 222 |
|
|
</table>
|
| 223 |
|
|
|
| 224 |
swift |
1.8 |
<p>
|
| 225 |
swift |
1.49 |
As you can see, there are two USE flags that seem to collide: <c>acpi</c> and
|
| 226 |
|
|
<c>apm</c>. So what's the deal there?
|
| 227 |
swift |
1.1 |
</p>
|
| 228 |
|
|
|
| 229 |
swift |
1.49 |
<ul>
|
| 230 |
|
|
<li>
|
| 231 |
|
|
The <c>apm</c> USE flag enables support for <e>Advanced Power
|
| 232 |
|
|
Management</e>, an older (before year 2000) standard for power management
|
| 233 |
|
|
features within a system.
|
| 234 |
|
|
</li>
|
| 235 |
|
|
<li>
|
| 236 |
|
|
The <c>acpi</c> USE flag enables support for <e>Advanced Configuration and
|
| 237 |
|
|
Power Interface</e>, the successor of APM. All modern laptops support ACPI.
|
| 238 |
|
|
</li>
|
| 239 |
|
|
</ul>
|
| 240 |
|
|
|
| 241 |
swift |
1.1 |
<p>
|
| 242 |
swift |
1.49 |
Depending on your system, you will either need <c>acpi</c> or <c>apm</c> set. In
|
| 243 |
|
|
the remainder of this guide, we assume that your laptop is recent enough to use
|
| 244 |
|
|
ACPI.
|
| 245 |
swift |
1.1 |
</p>
|
| 246 |
|
|
|
| 247 |
|
|
<p>
|
| 248 |
swift |
1.49 |
So, with the USE flags set, let's install <c>laptop-mode-tools</c>.
|
| 249 |
swift |
1.1 |
</p>
|
| 250 |
|
|
|
| 251 |
|
|
<note>
|
| 252 |
swift |
1.49 |
If you have USE="acpi" set, the installation will pull in <c>acpid</c>. However,
|
| 253 |
|
|
the current stable ACPI daemon (2.0.9) does not support the new ACPI interfaces
|
| 254 |
|
|
within the Linux kernel (using the netlink interface). As such, we recommend
|
| 255 |
|
|
unmasking <c>sys-power/acpid-2.0.12</c> (or higher). For more information about
|
| 256 |
|
|
unmasking packages, please read
|
| 257 |
|
|
<uri link="/doc/en/handbook/handbook-amd64.xml?part=3&chap=3">Mixing Software
|
| 258 |
|
|
Branches</uri> in the Gentoo Handbook.
|
| 259 |
swift |
1.1 |
</note>
|
| 260 |
|
|
|
| 261 |
swift |
1.49 |
<pre caption="Installing laptop-mode-tools">
|
| 262 |
|
|
# <i>emerge laptop-mode-tools</i>
|
| 263 |
swift |
1.1 |
</pre>
|
| 264 |
|
|
|
| 265 |
|
|
</body>
|
| 266 |
|
|
</section>
|
| 267 |
|
|
<section>
|
| 268 |
swift |
1.49 |
<title>Configuration</title>
|
| 269 |
swift |
1.1 |
<body>
|
| 270 |
|
|
|
| 271 |
|
|
<p>
|
| 272 |
swift |
1.49 |
Having <c>laptop-mode-tools</c> installed on your system does not automatically
|
| 273 |
|
|
enable the power management features that you might need. To configure the
|
| 274 |
|
|
package, first take a look at <path>/etc/laptop-mode/laptop-mode.conf</path>.
|
| 275 |
|
|
This is the main configuration file for the package and is pretty well described
|
| 276 |
|
|
(through comments).
|
| 277 |
so |
1.15 |
</p>
|
| 278 |
|
|
|
| 279 |
|
|
<p>
|
| 280 |
swift |
1.49 |
But it is not the only configuration file to work with. The Laptop Mode Tools
|
| 281 |
|
|
package supports plugins (or modules) which have their own configuration
|
| 282 |
|
|
file(s). These files are located in <path>/etc/laptop-mode/conf.d</path> and are
|
| 283 |
|
|
named after the module they represent (such as
|
| 284 |
|
|
<path>intel-sata-powermgmt.conf</path>).
|
| 285 |
so |
1.15 |
</p>
|
| 286 |
|
|
|
| 287 |
|
|
<p>
|
| 288 |
swift |
1.49 |
Now, one of the important settings in each configuration file is if the Laptop
|
| 289 |
|
|
Mode Tools package should govern a particular setting or not. This is important
|
| 290 |
|
|
when you want to combine <c>laptop-mode-tools</c> with other services like
|
| 291 |
|
|
<c>cpufreqd</c>. In this example case, you will need to set
|
| 292 |
|
|
<c>CONTROL_CPU_FREQUENCY=0</c>:
|
| 293 |
so |
1.15 |
</p>
|
| 294 |
|
|
|
| 295 |
swift |
1.49 |
<pre caption="Editing /etc/laptop-mode/conf.d/cpufreq.conf">
|
| 296 |
|
|
# <i>nano -w /etc/laptop-mode/conf.d/cpufreq.conf</i>
|
| 297 |
|
|
CONTROL_CPU_FREQUENCY=<i>0</i>
|
| 298 |
so |
1.15 |
</pre>
|
| 299 |
|
|
|
| 300 |
|
|
<p>
|
| 301 |
swift |
1.49 |
The next few sections will help you configure <c>laptop-mode-tools</c> to suit
|
| 302 |
|
|
your needs. When you are finished, start the <c>laptop_mode</c> service and make
|
| 303 |
|
|
sure it is started when you boot up your system.
|
| 304 |
so |
1.15 |
</p>
|
| 305 |
|
|
|
| 306 |
swift |
1.49 |
<pre caption="Starting the laptop_mode service">
|
| 307 |
|
|
# <i>/etc/init.d/laptop_mode start</i>
|
| 308 |
|
|
# <i>rc-update add laptop_mode default</i>
|
| 309 |
so |
1.15 |
</pre>
|
| 310 |
|
|
|
| 311 |
swift |
1.49 |
</body>
|
| 312 |
|
|
</section>
|
| 313 |
|
|
<section>
|
| 314 |
|
|
<title>How does laptop-mode-tools work</title>
|
| 315 |
|
|
<body>
|
| 316 |
|
|
|
| 317 |
so |
1.15 |
<p>
|
| 318 |
swift |
1.49 |
When running the <c>laptop_mode</c> service, the software will check in which
|
| 319 |
|
|
state your system is in. The states are defined as:
|
| 320 |
so |
1.15 |
</p>
|
| 321 |
|
|
|
| 322 |
swift |
1.49 |
<ul>
|
| 323 |
|
|
<li>
|
| 324 |
|
|
<e>Battery</e>, in the configuration files using the <c>BATT_</c> prefix, is
|
| 325 |
|
|
active when the system is running on battery power
|
| 326 |
|
|
</li>
|
| 327 |
|
|
<li>
|
| 328 |
|
|
<e>AC</e>, in the configuration files using the <c>AC_</c> prefix, is active
|
| 329 |
|
|
when the system is running on AC power
|
| 330 |
|
|
</li>
|
| 331 |
|
|
<li>
|
| 332 |
|
|
<e>Laptop Mode</e>, in the configuration files using the <c>LM_</c> prefix,
|
| 333 |
|
|
is active when <e>laptop mode</e> is enabled
|
| 334 |
|
|
</li>
|
| 335 |
|
|
<li>
|
| 336 |
|
|
<e>No Laptop Mode</e>, in the configuration files using the <c>NOLM_</c>
|
| 337 |
|
|
prefix, is active when <e>laptop mode</e> is disabled
|
| 338 |
|
|
</li>
|
| 339 |
|
|
</ul>
|
| 340 |
swift |
1.1 |
|
| 341 |
swift |
1.8 |
<p>
|
| 342 |
swift |
1.49 |
The <c>AC/BATT_</c> and <c>LM/NOLM_</c> prefixes can be combined (so you can
|
| 343 |
|
|
have a <c>AC_LM_</c> prefix).
|
| 344 |
swift |
1.8 |
</p>
|
| 345 |
swift |
1.1 |
|
| 346 |
|
|
<p>
|
| 347 |
swift |
1.49 |
When the <c>laptop_mode</c> service is started, it will switch modes based on
|
| 348 |
|
|
events that occur (and of course based on the configuration settings). For
|
| 349 |
|
|
instance, the setting <c>ENABLE_LAPTOP_MODE_ON_BATTERY=1</c> will make sure that
|
| 350 |
|
|
the laptop mode tools switch to <e>laptop mode</e> when battery power is used.
|
| 351 |
|
|
If that is the case, then the settings starting with <c>LM_</c>,
|
| 352 |
|
|
<c>LM_BATT_</c>, <c>BATT_LM_</c> and <c>BATT_</c> will be used.
|
| 353 |
swift |
1.1 |
</p>
|
| 354 |
|
|
|
| 355 |
|
|
<p>
|
| 356 |
swift |
1.49 |
To make sure settings to not collide, it is not allowed to have overlapping
|
| 357 |
|
|
settigns. In the next example, the first set (for <c>CPU_MAXFREQ</c>) is valid,
|
| 358 |
|
|
but the second one (for <c>CPU_GOVERNOR</c>) isn't.
|
| 359 |
swift |
1.1 |
</p>
|
| 360 |
|
|
|
| 361 |
swift |
1.49 |
<pre caption="Colliding settings">
|
| 362 |
|
|
<comment>## Valid set</comment>
|
| 363 |
|
|
BATT_CPU_MAXFREQ=fastest
|
| 364 |
|
|
LM_AC_CPU_MAXFREQ=fastest
|
| 365 |
|
|
NOLM_AC_CPU_MAXFREQ=fastest
|
| 366 |
nightmorph |
1.17 |
|
| 367 |
swift |
1.49 |
<comment>## Invalid set</comment>
|
| 368 |
|
|
BATT_CPU_MINFREQ=fastest
|
| 369 |
|
|
LM_AC_CPU_MINFREQ=fastest
|
| 370 |
|
|
<comment># The following includes AC and BATT, but BATT is already defined</comment>
|
| 371 |
|
|
NOLM_CPU_MINFREQ=fastest
|
| 372 |
|
|
</pre>
|
| 373 |
nightmorph |
1.17 |
|
| 374 |
|
|
</body>
|
| 375 |
|
|
</section>
|
| 376 |
|
|
<section>
|
| 377 |
swift |
1.49 |
<title>Configuring CPU frequency management</title>
|
| 378 |
swift |
1.8 |
<body>
|
| 379 |
|
|
|
| 380 |
|
|
<p>
|
| 381 |
swift |
1.49 |
The support for CPU frequency management in the laptop mode tools allows
|
| 382 |
|
|
switching frequencies. It supports setting the CPU frequency governor, minimum
|
| 383 |
|
|
frequency and maximum frequency. The configuration file used here is
|
| 384 |
|
|
<path>/etc/laptop-mode/conf.d/cpufreq.conf</path>.
|
| 385 |
swift |
1.8 |
</p>
|
| 386 |
|
|
|
| 387 |
|
|
<p>
|
| 388 |
swift |
1.49 |
The <e>CPU frequency governor</e> is a kernel-level policy that defines how the
|
| 389 |
|
|
kernel will select the CPU frequency. We already selected the governors we want
|
| 390 |
|
|
to use in the kernel configuration earlier. Let's recap:
|
| 391 |
swift |
1.8 |
</p>
|
| 392 |
|
|
|
| 393 |
swift |
1.49 |
<ul>
|
| 394 |
|
|
<li>
|
| 395 |
|
|
<c>performance</c> always picks the highest frequency
|
| 396 |
|
|
</li>
|
| 397 |
|
|
<li>
|
| 398 |
|
|
<c>powersave</c> always picks the lowest frequency
|
| 399 |
|
|
</li>
|
| 400 |
|
|
<li>
|
| 401 |
|
|
<c>userspace</c> does not pick anything, but let the user decide (or any
|
| 402 |
|
|
process that the user is running that will decide for the user)
|
| 403 |
|
|
</li>
|
| 404 |
|
|
<li>
|
| 405 |
|
|
<c>ondemand</c> will scale the CPU frequency up to the highest frequency
|
| 406 |
|
|
when load is available
|
| 407 |
|
|
</li>
|
| 408 |
|
|
<li>
|
| 409 |
|
|
<c>conservative</c> will scale the CPU frequency up gradually when load is
|
| 410 |
|
|
available
|
| 411 |
|
|
</li>
|
| 412 |
|
|
</ul>
|
| 413 |
|
|
|
| 414 |
swift |
1.8 |
<p>
|
| 415 |
swift |
1.49 |
When switching between AC or battery, or (no) laptop mode, the appropriate
|
| 416 |
|
|
governor (as well as its minimum and maximum frequency) is selected.
|
| 417 |
swift |
1.8 |
</p>
|
| 418 |
|
|
|
| 419 |
|
|
</body>
|
| 420 |
|
|
</section>
|
| 421 |
|
|
<section>
|
| 422 |
swift |
1.49 |
<title>Configuring display brightness</title>
|
| 423 |
swift |
1.1 |
<body>
|
| 424 |
|
|
|
| 425 |
|
|
<p>
|
| 426 |
swift |
1.49 |
With <path>/etc/laptop-mode/conf.d/lcd-brightness.conf</path>, you can have the
|
| 427 |
|
|
laptop mode tools govern the brightness of your LCD screen.
|
| 428 |
swift |
1.1 |
</p>
|
| 429 |
|
|
|
| 430 |
|
|
<p>
|
| 431 |
swift |
1.49 |
The file currently uses the <path>/proc/acpi/video/VID/LCD/brightness</path>
|
| 432 |
|
|
file to set brightness values. Recent kernels do not provide this anymore -
|
| 433 |
|
|
you will need to adjust this to <path>/sys/class/backlight/acpi_video0/brightness</path>
|
| 434 |
|
|
instead.
|
| 435 |
swift |
1.1 |
</p>
|
| 436 |
|
|
|
| 437 |
|
|
<p>
|
| 438 |
swift |
1.49 |
The values you can use are between 0 and 15, with 0 being the lowest brightness
|
| 439 |
|
|
value.
|
| 440 |
swift |
1.1 |
</p>
|
| 441 |
|
|
|
| 442 |
swift |
1.49 |
</body>
|
| 443 |
|
|
</section>
|
| 444 |
|
|
<section>
|
| 445 |
|
|
<title>Configuring other services</title>
|
| 446 |
|
|
<body>
|
| 447 |
neysx |
1.12 |
|
| 448 |
swift |
1.1 |
<p>
|
| 449 |
swift |
1.49 |
An interesting feature of <c>laptop-mode-tools</c> is to support reloading
|
| 450 |
|
|
particular services (like the system logger) after switching its configuration
|
| 451 |
|
|
file. This is handled through
|
| 452 |
|
|
<path>/etc/laptop-mode/conf.d/configuration-file-control.conf</path>.
|
| 453 |
swift |
1.1 |
</p>
|
| 454 |
|
|
|
| 455 |
nightmorph |
1.41 |
<p>
|
| 456 |
swift |
1.49 |
If enabled, the <c>laptop_mode</c> application will switch the configuration
|
| 457 |
|
|
file(s) of the mentioned services with the same file, but suffixed with
|
| 458 |
|
|
<path>-nolm-ac</path>, <path>-lm-ac</path> or <path>-batt</path>. It willl then
|
| 459 |
|
|
signal or reload the appropriate services so they can use the new configuration
|
| 460 |
|
|
file.
|
| 461 |
|
|
</p>
|
| 462 |
nightmorph |
1.41 |
|
| 463 |
swift |
1.1 |
</body>
|
| 464 |
|
|
</section>
|
| 465 |
swift |
1.49 |
</chapter>
|
| 466 |
|
|
|
| 467 |
|
|
<chapter>
|
| 468 |
|
|
<title>Using cpufreqd</title>
|
| 469 |
swift |
1.1 |
<section>
|
| 470 |
swift |
1.49 |
<title>Installation</title>
|
| 471 |
swift |
1.1 |
<body>
|
| 472 |
|
|
|
| 473 |
|
|
<p>
|
| 474 |
swift |
1.49 |
The <c>cpufreqd</c> application allows you to manage CPU frequencies in a more
|
| 475 |
|
|
granular approach then what <c>laptop-mode-tools</c> supports. But before we
|
| 476 |
|
|
dive into the installation of <c>cpufreqd</c>, let's first look at the USE flags
|
| 477 |
|
|
it supports.
|
| 478 |
swift |
1.1 |
</p>
|
| 479 |
|
|
|
| 480 |
|
|
<table>
|
| 481 |
|
|
<tr>
|
| 482 |
swift |
1.49 |
<th>USE flag</th>
|
| 483 |
|
|
<th>Description</th>
|
| 484 |
|
|
<th>Suggested when...</th>
|
| 485 |
swift |
1.8 |
</tr>
|
| 486 |
|
|
<tr>
|
| 487 |
swift |
1.49 |
<ti>acpi</ti>
|
| 488 |
swift |
1.8 |
<ti>
|
| 489 |
swift |
1.49 |
Enable support for ACPI, allowing <c>cpufreqd</c> to be notified about
|
| 490 |
|
|
specific events as well as govern power through the ACPI interface
|
| 491 |
swift |
1.8 |
</ti>
|
| 492 |
swift |
1.49 |
<ti>your laptop is not too old (~ year 2003 and later)</ti>
|
| 493 |
swift |
1.1 |
</tr>
|
| 494 |
|
|
<tr>
|
| 495 |
swift |
1.49 |
<ti>apm</ti>
|
| 496 |
so |
1.15 |
<ti>
|
| 497 |
swift |
1.49 |
Enable support for APM, allowing <c>cpufreqd</c> to be notified about
|
| 498 |
cam |
1.50 |
specific events as well as govern power through the APM interface
|
| 499 |
so |
1.15 |
</ti>
|
| 500 |
swift |
1.49 |
<ti>your laptop is very old</ti>
|
| 501 |
so |
1.15 |
</tr>
|
| 502 |
|
|
<tr>
|
| 503 |
swift |
1.49 |
<ti>lm_sensors</ti>
|
| 504 |
swift |
1.8 |
<ti>
|
| 505 |
swift |
1.49 |
Enable support for the Linux hardware sensors (through
|
| 506 |
|
|
<c>sys-apps/lm_sensors</c>), allowing to switch profiles based on hardware
|
| 507 |
|
|
sensor results
|
| 508 |
swift |
1.8 |
</ti>
|
| 509 |
|
|
<ti>
|
| 510 |
swift |
1.49 |
you want to use advanced events through lm_sensors
|
| 511 |
swift |
1.8 |
</ti>
|
| 512 |
|
|
</tr>
|
| 513 |
|
|
<tr>
|
| 514 |
swift |
1.49 |
<ti>nforce2</ti>
|
| 515 |
swift |
1.8 |
<ti>
|
| 516 |
swift |
1.49 |
Enable support for NForce, allowing <c>cpufreqd</c> to change the NForce FSB
|
| 517 |
|
|
clock and video card frequency
|
| 518 |
swift |
1.8 |
</ti>
|
| 519 |
|
|
<ti>
|
| 520 |
swift |
1.49 |
you have an NVidia graphical card based on the NForce chipset
|
| 521 |
swift |
1.8 |
</ti>
|
| 522 |
swift |
1.1 |
</tr>
|
| 523 |
|
|
<tr>
|
| 524 |
swift |
1.49 |
<ti>nvidia</ti>
|
| 525 |
nightmorph |
1.31 |
<ti>
|
| 526 |
swift |
1.49 |
Enable support for NVidia graphical card configuration (through the NVidia
|
| 527 |
|
|
<e>nvclock</e> interface), allowing <c>cpufreqd</c> to change the video card
|
| 528 |
|
|
frequency of NVidia graphical cards
|
| 529 |
so |
1.15 |
</ti>
|
| 530 |
swift |
1.8 |
<ti>
|
| 531 |
swift |
1.49 |
you have an NVidia graphical card
|
| 532 |
swift |
1.8 |
</ti>
|
| 533 |
|
|
</tr>
|
| 534 |
|
|
<tr>
|
| 535 |
swift |
1.49 |
<ti>pmu</ti>
|
| 536 |
swift |
1.1 |
<ti>
|
| 537 |
swift |
1.49 |
Enable the Power Management Unit plug-in of <c>cpufreqd</c>. This allows the
|
| 538 |
|
|
software to poll the Linux kernel Power Supply interface, getting more
|
| 539 |
|
|
detailed information on battery charge.
|
| 540 |
swift |
1.1 |
</ti>
|
| 541 |
swift |
1.8 |
<ti>
|
| 542 |
swift |
1.49 |
your laptop does not support ACPI or APM
|
| 543 |
swift |
1.8 |
</ti>
|
| 544 |
swift |
1.1 |
</tr>
|
| 545 |
|
|
</table>
|
| 546 |
|
|
|
| 547 |
|
|
<p>
|
| 548 |
swift |
1.49 |
The USE flags <c>acpi</c>, <c>apm</c> and <c>pmu</c> overlap, so you should only
|
| 549 |
|
|
have one active. If your laptop is sufficiently recent, <c>acpi</c> is your best
|
| 550 |
|
|
bet. If not, <c>apm</c> offers all that is needed. When even APM isn't
|
| 551 |
|
|
supported, you can try <c>pmu</c>.
|
| 552 |
swift |
1.1 |
</p>
|
| 553 |
|
|
|
| 554 |
|
|
<p>
|
| 555 |
swift |
1.49 |
With the USE flags configured, it is time to install <c>cpufreqd</c>.
|
| 556 |
swift |
1.1 |
</p>
|
| 557 |
|
|
|
| 558 |
|
|
<pre caption="Installing cpufreqd">
|
| 559 |
|
|
# <i>emerge cpufreqd</i>
|
| 560 |
|
|
</pre>
|
| 561 |
|
|
|
| 562 |
swift |
1.8 |
</body>
|
| 563 |
|
|
</section>
|
| 564 |
|
|
<section>
|
| 565 |
swift |
1.49 |
<title>Configuration</title>
|
| 566 |
swift |
1.8 |
<body>
|
| 567 |
|
|
|
| 568 |
swift |
1.1 |
<p>
|
| 569 |
swift |
1.49 |
The <c>cpufreqd</c> application monitors the status of the system through
|
| 570 |
|
|
several plugins. Based on the feedback it receives from those plugins, it will
|
| 571 |
|
|
adjust the policy used to govern the CPU frequency.
|
| 572 |
swift |
1.1 |
</p>
|
| 573 |
|
|
|
| 574 |
|
|
<p>
|
| 575 |
swift |
1.49 |
<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>. It
|
| 576 |
|
|
contains three different sections:
|
| 577 |
swift |
1.1 |
</p>
|
| 578 |
|
|
|
| 579 |
swift |
1.49 |
<ol>
|
| 580 |
|
|
<li>
|
| 581 |
|
|
The <c>[General]...[/General]</c> section contains general configuration
|
| 582 |
|
|
information
|
| 583 |
|
|
</li>
|
| 584 |
|
|
<li>
|
| 585 |
|
|
The <c>[Profile]...[/Profile]</c> section defines the policies that the
|
| 586 |
|
|
<c>cpufreqd</c> daemon can switch to. The section is very similar to the
|
| 587 |
|
|
information you use when manually setting the CPU frequency policy using
|
| 588 |
|
|
<c>cpufreq-set</c>.
|
| 589 |
|
|
</li>
|
| 590 |
|
|
<li>
|
| 591 |
|
|
The <c>[Rule]...[/Rule]</c> section is the work-horse of the <c>cpufreqd</c>
|
| 592 |
|
|
daemon, defining when the daemon decides to switch to a different profile.
|
| 593 |
|
|
</li>
|
| 594 |
|
|
</ol>
|
| 595 |
swift |
1.1 |
|
| 596 |
|
|
<p>
|
| 597 |
swift |
1.49 |
Let's take a quick look at an example rule.
|
| 598 |
swift |
1.1 |
</p>
|
| 599 |
|
|
|
| 600 |
swift |
1.49 |
<pre caption="Sample cpufreqd rule">
|
| 601 |
|
|
[Profile]
|
| 602 |
|
|
name=On Demand High
|
| 603 |
|
|
minfreq=40%
|
| 604 |
|
|
maxfreq=100%
|
| 605 |
|
|
policy=ondemand
|
| 606 |
|
|
[/Profile]
|
| 607 |
swift |
1.1 |
|
| 608 |
swift |
1.49 |
[Rule]
|
| 609 |
|
|
name=AC Off - High Power
|
| 610 |
|
|
ac=off
|
| 611 |
|
|
battery_interval=70-100
|
| 612 |
|
|
profile=On Demand High
|
| 613 |
|
|
[/Rule]
|
| 614 |
|
|
</pre>
|
| 615 |
swift |
1.1 |
|
| 616 |
|
|
<p>
|
| 617 |
swift |
1.49 |
In the above example, <c>cpufreqd</c> will switch the system to the <e>On Demand
|
| 618 |
|
|
High</e> profile (also shown in the above excerpt). This profile by itself uses
|
| 619 |
|
|
the <c>ondemand</c> governor with a minimum frequency of 40% (iow, a CPU of 2Ghz
|
| 620 |
|
|
will have by this policy a minimum frequency of 800Mhz).
|
| 621 |
swift |
1.1 |
</p>
|
| 622 |
|
|
|
| 623 |
neysx |
1.12 |
<p>
|
| 624 |
swift |
1.49 |
As you can see, the <c>cpufreqd</c> application can offer a more granular
|
| 625 |
|
|
approach on CPU frequency scaling. But not only that, you can tweak the CPU
|
| 626 |
|
|
frequency scaling based on various other metrics available. The default
|
| 627 |
|
|
configuration offers a sample rule for when you watch a movie, where you want
|
| 628 |
|
|
maximum performance, unless the CPU temperature is getting too high.
|
| 629 |
neysx |
1.12 |
</p>
|
| 630 |
|
|
|
| 631 |
|
|
<p>
|
| 632 |
swift |
1.49 |
When you have configured <c>cpufreqd</c>, it is time to start it (and make sure
|
| 633 |
|
|
the service is loaded automatically). Make sure that CPU frequency handling by
|
| 634 |
|
|
other tools (like <c>laptop-mode-tools</c>) is disabled!
|
| 635 |
swift |
1.1 |
</p>
|
| 636 |
|
|
|
| 637 |
swift |
1.49 |
<pre caption="Starting cpufreqd">
|
| 638 |
|
|
# <i>rc-service add cpufreqd default</i>
|
| 639 |
|
|
# <i>/etc/init.d/cpufreqd start</i>
|
| 640 |
neysx |
1.12 |
</pre>
|
| 641 |
|
|
|
| 642 |
swift |
1.1 |
</body>
|
| 643 |
|
|
</section>
|
| 644 |
|
|
</chapter>
|
| 645 |
|
|
|
| 646 |
|
|
<chapter>
|
| 647 |
swift |
1.49 |
<title>Resources</title>
|
| 648 |
swift |
1.1 |
<section>
|
| 649 |
swift |
1.49 |
<title>Tools</title>
|
| 650 |
nightmorph |
1.17 |
<body>
|
| 651 |
rane |
1.19 |
|
| 652 |
swift |
1.49 |
<ul>
|
| 653 |
|
|
<li>
|
| 654 |
|
|
<uri link="http://samwel.tk/laptop_mode/">Laptop Mode Tools Homepage</uri>,
|
| 655 |
|
|
includes <uri link="http://samwel.tk/laptop_mode/laptop_mode">About laptop
|
| 656 |
|
|
mode</uri>.
|
| 657 |
|
|
</li>
|
| 658 |
|
|
<li>
|
| 659 |
|
|
<uri link="http://www.lesswatts.org/projects/powertop/">PowerTOP</uri>, an
|
| 660 |
|
|
interactive application helping users to find out which processes are
|
| 661 |
|
|
forcing wakeups on the CPU most often.
|
| 662 |
|
|
</li>
|
| 663 |
|
|
</ul>
|
| 664 |
nightmorph |
1.17 |
|
| 665 |
|
|
</body>
|
| 666 |
|
|
</section>
|
| 667 |
|
|
<section>
|
| 668 |
swift |
1.49 |
<title>Articles and Guides</title>
|
| 669 |
swift |
1.1 |
<body>
|
| 670 |
|
|
|
| 671 |
swift |
1.49 |
<ul>
|
| 672 |
|
|
<li>
|
| 673 |
|
|
A ThinkWiki article on <uri
|
| 674 |
|
|
link="http://www.thinkwiki.org/wiki/How_to_reduce_power_consumption">How to
|
| 675 |
|
|
reduce power consumption</uri> (on Linux). This article offers an exhaustive
|
| 676 |
|
|
list of measures one can take. However, it should be noted that the laptop
|
| 677 |
|
|
mode tools implements the majority of these (if properly configured).
|
| 678 |
|
|
</li>
|
| 679 |
|
|
</ul>
|
| 680 |
swift |
1.8 |
|
| 681 |
swift |
1.1 |
</body>
|
| 682 |
|
|
</section>
|
| 683 |
|
|
</chapter>
|
| 684 |
|
|
</guide>
|