Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 98395
Collapse All | Expand All

(-)power-management-guide.xml?passthru=1 (-413 / +705 lines)
Lines 1-6 Link Here
1
<?xml version='1.0' encoding="UTF-8"?>
1
<?xml version='1.0' encoding="UTF-8"?>
2
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
2
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3
<!-- $Header: /var/www/www.gentoo.org/raw_cvs/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.14 2005/06/10 18:45:21 swift Exp $ -->
3
4
<!-- $Header: /var/www/www.gentoo.org/raw_cvs/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.13 2005/05/28 12:59:36 yoswink Exp $ -->
4
<guide link="power-management-guide.xml">
5
<guide link="power-management-guide.xml">
5
<title>Power Management Guide</title>
6
<title>Power Management Guide</title>
6
7
Lines 9-91 Link Here
9
</author>
10
</author>
10
11
11
<abstract>
12
<abstract>
12
Power Management is the key to extend battery run time on mobile systems like
13
Power Management (PM) is key to extending battery life on mobile systems
13
laptops. This guide assists you setting it up on your laptop.
14
(e.g. laptop computers.) This guide can help you enable PM for your system.
14
</abstract>
15
</abstract>
15
16
16
<!-- The content of this document is licensed under the CC-BY-SA license -->
17
<!-- The content of this document is licensed under the CC-BY-SA license -->
17
<!-- See http://creativecommons.org/licenses/by-sa/2.0 -->
18
<!-- See http://creativecommons.org/licenses/by-sa/2.0 -->
18
<license/>
19
<license/>
19
20
20
<version>1.24</version>
21
<version>1.25</version>
21
<date>2005-06-10</date>
22
<date>2005-07-08</date>
22
23
23
<chapter>
24
<chapter>
24
<title>Introduction</title>
25
<title>Introduction</title>
25
<section>
26
<section>
26
<title>Why Power Management?</title>
27
<title>Rationale</title>
27
<body>
28
<body>
28
29
29
<p>
30
<p>
30
Capacity and lifetime of laptop batteries has improved much in the last years.
31
Over the last decade, the capacity and lifespan of laptop batteries have
31
Nevertheless modern processors consume much more energy than older ones and
32
increased significantly. Nevertheless, successive generations of mobile systems
32
each laptop generation introduces more devices hungry for energy. That's why
33
introduce devices that require more power than ever. Power Management (PM)
33
Power Management is more important than ever. Increasing battery run time
34
policies, when applied intelligently, can make the difference between
34
doesn't necessarily mean buying another battery. Much can be achieved applying
35
increasing system runtime with an older battery or buying a newer battery
35
intelligent Power Management policies.
36
for your system.
36
</p>
37
</p>
37
38
39
<note>
40
This guide describes PM for <e>laptops</e>, not servers. Please do not apply
41
anything from this guide to a server unless you understand the risk of damage
42
to your server.
43
</note>
44
38
</body>
45
</body>
39
</section>
46
</section>
40
47
41
<section>
48
<section>
42
<title>A quick overview</title>
49
<title>Overview</title>
43
<body>
50
<body>
44
51
45
<p>
52
<p>
46
Please notice that this guide describes Power Management for <e>laptops</e>.
53
The layout of this document is outlined below:
47
While some sections might also suite for <e>servers</e>, others do not and may
48
even cause harm. Please do not apply anything from this guide to a server
49
unless you really know what you are doing.
50
</p>
54
</p>
51
55
52
<p>
56
<ul>
53
As this guide has become rather long, here's a short overview helping you to
57
        <li>
54
find your way through it.
58
                The <e>Prerequisites</e> section discusses requirements that the
55
</p>
59
                system must meet before PM for any device can be enabled.
56
60
        </li>
57
<p>
61
        
58
The <e>Prerequisites</e> chapter talks about some requirements that should be
62
   <li>
59
met before any of the following device individual sections will work. This
63
        <e>CPU Power Management</e> discusses PM procedures which adjust the
60
includes BIOS settings, kernel configuration and some simplifications in user
64
        processor's frequency to save power while minimizing performance loss.
61
land. The following three chapters focus on devices that typically consume most
65
   </li>
62
energy - processor, display and hard drive. Each can be configured seperately.
66
   
63
<e>CPU Power Management</e> shows how to adjust the processor's frequency to
67
   <li>
64
save a maximum of energy whithout losing too much performance. A few different
68
        <e>LCD Power Management</e> discusses PM techniques to reduce power
65
tricks prevent your hard drive from working unnecessarily often in <e>Disk Power
69
        consumption by the display.
66
Management</e> (decreasing noise level as a nice side effect). Some notes on
70
   </li>
67
Wireless LAN and USB finish the device section in <e>Power Management for other
71
   
68
devices</e> while another chapter is dedicated to the (rather experimental)
72
   <li>
69
<e>sleep states</e>. Last not least <e>Troubleshooting</e> lists common
73
        <e>Disk Power Management</e> examines PM tactics to increase a drive's
70
pitfalls.
74
        operating efficiency, while decreasing the system's noise level.
71
</p>
75
   </li>
76
   
77
   <li>
78
        <e>Removable Device Power Management</e> addresses PM for removable
79
        devices, such as Wireless LAN and USB devices.
80
   </li>
81
   
82
   <li>
83
        <e>ACPI Suspend States</e> examines PM features (i.e. sleep states)
84
        provided by <b>experimental</b> kernel support for the Advanced
85
        Configuration and Power Interface (ACPI).
86
   </li>
87
   
88
   <li>
89
        <e>Troubleshooting</e> lists common PM-related pitfalls.
90
   </li>
91
</ul>
72
92
73
</body>
93
</body>
74
</section>
94
</section>
75
95
76
<section>
96
<section>
77
<title>Power Budget for each component</title>
97
<title>Component Power Distribution</title>
78
<body>
98
<body>
79
99
80
<figure link="/images/energy-budget.png" short="Which component consumes how
100
<figure link="/images/energy-budget.png" short="Which component consumes how
81
much energy?" caption="Power budget for each component"/>
101
much energy?" caption="Power Budget"/>
82
102
83
<p>
103
<p>
84
Nearly every component can operate in different states - off, sleep, idle,
104
Most components can operate in various states (e.g. <e>off</e>, <e>sleep</e>,
85
active to name a few - consuming a different amount of energy. Major parts are
105
<e>idle</e> and <e>active</e>), with each state consuming a different level of
86
consumed by the LCD display, CPU, chipset and hard drives. Often one is able to
106
energy. Although OS-independent PM can be enabled through the BIOS, a better PM
87
activate OS-independent Power Management in the BIOS, but an intelligent setup
107
policy is to configure the system to intelligently adapt to various power
88
in the operating system adapting to different situations can achieve much more.
108
states. However, any PM policy usually leads to performance loss or increased
109
latency.
89
</p>
110
</p>
90
111
91
</body>
112
</body>
Lines 94-163 Link Here
94
115
95
<chapter>
116
<chapter>
96
<title>Prerequisites</title>
117
<title>Prerequisites</title>
118
97
<section>
119
<section>
98
<title>What has to be done first</title>
120
<title>First Things First</title>
99
<body>
121
<body>
100
122
101
<p>
123
<p>
102
Before going into the details on making individual devices Power Management
124
Before making individual devices PM-aware, certain requirements must be met by
103
aware, make sure certain requirements are met. After controlling the BIOS
125
the system. For example, once the necessary BIOS settings have been selected,
104
settings, some kernel options want to be enabled - these are in short ACPI,
126
certain kernel options &#8212; ACPI and CPU frequency scaling &#8212; must be
105
sleep states and CPU frequency scaling. As power saving most of the time comes
127
configured. Also, a new runlevel is created to make the transition between
106
along with performance loss or increased latency, it should only be enabled
128
battery power and AC power as seamless as possible.
107
when running on batteries. That's where a new runlevel <e>battery</e> comes in
108
handy.
109
</p>
129
</p>
110
130
111
</body>
131
</body>
112
</section>
132
</section>
133
113
<section>
134
<section>
114
<title>The BIOS part</title>
135
<title>BIOS Configuration</title>
115
<body>
136
<body>
116
137
117
<p>
138
<p>
118
First have a look into your BIOS Power Management settings. The best way is to
139
Ideally, both the BIOS and OS PM policies will be integrated. However, it is
119
combine BIOS and operating system policies, but for the moment it's better to
140
best to disable most BIOS PM settings at this stage to prevent interference
120
disable most of the BIOS part. This makes sure it doesn't interfere with your
141
with your policies. Therefore, the BIOS settings will be configured last.
121
policies. Don't forget to re-check BIOS settings after you configured
122
everything else.
123
</p>
142
</p>
124
143
125
</body>
144
</body>
126
</section>
145
</section>
146
127
<section>
147
<section>
128
<title>Configuring the kernel</title>
148
<title>Kernel Configuration</title>
129
<body>
149
<body>
130
150
131
<p>
151
<p>
132
ACPI (Advanced Configuration and Power Interface) support in the kernel is
152
Remember, kernel ACPI support is under heavy development. For best results, use
133
still work in progress. Using a recent kernel will make sure you'll get the
153
the latest kernel available, and enable the following options through kernel
134
most out of it.
154
configuration:
135
</p>
136
137
<p>
138
In kernel config, activate at least these options:
139
</p>
155
</p>
140
156
141
<pre caption="Minimum kernel setup for Power Management (Kernel 2.6)">
157
<pre caption="Minimum kernel setup for PM (Kernel 2.6)">
142
Power Management Options ---&gt;
158
PM Options --->
143
  [*] Power Management Support
159
  [*] Power Management Support
160
  <comment>(For more information on whether or not to enable Software Suspend
161
  option below, please read the chapter on ACPI.)</comment>
144
  [ ] Software Suspend
162
  [ ] Software Suspend
145
  [ ] Suspend-to-Disk Support
163
  ACPI (Advanced Configuration and Power Interface) Support --->
146
147
  ACPI( Advanced Configuration and Power Interface ) Support ---&gt;
148
    [*] ACPI Support
164
    [*] ACPI Support
149
    [ ]   Sleep States
165
    <comment>(Read the chapter on ACPI before enabling Sleep States.)</comment>
150
    [*]   AC Adapter
166
    [ ]   Sleep States (EXPERIMENTAL)
151
    [*]   Battery
167
    &lt;*&gt;   AC Adapter
152
    &lt;M&gt;   Button
168
    &lt;*&gt;   Battery
153
    &lt;M&gt;   Fan
169
    &lt;*&gt;   Button
154
    &lt;M&gt;   Processor
170
    &lt;*&gt;   Fan
155
    &lt;M&gt;     Thermal Zone
171
    &lt;*&gt;   Processor
172
    &lt;*&gt;     Thermal Zone
173
    <comment>(If the kernel is being configured for ASUS, Medion, IBM or Toshiba
174
    laptops, select the driver appropriate for the system below.)</comment>
156
    &lt; &gt;   ASUS/Medion Laptop Extras
175
    &lt; &gt;   ASUS/Medion Laptop Extras
176
    &lt; &gt;   IBM ThinkPad Laptop Extras
157
    &lt; &gt;   Toshiba Laptop Extras
177
    &lt; &gt;   Toshiba Laptop Extras
158
    [ ]   Debug Statements
178
    [ ]   Debug Statements
159
    
179
    [ ]   Power Management Timer Support
160
  CPU Frequency Scaling ---&gt;
180
    &lt; &gt;   ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
181
  CPU Frequency Scaling --->
161
    [*] CPU Frequency scaling
182
    [*] CPU Frequency scaling
162
          Default CPUFreq governor (userspace)
183
          Default CPUFreq governor (userspace)
163
    &lt;*&gt;   'performance' governor
184
    &lt;*&gt;   'performance' governor
Lines 165-244 Link Here
165
    &lt;*&gt;   'ondemand' cpufreq policy governor
186
    &lt;*&gt;   'ondemand' cpufreq policy governor
166
    &lt;*&gt;   CPU frequency table helpers
187
    &lt;*&gt;   CPU frequency table helpers
167
    &lt;M&gt; ACPI Processor P-States driver
188
    &lt;M&gt; ACPI Processor P-States driver
168
    &lt;*&gt; <i>CPUFreq driver for your processor</i>
189
    <comment>(Selecting the appropriate driver below provides the kernel with
190
    information needed to enable frequency scaling for your CPU.)</comment>
191
    --- CPUFreq processor drivers
192
    &lt; &gt; ACPI Processor P-States driver                                                                                   
193
    &lt; &gt; AMD Mobile K6-2/K6-3 PowerNow!
194
    &lt; &gt; AMD Mobile Athlon/Duron PowerNow!
195
    &lt; &gt; AMD Opteron/Athlon64 PowerNow!
196
    &lt; &gt; Cyrix MediaGX/NatSemi Geode Suspend Modulation
197
    &lt; &gt; Intel Enhanced SpeedStep
198
    &lt; &gt; Intel Speedstep on ICH-M chipsets (ioport interface)
199
    &lt; &gt; Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)
200
    &lt; &gt; Intel Pentium 4 clock modulation
201
    &lt; &gt; nVidia nForce2 FSB changing
202
    &lt; &gt; Transmeta LongRun
203
    &lt; &gt; VIA Cyrix III Longhaul
169
</pre>
204
</pre>
170
205
171
<p>
206
<impo>
172
Decide yourself whether you want to enable Software Suspend, Suspend-to-Disk and
207
Selecting the correct CPUFreq driver for the system during kernel configuration
173
Sleep States (see below). If you own an ASUS, Medion or Toshiba laptop, enable
208
is important, since each CPU has a different interface. Enabling an improper
174
the appropriate section.
209
interface (e.g using <e>Intel Pentium 4 clock modulation</e> on a Pentium M
175
</p>
210
system) could prove counterproductive. If in doubt, consult the kernel
176
211
documentation to decide which CPUFreq driver is appropriate for your system.
177
<p>
212
</impo>
178
The kernel has to know how to enable CPU frequency scaling on your processor. As
179
each type of CPU has a different interface, you've got to choose the right
180
driver for your processor. Be careful here - enabling <e>Intel Pentium 4 clock
181
modulation</e> on a Pentium M system will lead to strange results for example.
182
Consult the kernel documentation if you're unsure which one to take.
183
</p>
184
213
185
<p>
214
<p>
186
Compile your kernel, make sure the right modules get loaded at startup and boot
215
Once the kernel configuration is complete, compile your new ACPI-enabled kernel
187
into your new ACPI-enabled kernel. Next run <c>emerge sys-power/acpid</c> to get
216
that is configured to have applicable modules loaded at startup. Next, install
188
the acpi daemon. This one informs you about events like switching from AC to
217
and activate the ACPI daemon (acpid) using the procedure below:
189
battery or closing the lid. Make sure the modules are loaded if you didn't
190
compile them into the kernel and start acpid by executing
191
<c>/etc/init.d/acpid start</c>. Run <c>rc-update add acpid default</c> to load
192
it on startup. You'll soon see how to use it.
193
</p>
218
</p>
194
219
195
<pre caption="Installing acpid">
220
<pre caption="ACPI Daemon Installation Procedure">
196
# <i>emerge sys-power/acpid</i>
221
# <i>emerge sys-power/acpid</i>
197
# <i>/etc/init.d/acpid start</i>
222
# <i>/etc/init.d/acpid start</i>
198
# <i>rc-update add acpid default</i>
223
# <i>rc-update add acpid default</i>
199
</pre>
224
</pre>
200
225
226
<p>
227
This daemon provides notices about various events (e.g. switching between AC
228
and battery power, closing the system's lid, etc.) The daemon can also execute
229
programs that handle ACPI-related events.
230
</p>
231
201
</body>
232
</body>
202
</section>
233
</section>
203
<section>
234
<section>
204
<title>Creating a "battery" runlevel</title>
235
<title>Creating a Runlevel</title>
205
<body>
236
<body>
206
237
207
<p>
238
<p>
208
The default policy will be to enable Power Management only when needed -
239
The default policy is to enable PM only when the system is running on battery
209
running on batteries. To make the switch between AC and battery convenient,
240
power. However, creating a <e>battery</e> runlevel (to hold the scripts which
210
create a runlevel <e>battery</e> that holds all the scripts starting and
241
will start and stop PM) eases the transition between AC and battery power.
211
stopping Power Management.
212
</p>
242
</p>
213
243
214
<note>
244
<note>
215
You can safely skip this section if you don't like the idea of having another
245
While creating another runlevel is not an absolute necessity for PM, skipping
216
runlevel. However, skipping this step will make the rest a bit trickier to set
246
the runlevel creation procedure makes for a more challenging setup. This is
217
up. The next sections assume a runlevel <e>battery</e> exists.
247
because the rest of this chapter assumes the existence of a runlevel named
248
<e>battery</e>.
218
</note>
249
</note>
219
250
220
<pre caption="Creating a battery runlevel">
251
<p>
252
To add a runlevel, make a new directory in <path>/etc/runlevels</path>, and
253
populate it with the desired scripts. However, copying an existing (runlevel)
254
directory may be more efficient, as the procedure below illustrates:
255
</p>
256
257
<pre caption="Runlevel Creation Procedure">
221
# <i>cd /etc/runlevels</i>
258
# <i>cd /etc/runlevels</i>
222
# <i>cp -a default battery</i>
259
# <i>cp -a default battery</i>
223
</pre>
260
</pre>
224
261
225
<p>
262
<p>
226
Finished. Your new runlevel <e>battery</e> contains everything like
263
The <e>battery</e> and <e>default</e> runlevels now contain identical init
227
<e>default</e>, but there is no automatic switch between both yet. Time to
264
scripts. However, there is no mechanism to automatically switch between both
228
change it.
265
runlevels. The next section illustrates how to include this desired automation.
229
</p>
266
</p>
230
267
231
</body>
268
</body>
232
</section>
269
</section>
233
<section>
270
<section>
234
<title>Reacting on ACPI events</title>
271
<title>Reacting to ACPI Events</title>
235
<body>
272
<body>
236
273
237
<p>
274
<p>
238
Typical ACPI events are closing the lid, changing the power source or pressing
275
An ACPI event (e.g. changing the power source) should trigger a runlevel
239
the sleep button. An important event is changing the power source, which should
276
switch. Installing the following scripts eases the transition between the
240
cause a runlevel switch. Create the following files to switch between
277
<e>default</e> and <e>battery</e> runlevels (depending on which power source is
241
<e>default</e> and <e>battery</e> runlevel depending on the power source:
278
used by the system):
242
</p>
279
</p>
243
280
244
<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh">
281
<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh">
Lines 291-299 Link Here
291
</pre>
328
</pre>
292
329
293
<p>
330
<p>
294
Additionally you need the package sys-power/powermgmt-base which contains
331
Next, install the sys-power/powermgmt-base package, which contains the
295
the <c>on_ac_power</c> utility. The file <path>pmg_switch_runlevel.sh</path>
332
<c>on_ac_power</c> utility. The script <path>pmg_switch_runlevel.sh</path> must
296
must be executable.
333
be made executable using the <c>chmod</c> command.
297
</p>
334
</p>
298
335
299
<pre caption="Finishing runlevel switching with acpid">
336
<pre caption="Finishing runlevel switching with acpid">
Lines 303-321 Link Here
303
</pre>
340
</pre>
304
341
305
<p>
342
<p>
306
Give it a try: Plug AC in and out and watch syslog for the "Switching to AC
343
Now connect and disconnect the system's AC power supply four or five times, and
307
mode" or "Switching to battery mode" messages. See the Troubleshooting
344
observe the output of the kernel log utility (e.g. <c>syslog</c>,
308
section if the script is not able to detect the power source correctly.
345
<c>metalog</c>, etc.) You may be able to view the output of the log utility
346
in <path>/var/log/kernel/current</path>. You should see the
347
"Switching to AC mode" message or the "Switching to battery mode" message. If
348
the script is unable to correctly detect a change in the system's power supply,
349
consult the Troubleshooting section below.
309
</p>
350
</p>
310
351
311
<p>
352
<p>
312
Due to the nature of the event mechanism, your laptop will boot into runlevel
353
Due to the nature of the event mechanism, your laptop will boot into the
313
<e>default</e> regardless of the AC/battery state. You can add another entry
354
<e>default</e> runlevel, regardless of the AC/battery state. There are a few
314
to the boot loader with <c>softlevel=battery</c>, but it's likely to forget
355
ways to have the system determine when a runlevel change is necessary. One way
315
choosing it. A better way is faking an ACPI event in the end of the boot
356
is to pass another argument to the boot loader &#8212; <c>softlevel=battery</c>.
316
process and let the <path>/etc/acpi/default.sh</path> script decide whether a
357
This is an ill-advised method as the system may fail to make the necessary
317
runlevel change is necessary. Open <path>/etc/conf.d/local.start</path> in your
358
runlevel switches as needed. A better approach is to simulate an ACPI event at
318
favourite editor and add these lines:
359
the end of the boot process and let the <path>/etc/acpi/default.sh</path> script
360
handle runlevel switches. Open <path>/etc/conf.d/local.start</path> in your
361
favourite text editor, and add the following:
319
</p>
362
</p>
320
363
321
<pre caption="Runlevel switch at boot time by editing local.start">
364
<pre caption="Runlevel switch at boot time by editing local.start">
Lines 324-331 Link Here
324
</pre>
367
</pre>
325
368
326
<p>
369
<p>
327
Prepared like this you can activate Power Management policies for individual 
370
Your system is now prepared to activate PM policies for individual devices.
328
devices.
329
</p>
371
</p>
330
372
331
</body>
373
</body>
Lines 335-397 Link Here
335
<chapter>
377
<chapter>
336
<title>CPU Power Management</title>
378
<title>CPU Power Management</title>
337
<section>
379
<section>
338
<title>Some technical terms</title>
380
381
<title>Technical Terms</title>
339
<body>
382
<body>
340
383
341
<p>
384
<p>
342
CPU frequency scaling brings up some technical terms that might be unknown to
385
The discussion of CPU frequency scaling involves certain technical terms that
343
you. Here's a quick introduction.
386
are explained below:
344
</p>
387
</p>
345
388
346
<p>
389
<p>
347
First of all, the kernel has to be able to change the processor's frequency. The
390
To successfully deploy CPU frequency scaling on a system, the kernel must be
348
<e>CPUfreq processor driver</e> knows the commands to do it on your CPU. Thus
391
provided the instructions (or commands) needed for modifying a processor's
349
it's important to choose the right one in your kernel. You should already have
392
frequency. To this end, it is essential to select the appropriate <e>CPUfreq
350
done it above. Once the kernel knows how to change frequencies, it has to know
393
processor driver</e> via the kernel configuration process mentioned earlier.
351
which frequency it should set. This is done according to the <e>policy</e> which
394
Once the kernel is equipped with the appropriate instructions to change the
352
consists of a <e>CPUfreq policy</e> and a <e>governor</e>. A CPUfreq policy are
395
CPU's frequency, it must be made aware of what CPU frequency values may be
353
just two numbers which define a range the frequency has to stay between -
396
selected.
354
minimal and maximal frequency. The governor now decides which of the available
397
</p>
355
frequencies in between minimal and maximal frequency to choose. For example, the
398
356
<e>powersave governor</e> always chooses the lowest frequency available, the
399
<note>
357
<e>performance governor</e> the highest one. The <e>userspace governor</e> makes
400
Not every laptop supports frequency scaling. If unsure, check the list of
358
no decision but chooses whatever the user (or a program in userspace) wants -
401
supported processors in the <e>Troubleshooting</e> section to see if your CPU
359
which means it reads the frequency from
402
is supported.
360
<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>.
403
</note>
404
405
<p>
406
Frequency selection is done according to a <e>policy</e>, which includes a
407
<e>CPUfreq policy</e> and a <e>governor</e>. The CPUfreq policy consists of two
408
values (a minimum and maximum frequency) that serve as boundaries for the range
409
of frequencies that may be selected. The governor decides which frequencies in
410
the range for the CPU to operate at. For example, the <e>powersave governor</e>
411
always chooses the lowest frequency permitted by the policy, while the
412
<e>performance governor</e> selects the highest frequency permitted by the
413
policy. The <e>userspace governor</e> simply chooses whatever frequency the
414
user (or a program in userspace) desires; it reads the frequency from the
415
<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path> script.
361
</p>
416
</p>
362
417
363
<p>
418
<p>
364
This doesn't sound like dynamic frequency changes yet and in fact it isn't.
419
There are two interrelated advantages to decreasing CPU speed and voltage.
365
Dynamics however can be accomplished with various approaches. For example,
420
First, less energy is consumed; this leads to thermal improvement as the system
366
the <e>ondemand governor</e> makes its decisions depending on the current CPU
421
runs cooler than it would when the CPU is operating at the maximum speed
367
load. The same is done by various userland tools like <c>cpudyn</c>,
422
possible. Unfortunately, the advantages come at the expense of performance as
368
<c>cpufreqd</c>, <c>powernowd</c> and many more. ACPI events can be used to
423
the CPU performs fewer operations.
369
enable or disable dynamic frequency changes depending on power source.
370
</p>
424
</p>
371
425
372
</body>
426
</body>
373
</section>
427
</section>
374
<section>
428
<section>
375
<title>Setting the frequency manually</title>
429
<title>Manual Frequency Selection</title>
376
<body>
430
<body>
377
431
378
<p>
432
<p>
379
Decreasing CPU speed and voltage has two advantages: On the one hand less
433
To verify if CPU frequency selection is operational, install another tool
380
energy is consumed, on the other hand there is thermal improvement as your
434
suitable for debugging purposes &#8212; <c>sys-power/cpufrequtils</c>:
381
system doesn't get as hot as running on full speed. The main disadvantage is
382
obviously the loss of performance. Decreasing processor speed is a trade off
383
between performance loss and energy saving.
384
</p>
385
386
<note>
387
Not every laptop supports frequency scaling. If unsure, have a look at the list
388
of supported processors in the <e>Troubleshooting</e> section to verify your's 
389
is supported.
390
</note>
391
392
<p>
393
It's time to test whether CPU frequency changing works. Let's install another
394
tool which is very handy for debugging purposes: <c>sys-power/cpufrequtils</c>
395
</p>
435
</p>
396
436
397
<pre caption="Checking CPU frequency">
437
<pre caption="Checking CPU frequency">
Lines 419-443 Link Here
419
</pre>
459
</pre>
420
460
421
<p>
461
<p>
422
Now play around with <c>cpufreq-set</c> to make sure frequency switching works.
462
Tinker with the <c>cpufreq-set</c> utility to verify that frequency selection
423
Run <c>cpufreq-set -g ondemand</c> for example to activate the ondemand
463
works. Next, activate the ondemand governor via <c>cpufreq-set -g ondemand</c>
424
governor and verify the change with <c>cpufreq-info</c>. If it doesn't work as
464
and confirm the change with <c>cpufreq-info</c>. The output produced should be
425
expected, you might find help in the Troubleshooting section in the end of this
465
similar to the sample output provided above. Otherwise, consult the
426
guide.
466
Troubleshooting section at the end of this guide.
427
</p>
467
</p>
428
468
429
</body>
469
</body>
430
</section>
470
</section>
431
<section>
471
<section>
432
<title>Automated frequency adaption</title>
472
<title>Dynamic Frequency Selection</title>
433
<body>
473
<body>
434
474
435
<p>
475
<p>
436
The above is quite nice, but not doable in daily life. Better let your system
476
Manual frequency selection is simply impractical for daily applications. A
437
set the appropriate frequency automatically. There are many different approaches
477
better method is to have the system dynamically determine the appropriate
438
to do this. The following table gives a quick overview to help you decide on one
478
frequency using an automated process. The following table provides a quick
439
of them. It's roughly seperated in three categories <e>kernel</e> for approaches
479
overview on various approaches to dynamic frequency selection. The different
440
that only need kernel support, <e>daemon</e> for programs that run in the
480
approaches are split into three categories: <e>kernel</e> for approaches that
481
only need kernel support, <e>daemon</e> for programs that operate in the
441
background and <e>graphical</e> for programs that provide a GUI for easy
482
background and <e>graphical</e> for programs that provide a GUI for easy
442
configuration and changes.
483
configuration and changes.
443
</p>
484
</p>
Lines 446-454 Link Here
446
<tr>
487
<tr>
447
  <th>Name</th>
488
  <th>Name</th>
448
  <th>Category</th>
489
  <th>Category</th>
449
  <th>Switch decision</th>
490
  <th>Switch Decision</th>
450
  <th>Kernel governors</th>
491
  <th>Kernel Governors</th>
451
  <th>Further governors</th>
492
  <th>Further Governors</th>
452
  <th>Comments</th>
493
  <th>Comments</th>
453
</tr>
494
</tr>
454
<tr>
495
<tr>
Lines 468-478 Link Here
468
  <ti><uri link="http://mnm.uib.es/~gallir/cpudyn/">cpudyn</uri></ti>
509
  <ti><uri link="http://mnm.uib.es/~gallir/cpudyn/">cpudyn</uri></ti>
469
  <ti>Daemon</ti>
510
  <ti>Daemon</ti>
470
  <ti>CPU load</ti>
511
  <ti>CPU load</ti>
471
  <ti>Performance, powersave</ti>
512
  <ti>performance, powersave</ti>
472
  <ti>Dynamic</ti>
513
  <ti>Dynamic</ti>
473
  <ti>
514
  <ti>
474
    Also supports disk standby - notice however that <e>laptop mode</e> in most
515
    Also supports disk standby. However, in most cases, greater efficiency is
475
    cases will do a better job.
516
    achieved using <e>laptop mode</e>.
476
  </ti>
517
  </ti>
477
</tr>
518
</tr>
478
<tr>
519
<tr>
Lines 482-488 Link Here
482
  <ti>All available</ti>
523
  <ti>All available</ti>
483
  <ti>None</ti>
524
  <ti>None</ti>
484
  <ti>
525
  <ti>
485
    Sophisticated (but also complicated) setup.
526
    Sophisticated (but complicated) setup.
527
  </ti>
528
</tr>
529
<tr>
530
  <ti><uri link="http://fatcat.ftj.agh.edu.pl/~nelchael/">ncpufreqd</uri></ti>
531
  <ti>Daemon</ti>
532
  <ti>Battery state, processor temperature</ti>
533
  <ti>performance, powersave</ti>
534
  <ti>None</ti>
535
  <ti>
536
    Supports SMP and HT enabled processors; best for semi-mobile processors
537
    (e.g. Pentium 4M) that are prone to heat dissipation problems, when using
538
    the performance governor. ACPI throttling supported. Easy policy selection
539
    via userspace-based utilities. Requires 2.6 kernel.
486
  </ti>
540
  </ti>
487
</tr>
541
</tr>
488
<tr>
542
<tr>
Lines 533-546 Link Here
533
</table>
587
</table>
534
588
535
<p>
589
<p>
536
While adjusting the frequency to the current load looks simple on the first
590
While adjusting the frequency to the current load may appear simplistic at
537
view, it's not such a trivial task. A bad algorithm can cause switching between
591
first glance, it is a task that is far from trivial. A flimsy algorithm can
538
two frequencies all the time or wasting energy when setting frequency to an
592
cause incessant switching between two frequencies. Worse yet, such an
539
unnecessary high level. 
593
algorithm may unnecessarily select a high frequency &#8212; an undesirable
594
waste of energy.
540
</p>
595
</p>
541
596
597
<warn>
598
Do not deploy more than one of the above utilities at any given time. Deploying
599
multiple utilities simultaneously on a single system may yield
600
counterproductive results (e.g. incessant switching between two frequencies.)
601
</warn>
602
542
<p>
603
<p>
543
Which one to choose? If you have no idea about it, try <c>cpufreqd</c>:
604
If in doubt about which of the utilities to deploy, try <c>cpufreqd</c>:
544
</p>
605
</p>
545
606
546
<pre caption="Installing cpufreqd">
607
<pre caption="Installing cpufreqd">
Lines 548-557 Link Here
548
</pre>
609
</pre>
549
610
550
<p>
611
<p>
551
<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>.
612
The <c>cpufreqd</c> utility can be configured by editing the
552
The default one that ships with cpufreqd may look a bit confusing. I recommend
613
<path>/etc/cpufreqd.conf</path> script. If you find default script that ships
553
replacing it with the one from Gentoo developer Henrik Brix Andersen (see
614
with cpufreqd confusing, consider replacing it with the script below (provided
554
below).
615
by Gentoo developer Henrik Brix Andersen):
555
</p>
616
</p>
556
617
557
<pre caption="/etc/cpufreqd.conf">
618
<pre caption="/etc/cpufreqd.conf">
Lines 597-606 Link Here
597
</pre>
658
</pre>
598
659
599
<p>
660
<p>
600
You can't use a percentage value like above for min_freq and max_freq if you
661
If you are using a 2.6 kernel with the sysfs interface, percentage values for
601
are using kernel 2.6 with the sysfs interface (you probably do). Replace it
662
<e>min_freq</e> and <e>max_freq</e> as in the above example will not work.
602
with the lowest and highest frequency as reported by <c>cpufreq-info
663
Replace those entries with the lowest and highest frequency values, as reported
603
--hwlimits</c>. For example, on my 1.4 GHz Pentium M I put in
664
by <c>cpufreq-info --hwlimits</c>.
665
</p>
666
667
<p>
668
Below is a sample entry for a system with a 1.4 GHz Pentium-M processor:
604
</p>
669
</p>
605
670
606
<pre caption="Sample values for minfreq and maxfreq">
671
<pre caption="Sample values for minfreq and maxfreq">
Lines 609-615 Link Here
609
</pre>
674
</pre>
610
675
611
<p>
676
<p>
612
Last not least start the daemon.
677
The next step is to start the daemon:
613
</p>
678
</p>
614
679
615
<pre caption="Starting cpufreqd">
680
<pre caption="Starting cpufreqd">
Lines 617-638 Link Here
617
# <i>rc</i>
682
# <i>rc</i>
618
</pre>
683
</pre>
619
684
620
<warn>
621
Do not run more than one of the above programs at the same time. It may cause
622
confusion like switching between two frequencies all the time.
623
</warn>
624
625
</body>
685
</body>
626
</section>
686
</section>
627
687
628
<section>
688
<section>
629
<title>Verifying the result</title>
689
<title>Verifying CPU Policies</title>
630
690
631
<body>
691
<body>
632
692
633
<p>
693
<p>
634
The last thing to check is that your new policies do a good job. An easy way to
694
The last step to verify that the new policies are providing satisfactory
635
do so is monitoring CPU speed while working with your laptop:
695
performance. An easy way to achieve this is to monitor the CPU's speed while
696
working on your laptop:
636
</p>
697
</p>
637
698
638
<pre caption="Monitoring CPU speed">
699
<pre caption="Monitoring CPU speed">
Lines 640-647 Link Here
640
</pre>
701
</pre>
641
702
642
<p>
703
<p>
643
If <path>/proc/cpuinfo</path> doesn't get updated (see Troubleshooting),
704
If the information reported by <path>/proc/cpuinfo</path> does not get
644
monitor the CPU frequency with:
705
refreshed or updated, try monitoring the CPU's frequency with the following
706
command:
645
</p>
707
</p>
646
708
647
<pre caption="Alternative CPU speed monitoring">
709
<pre caption="Alternative CPU speed monitoring">
Lines 649-658 Link Here
649
</pre>
711
</pre>
650
712
651
<p>
713
<p>
652
Depending on your setup, CPU speed should increase on heavy load, decrease on
714
When using <e>cpufreqd</e> with the verbosity level set to 5 or higher in
653
no activity or just stay at the same level. When using cpufreqd and verbosity
715
<path>cpufreqd.conf</path>, you should receive additional information about
654
set to 5 or higher in <path>cpufreqd.conf</path> you'll get additional
716
what events are being reported to the kernel log utility (e.g. syslog, metalog,
655
information about what's happening reported to syslog.
717
etc.)
656
</p>
718
</p>
657
719
658
</body>
720
</body>
Lines 662-685 Link Here
662
<chapter>
724
<chapter>
663
<title>LCD Power Management</title>
725
<title>LCD Power Management</title>
664
<section>
726
<section>
665
<title>Energy consumer no. 1</title>
727
<title>Primary Energy Consumer</title>
666
<body>
728
<body>
667
729
668
<p>
730
<p>
669
As you can see in  <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD display
731
As <uri link="#doc_chap1_fig1">Power Budget</uri> chart illustrates, most of
670
consumes the biggest part of energy (might not be the case for non-mobile
732
the system's graphical display consumes the most energy (this may not hold true
671
CPU's). Thus it's quite important not only to shut the display off when not
733
for non-mobile processors.) Nevertheless, it is important to shut off the
672
needed, but also to reduce it's backlight if possible. Most laptops offer the
734
display or lower its backlight level whenever possible. Most laptops are
673
possibility to control the backlight dimming. 
735
equipped with tools to control the level of backlight emitted by the display.
674
</p>
736
</p>
675
737
676
<p>
738
<p>
677
First thing to check is the standby/suspend/off timings of the display. As this
739
First, check the standby/suspend/off timings of the display. The procedure for
678
depends heavily on your windowmanager, I'll let you figure it out yourself.
740
checking display timings is beyond the scope of this guide, as it varies among
679
Just two common places: Blanking the terminal can be done with <c>setterm
741
window managers. Therefore, consult your window manager's documentation for
680
-blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c> and
742
further assistance on this matter.
681
<c>setterm -powerdown &lt;number-of-minutesM&gt;</c>.
743
</p>
682
For Xorg, modify <path>/etc/X11/xorg.conf</path> similar to this:
744
745
<p>
746
To reduce the display's power consumption by blanking the terminal, issue the
747
following commands: <c>setterm -powersave on</c>, <c>setterm -blank TD</c>
748
and <c>setterm -powerdown TD</c> (replace 'TD' with a number, representing the
749
desired time delay (in minutes) before executing the commands. So be sure to
750
pick a number between 0 and 60. For systems that use the X11 implementation
751
maintained by the X.Org foundation, modify <path>/etc/X11/xorg.conf</path> as
752
follows (for systems using XFree86, edit <path>/etc/X11/XF86Config</path>):
683
</p>
753
</p>
684
754
685
<pre caption="LCD suspend settings in Xorg and XFree86">
755
<pre caption="LCD suspend settings in Xorg and XFree86">
Lines 703-731 Link Here
703
</pre>
773
</pre>
704
774
705
<p>
775
<p>
706
This is the same for XFree86 and <path>/etc/X11/XF86Config</path>.
776
However, dimming the display's backlight is probably more useful than blanking
777
the terminal. If you have access to a utility with settings to dim the display,
778
write a small script that dims the display's backlight when the system is
779
running on battery power. Add this script to the <e>battery</e> runlevel by
780
placing this script in the <path>/etc/runlevels/battery</path> directory.
707
</p>
781
</p>
708
782
709
<p>
783
<p>
710
Probably more important is the backlight dimming. If you have access to the
784
The following script should work on most IBM Thinkpads, and is obtained by
711
dimming settings via a tool, write a small script that dims the backlight in
785
installing the <c>app-laptop/ibm-acpi</c> package or enabling the appropriate
712
battery mode and place it in your <e>battery</e> runlevel. The following script
786
option during the kernel configuration process.
713
should work on most IBM Thinkpads. It needs the <c>app-laptop/ibm-acpi</c>
714
package or the appropriate option in your kernel has to be enabled.
715
</p>
787
</p>
716
788
717
<warn>
789
<warn>
718
Support for setting brightness is marked experimental in ibm-acpi. It accesses
790
Support for adjusting the display's brightness is marked experimental in
719
hardware directly and may cause severe harm to your system. Please read the
791
ibm-acpi. It accesses hardware directly and may cause severe harm to your
792
system. Please read the
720
<uri link="http://ibm-acpi.sourceforge.net/">ibm-acpi website</uri>
793
<uri link="http://ibm-acpi.sourceforge.net/">ibm-acpi website</uri>
721
</warn>
794
</warn>
722
795
723
<p>
796
<p>
724
To be able to set the brightness level, the ibm_acpi module has to be loaded
797
To set or adjust the display's brightness, load the ibm_acpi module with the
725
with the experimental parameter.
798
parameter aptly named 'experimental':
726
</p>
799
</p>
727
800
728
<pre caption="automatically loading the ibm_acpi module">
801
<pre caption="How to load the ibm_acpi module automatically">
729
<comment>(Please read the warnings above before doing this!)</comment>
802
<comment>(Please read the warnings above before doing this!)</comment>
730
<i># emerge ibm-acpi</i>
803
<i># emerge ibm-acpi</i>
731
<i># echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i>
804
<i># echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i>
Lines 737-757 Link Here
737
<p>
810
<p>
738
This should work without error messages and a file
811
This should work without error messages and a file
739
<path>/proc/acpi/ibm/brightness</path> should be created after loading the
812
<path>/proc/acpi/ibm/brightness</path> should be created after loading the
740
module. An init script will take care of choosing the brightness according
813
module. An init script will take care of adjusting the display's brightness
741
to the power source.
814
according to the power source.
742
</p>
815
</p>
743
816
744
<pre caption="/etc/conf.d/lcd-brightness">
745
<comment># See /proc/acpi/ibm/brightness for available values</comment>
746
<comment># Please read /usr/share/doc/ibm-acpi-*/README.gz</comment>
747
748
<comment># brigthness level in ac mode. Default is 7.</comment>
749
BRIGHTNESS_AC=7
750
751
<comment># brightness level in battery mode. Default is 4.</comment>
752
BRIGHTNESS_BATTERY=4
753
</pre>
754
755
<pre caption="/etc/init.d/lcd-brightness">
817
<pre caption="/etc/init.d/lcd-brightness">
756
#!/sbin/runscript
818
#!/sbin/runscript
757
819
Lines 783-791 Link Here
783
}
845
}
784
</pre>
846
</pre>
785
847
848
<p>Most init scripts have configuration files that may be used to adjust
849
various options; the above init script for the display's brightness level is no
850
exception:</p>
851
852
<pre caption="/etc/conf.d/lcd-brightness">
853
<comment># See /proc/acpi/ibm/brightness for available values</comment>
854
<comment># Please read /usr/share/doc/ibm-acpi-*/README.gz</comment>
855
856
<comment># brightness level in ac mode. Default is 7.</comment>
857
BRIGHTNESS_AC=7
858
859
<comment># brightness level in battery mode. Default is 4.</comment>
860
BRIGHTNESS_BATTERY=4
861
</pre>
862
786
<p>
863
<p>
787
When done, make sure brightness is adjusted automatically by adding it to the
864
Next, ensure the brightness level is adjusted automatically by adding it to the
788
battery runlevel.
865
<e>battery</e> runlevel:
789
</p>
866
</p>
790
867
791
<pre caption="Enabling automatic brightness adjustment">
868
<pre caption="Enabling automatic brightness adjustment">
Lines 801-815 Link Here
801
<chapter>
878
<chapter>
802
<title>Disk Power Management</title>
879
<title>Disk Power Management</title>
803
<section>
880
<section>
804
<title>Sleep when idle</title>
881
<title>Sleep when Idle</title>
805
<body>
882
<body>
806
883
807
<p>
884
<p>
808
Let's bring the hard disk to sleep as early as possible whenever it is not
885
Bringing the hard disk to sleep when the system is idle is a prudent policy.
809
needed. I'll show you two possibilities to do it. First <c>cpudyn</c> supports
886
What follows is a presentation of two approaches to this matter.
810
Disk Power Management. Uncomment the lines in the "Disk Options" section in
887
</p>
811
<path>/etc/conf.d/cpudyn</path>. To put your first disk to sleep after 60
888
812
seconds of no activity, you would modify it like this:
889
<p>The first approach is provided by <c>cpudyn</c>, a utility that supports
890
Disk PM. Open <path>/etc/conf.d/cpudyn</path> for editing, and uncomment the
891
lines in the section entitled 'Disk Options' that correspond to the utility's
892
parameters:
813
</p>
893
</p>
814
894
815
<pre caption="Using cpudyn for disk standby">
895
<pre caption="Using cpudyn for disk standby">
Lines 826-838 Link Here
826
TIMEOUT=60
906
TIMEOUT=60
827
<comment>
907
<comment>
828
#
908
#
829
# Specified disks to spindown (comma separated devices)
909
# Specified disks to spin down (comma separated devices)
830
#
910
#
831
</comment>
911
</comment>
832
DISKS=/dev/hda
912
DISKS=/dev/hda
833
</pre>
913
</pre>
834
914
835
<p>
915
<p>
916
The example above brings the first (IDE) disk in the system to sleep after 60
917
seconds of inactivity.
918
</p>
919
920
<impo>
921
Be careful with the sleep/spin down settings of your hard drive &#8212; setting
922
it to small values might wear out the drive, and void its warranty.
923
</impo>
924
925
<p>
836
The second possibility is using a small script and hdparm. Create
926
The second possibility is using a small script and hdparm. Create
837
<path>/etc/init.d/pm.hda</path> like this:
927
<path>/etc/init.d/pm.hda</path> like this:
838
</p>
928
</p>
Lines 845-865 Link Here
845
}
935
}
846
936
847
start() {
937
start() {
848
  ebegin "Activating Power Management for Hard Drives"
938
  ebegin "Activating PM for Hard Drives"
849
  hdparm -q -S12 /dev/hda
939
  hdparm -q -S12 /dev/hda
850
  eend $?
940
  eend $?
851
}
941
}
852
942
853
stop () {
943
stop () {
854
  ebegin "Deactivating Power Management for Hard Drives"
944
  ebegin "Deactivating PM for Hard Drives"
855
  hdparm -q -S253 /dev/hda
945
  hdparm -q -S253 /dev/hda
856
  eend $?
946
  eend $?
857
}
947
}
858
</pre>
948
</pre>
859
949
860
<p>
950
<p>
861
See <c>man hdparm</c> for the options. If your script is ready, add it to the
951
See <c>man hdparm</c> for more information on the options available for this
862
battery runlevel.
952
utility.
953
</p>
954
955
<p>
956
Once the <path>/etc/init.d/pm.hda</path> script is created, add it to the
957
battery runlevel:
863
</p>
958
</p>
864
959
865
<pre caption="Automate disk standby settings">
960
<pre caption="Automate disk standby settings">
Lines 868-916 Link Here
868
# <i>rc-update add pm.hda battery</i>
963
# <i>rc-update add pm.hda battery</i>
869
</pre>
964
</pre>
870
965
871
<impo>
872
Be careful with sleep/spin down settings of your hard drive. Setting it to
873
small values might wear out your drive and lose warranty.
874
</impo>
875
876
</body>
966
</body>
877
</section>
967
</section>
878
<section>
968
<section>
879
<title>Increasing idle time - laptop-mode</title>
969
<title>Increasing Idle Time with Laptop Mode</title>
880
<body>
970
<body>
881
971
882
<p>
972
<p>
883
Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches)
973
Recent kernels (versions 2.6.6 or greater, recent 2.4 ones and others with
884
include the so-called <e>laptop-mode</e>. When activated, dirty buffers are
974
patches) include the <e>laptop-mode</e> utility. When activated, dirty buffers
885
written to disk on read calls or after 10 minutes (instead of 30 seconds). This
975
are written to disk on read calls or after 10 minutes (instead of 30 seconds).
886
minimizes the time the hard disk needs to be spun up.
976
This reduces the time taken by the hard disk to 'spin up'.
887
</p>
977
</p>
888
978
889
<pre caption="Automated start of laptop-mode">
979
<pre caption="Installing the Laptop Mode Utility">
890
# <i>emerge laptop-mode-tools</i>
980
# <i>emerge laptop-mode-tools</i>
891
</pre>
981
</pre>
892
982
893
<p>
983
<p>
894
<c>laptop-mode-tools</c> has it's configuration file in
984
The configuration file for the <c>laptop-mode-tools</c> utility is located in
895
<path>/etc/laptop-mode/laptop-mode.conf</path>. Adjust it the way you like it,
985
<path>/etc/laptop-mode/laptop-mode.conf</path>. This configuration file is
896
it's well commented. Run <c>rc-update add laptop_mode battery</c> to start it
986
extensively commented, so feel free to adjust the parameters as you see fit. To
897
automatically.
987
automate the utility's operation, add it to the <e>battery</e> runlevel:
898
</p>
988
</p>
899
989
990
<pre caption="Adding laptop-mode to battery runlevel">
991
# <i>rc-update add laptop_mode battery</i>
992
</pre>
993
900
</body>
994
</body>
901
</section>
995
</section>
902
<section>
996
<section>
903
<title>Other tricks</title>
997
<title>Other Tactics</title>
904
<body>
998
<body>
905
999
906
<p>
1000
<p>
907
Besides putting your disk to sleep state as early as possible, it is a good
1001
Besides putting your disk to sleep state as early as possible, it is a good
908
idea to minimize disk accesses. Have a look at processes that write to your
1002
idea to minimize disk accesses. Have a look at processes that write to your
909
disk frequently - the syslogd is a good candidate. You probably don't want to
1003
disk frequently &#8212; the syslogd utility is an excellent candidate for this
910
shut it down completely, but it's possible to modify the config file so that
1004
exercise. By configuring the utility to ignore or omit the logging of
911
"unnecessary" things don't get logged and thus don't create disk traffic. Cups
1005
inconsequential events, disk activity can be reduced without shutting off or
912
writes to disk periodically, so consider shutting it down and only enable it
1006
disabling the utility.
913
manually when needed.
1007
</p>
1008
1009
<p>
1010
The <e>cups</e> daemon also writes to disk periodically, so consider shutting
1011
it down and only enable it (manually) when needed:
914
</p>
1012
</p>
915
1013
916
<pre caption="Disabling cups in battery mode">
1014
<pre caption="Disabling cups in battery mode">
Lines 918-938 Link Here
918
</pre>
1016
</pre>
919
1017
920
<p>
1018
<p>
921
Another possibility is to deactivate swap in battery mode. Before writing a
1019
Another possibility is to deactivate swap while operating on battery power.
922
swapon/swapoff switcher, make sure there is enough RAM and swap isn't used
1020
Before writing a swapon/swapoff switcher, confirm that the system has enough
923
heavily, otherwise you'll be in big problems.
1021
RAM for this effort and that swap space is seldom used. Failure to observe such
1022
precautions could cause critical problems.
924
</p>
1023
</p>
925
1024
926
<p>
1025
<p>
927
If you don't want to use laptop-mode, it's still possible to minimize disk
1026
It is possible to minimize disk access without the laptop-mode utility. This
928
access by mounting certain directories as <e>tmpfs</e> - write accesses are not
1027
may be achieved by mounting certain directories as temporary file systems, or
929
stored on a disk, but in main memory and get lost with unmounting. Often it's
1028
<e>tmpfs</e>. Here, write accesses are not stored on a disk, but in main memory
930
useful to mount <path>/tmp</path> like this - you don't have to pay special
1029
and the information contained by such file systems is lost when the directory
931
attention as it gets cleared on every reboot regardless whether it was mounted
1030
is unmounted.
932
on disk or in RAM. Just make sure you have enough RAM and no program (like a
1031
</p>
933
download client or compress utility) needs extraordinary much space in
1032
934
<path>/tmp</path>. To activate this, enable tmpfs support in your kernel and
1033
<impo>
935
add a line to <path>/etc/fstab</path> like this:
1034
If you want to mount <path>/var/log</path> with <e>tmpfs</e>, be sure to merge
1035
the log files to disk before unmounting. The log files are essential for proper
1036
operation of the system.
1037
</impo>
1038
1039
<p>
1040
Oftentimes, it is useful to mount <path>/tmp</path> on such a volatile
1041
file system &#8212; data stored in this directory is purged during the boot-up
1042
process, whether or not it was mounted on a disk (or in RAM.) To activate this,
1043
enable tmpfs support in your kernel and add a line to the file system table in
1044
<path>/etc/fstab</path> as follows:
936
</p>
1045
</p>
937
1046
938
<pre caption="Editing /etc/fstab to make /tmp even more volatile">
1047
<pre caption="Editing /etc/fstab to make /tmp even more volatile">
Lines 940-950 Link Here
940
</pre>
1049
</pre>
941
1050
942
<warn>
1051
<warn>
943
Pay attention to the size parameter and modify it for your system. If you're
1052
Exercise extreme caution when modifying the <c>size</c> parameter. If in doubt,
944
unsure, don't try this at all, it can become a perfomance bottleneck easily. In
1053
do not adjust this parameter; assigning inappropriate values to the parameter
945
case you want to mount <path>/var/log</path> like this, make sure to merge the
1054
may lead to performance bottlenecks on the system.
946
log files to disk before unmounting. They are essential. Don't attempt to mount
1055
</warn>
947
/var/tmp like this. Portage uses it for compiling...
1056
1057
<p>
1058
Remember to confirm that the system has sufficient RAM, and restrict access to
1059
<path>/tmp</path> by programs that require substantial disk space for proper
1060
operation (e.g. a download client or compress utility.) 
1061
</p>
1062
1063
<warn>
1064
<b>Do not attempt to mount /var/tmp on a volatile file system!</b> The
1065
directory is used by Portage while compiling packages for the system.
948
</warn>
1066
</warn>
949
1067
950
</body>
1068
</body>
Lines 952-992 Link Here
952
</chapter>
1070
</chapter>
953
1071
954
<chapter>
1072
<chapter>
955
<title>Power Management for other devices</title>
1073
<title>Removable Device Power Management</title>
956
<section>
1074
<section>
957
<title>Wireless Power Management</title>
1075
<title>Wireless PM</title>
958
<body>
1076
<body>
959
1077
960
<p>
1078
<p>
961
Wireless LAN cards consume quite a few energy. Put them in Power Management
1079
Wireless LAN cards can consume a fair amount energy. Wireless PM can be
962
mode in analogy to the pm.hda script.
1080
achieved using a script similar to <e>pm.hda</e>, which is used for Disk PM.
1081
Starting the following script will engage PM for wlan0, which instructs the
1082
device to sleep after three seconds of inactivity:
963
</p>
1083
</p>
964
1084
965
<pre caption="WLAN Power Management automated">
1085
<pre caption="WLAN PM automated">
966
#!/sbin/runscript
1086
#!/sbin/runscript
967
start() {
1087
start() {
968
  ebegin "Activating Power Management for Wireless LAN"
1088
  ebegin "Activating PM for Wireless LAN"
969
  iwconfig wlan0 power on power max period 3
1089
  iwconfig wlan0 power on power max period 3
970
  eend $?
1090
  eend $?
971
}
1091
}
972
1092
973
stop () {
1093
stop () {
974
  ebegin "Deactivating Power Management for Wireless LAN"
1094
  ebegin "Deactivating PM for Wireless LAN"
975
  iwconfig wlan0 power off
1095
  iwconfig wlan0 power off
976
  eend $?
1096
  eend $?
977
}
1097
}
978
</pre>
1098
</pre>
979
1099
980
<p>
1100
<p>
981
Starting this script will put wlan0 in Power Management mode, going to sleep at
1101
Save this script as <e>pm.wlan0</e> in <path>/etc/init.d/</path>, and add it to
982
the latest three seconds after no traffic.
1102
the battery runlevel like the disk script above. See <c>man iwconfig</c> for
983
Save it as <path>/etc/init.d/pm.wlan0</path> and add it to the battery runlevel
1103
details and more options. If your driver and access point support changing the
984
like the disk script above. See <c>man iwconfig</c> for details and more
1104
beacon time, this is a good starting point to save even more energy.
985
options. If your driver and access point support changing the beacon time, this
986
is a good starting point to save even more energy.
987
</p>
1105
</p>
988
1106
989
<pre caption="Power Management for WLAN">
1107
<pre caption="PM for WLAN">
990
# <i>chmod +x /etc/init.d/pm.wlan0</i>
1108
# <i>chmod +x /etc/init.d/pm.wlan0</i>
991
# <i>/sbin/depscan.sh</i>
1109
# <i>/sbin/depscan.sh</i>
992
# <i>rc-update add pm.wlan0 battery</i>
1110
# <i>rc-update add pm.wlan0 battery</i>
Lines 994-1013 Link Here
994
1112
995
</body>
1113
</body>
996
</section>
1114
</section>
1115
997
<section>
1116
<section>
998
<title>USB Power Management</title>
1117
<title>USB PM</title>
999
<body>
1118
<body>
1000
1119
1001
<p>
1120
<p>
1121
Before discussing USB PM, here are a few words on <e>CPU States</e>:
1122
</p>
1123
1124
<ul>
1125
   <li>
1126
   Full-On (C0): This is the only state that runs software.
1127
   </li>
1128
   <li>
1129
   Auto-Halt (C1): This state significantly reduces power consumption by the
1130
   CPU, while maintaining cache coherency.
1131
   </li>
1132
   <li>
1133
   Quickstart (C2): This state is rather similar to C1; however CPU power
1134
   consumption is even further reduced.
1135
   </li>
1136
   <li>
1137
   Deep Sleep/Deeper Sleep (C3/C4): These states are almost identical; the C4
1138
   state consumes even less power the C3, which consumes much less power than
1139
   any of the C0-C2 states.
1140
   </li>
1141
</ul>
1142
1143
<p>
1002
There are two problems with USB devices regarding energy consumption: First,
1144
There are two problems with USB devices regarding energy consumption: First,
1003
devices like USB mice, digital cameras or USB sticks consume energy while
1145
devices like USB mice, digital cameras or USB sticks consume energy while
1004
plugged in. You cannot avoid this (nevertheless remove them in case they're not
1146
plugged in. This is unavoidable, so connect such devices only when they are
1005
needed). Second, when there are USB devices plugged in, the USB host controller
1147
needed, and remove them in case they are not needed). Second, when USB devices
1006
periodically accesses the bus which in turn prevents the CPU from going into
1148
are plugged in, the USB host controller periodically accesses the bus, which in
1007
C3/4 sleep mode. The OS answer to this problem is the so called "USB selective
1149
turn prevents the CPU from going into C3/4 sleep mode.
1008
suspend", which has not yet been implemented in the kernel. USB selective
1150
</p>
1009
suspend only allows bus accesses in case the device is in use. The cruel
1151
1010
workaround until it's implemented is as following: Compile USB support and
1152
<p>The solution provided by the OS to this problem is the so-called "USB
1153
selective suspend", which has yet to be implemented in the kernel. USB
1154
selective suspend only allows bus accesses when the device is in use. The cruel
1155
workaround until it is implemented is as follows: Compile USB support and
1011
devices as modules and remove them via a script while they are not in use (e.g.
1156
devices as modules and remove them via a script while they are not in use (e.g.
1012
when closing the lid).
1157
when closing the lid).
1013
</p>
1158
</p>
Lines 1017-1029 Link Here
1017
</chapter>
1162
</chapter>
1018
1163
1019
<chapter>
1164
<chapter>
1020
<title>Sleep states: sleep, standby, suspend to disk</title>
1165
<title>ACPI Suspend States</title>
1021
<section>
1166
<section>
1022
<title>Overview</title>
1167
<title>Overview</title>
1023
<body>
1168
<body>
1024
1169
1025
<p>
1170
<p>
1026
ACPI defines different sleep states. The more important ones are
1171
ACPI defines different sleep states. The more important ones are:
1027
</p>
1172
</p>
1028
1173
1029
<ul> 
1174
<ul> 
Lines 1033-1163 Link Here
1033
</ul>
1178
</ul>
1034
1179
1035
<p>
1180
<p>
1036
They can be called whenever the system is not in use, but a shutdown is not
1181
Sleep states are preferable to powering down the system. This is because the
1037
wanted due to the long boot time.
1182
time taken to resume from such states is shorter than the boot-up sequence.
1038
</p>
1183
</p>
1039
1184
1040
</body>
1185
</body>
1041
</section>
1186
</section>
1042
<section>
1187
<section>
1043
<title>Sleep, Standby &amp; Hibernate</title>
1188
<title>Sleep, Standby or Hibernate</title>
1044
<body>
1189
<body>
1045
1190
1046
<p>
1191
<p>
1047
The ACPI support for these sleep states is marked as experimental for good
1192
The ACPI support for these sleep states is marked as experimental for good
1048
reason. APM sleep states seem to be more stable, however you can't use APM and
1193
reason; APM sleep states seem to be more stable. However, enabling APM and ACPI
1049
ACPI together.
1194
simultaneously on the same system produces counterproductive results.
1050
</p>
1195
</p>
1051
1196
1052
<warn>
1197
<warn>
1053
Altough sleep state support is improving much, it's still rather experimental.
1198
Although sleep state support is improving much, it's still rather experimental.
1054
At last I got swsusp2 and suspend to RAM to work, but be warned: This will very
1199
At last I got swsusp2 and suspend to RAM to work, but be warned: This will very
1055
likely not work but damage your data/system.
1200
likely not work but damage your data/system.
1056
</warn>
1201
</warn>
1057
1202
1058
<p>
1203
<p>
1059
There are currently three implementations for S4. The original one is swsusp,
1204
Currently, there are two primary implementations for S4: Software
1060
then there is swsusp2 which has the nicest interface (including bootsplash
1205
Suspend (swsusp) and Software Suspend 2 (swsusp2). The latter has the preferred
1061
support), but requires manual kernel patching. Last not least we have
1206
interface (including bootsplash support), and may be obtained by installing the
1062
Suspend-to-Disk, a fork of swsusp.
1207
swsusp2-sources package (Gentoo 2005.1 or later) or by manually patching the
1208
kernel sources. The former is part of the kernel source tree as a built-in
1209
interface.
1063
</p>
1210
</p>
1064
1211
1065
<p>
1212
<p>
1066
If this confused you, have a look at a <uri
1213
Review the following feature comparison to decide which implementation is most
1067
link="http://softwaresuspend.berlios.de/features.html#compare">feature
1214
suitable for your needs:
1068
comparison</uri>. If you still are confused and don't know which one to choose,
1069
first give swsusp2 a try, it looks most promising.
1070
</p>
1215
</p>
1071
1216
1217
<table>
1218
        <tr>
1219
                <ti><b>Name</b></ti>
1220
                <ti>Software Suspend</ti>
1221
                <ti>Software Suspend 2</ti>
1222
        </tr>
1223
        <tr>
1224
                <ti><b>Applicable Kernel Versions</b></ti>
1225
                <ti>2.6.x</ti>
1226
                <ti>Install swsusp2-sources, or patch against 2.4.2x, 2.6.x</ti>
1227
        </tr>
1228
        <tr>
1229
                <ti><b>Kernel Option</b></ti>
1230
                <ti>CONFIG_SOFTWARE_SUSPEND</ti>
1231
                <ti>CONFIG_SOFTWARE_SUSPEND2</ti>
1232
        </tr>
1233
        <tr>
1234
                <ti><b>Author</b></ti>
1235
                <ti>Pavel Machek</ti>
1236
                <ti>Nigel Cunningham</ti>
1237
        </tr>
1238
        <tr>
1239
                <ti><b>PM Subsystem</b></ti>
1240
                <ti>None required</ti>
1241
                <ti>None required</ti>
1242
        </tr>
1243
        <tr>
1244
                <ti><b>Bootloader Arguments</b></ti>
1245
                <ti><c>resume=/dev/hda#</c></ti>
1246
                <ti><c>resume2=swap:/dev/hda#</c></ti>
1247
        </tr>
1248
        <tr>
1249
                <ti><b>System Suspend Command</b></ti>
1250
                <ti><c>echo -n disk > /sys/power/state</c></ti>
1251
                <ti><c>echo > /proc/software_suspend/do_suspend</c></ti>
1252
        </tr>
1253
        <tr>
1254
                <ti><b>'Abandon Resume' Argument</b></ti>
1255
                <ti><c>noresume</c></ti>
1256
                <ti><c>noresume2</c></ti>
1257
        </tr>
1258
        <tr>
1259
                <ti><b>Supported Architectures</b></ti>
1260
                <ti>i386, x86_64, ppc</ti>
1261
                <ti>i386, ppc (x86_64 under development)</ti>
1262
        </tr>
1263
        <tr>
1264
                <ti><b>Highmem</b></ti>
1265
                <ti>Supported (up to 4GB)</ti>
1266
                <ti>Supported (up to 4GB)</ti>
1267
        </tr>
1268
        <tr>
1269
                <ti><b>Discontiguous Memory</b></ti>
1270
                <ti>Supported</ti>
1271
                <ti>Not Supported</ti>
1272
        </tr>
1273
        <tr>
1274
                <ti><b>SMP</b></ti>
1275
                <ti>Supported</ti>
1276
                <ti>Supported</ti>
1277
        </tr>
1278
        <tr>
1279
                <ti><b>Preemption</b></ti>
1280
                <ti>Supported</ti>
1281
                <ti>Supported</ti>
1282
        </tr>
1283
        <tr>
1284
                <ti><b>Compression</b></ti>
1285
                <ti>Not Supported</ti>
1286
                <ti>LZF Supported</ti>
1287
        </tr>
1288
        <tr>
1289
                <ti><b>Suspend-to-Swapfile</b></ti>
1290
                <ti>Not Supported</ti>
1291
                <ti>Supported</ti>
1292
        </tr>
1293
        <tr>
1294
                <ti><b>Suspend-to-File</b></ti>
1295
                <ti>Not Supported</ti>
1296
                <ti>Supported</ti>
1297
        </tr>
1298
        <tr>
1299
                <ti><b>Kernel Modules</b></ti>
1300
                <ti>Unavailable (Built-in)</ti>
1301
                <ti>Not Supported</ti>
1302
        </tr>
1303
        <tr>
1304
                <ti><b>Initrd</b></ti>
1305
                <ti>Supported</ti>
1306
                <ti>Supported</ti>
1307
        </tr>
1308
        <tr>
1309
                <ti><b>UML</b></ti>
1310
                <ti>Not Supported</ti>
1311
                <ti>Not Supported (Under Development)</ti>
1312
        </tr>
1313
        <tr>
1314
                <ti><b>Suspend-over-NFS</b></ti>
1315
                <ti>Not Supported</ti>
1316
                <ti>Not Supported (Under Development)</ti>
1317
        </tr>
1318
</table>
1319
1072
<p>
1320
<p>
1073
The kernel part for this is as following:
1321
If in doubt about which utility to deploy, try swsusp2. It is under heavy
1322
development, and may include more features soon. To deploy swsusp2, install the
1323
kernel source tree with support for swsusp2:
1074
</p>
1324
</p>
1075
1325
1076
<pre caption="Kernel configuration for the various suspend types">
1326
<pre caption="Installing swsusp2-sources">
1077
Power Management Options ---&gt;
1327
# emerge swsusp2-sources
1078
1328
</pre>
1079
  <comment>(sleep and standby)</comment>
1080
  ACPI( Advanced Configuration and Power Interface ) Support --->
1081
    [*] ACPI Support
1082
       [*]   Sleep States
1083
1329
1084
  <comment>(hibernate with swsusp)</comment>
1330
<p>
1085
  [*] Software Suspend (EXPERIMENTAL)
1331
The kernel configuration for the utilities is as follows:
1086
  
1332
</p>
1087
  <comment>(hibernate with swsusp2)</comment>
1088
  Software Suspend 2
1089
    --- Image Storage (you need at least one writer)
1090
    [*]    Swap Writer
1091
    --- Page Transformers
1092
    [*]    LZF image compression
1093
    (/dev/"your-swap-here")    Default resume device name
1094
1333
1095
  <comment>(hibernate with Suspend-to-Disk)</comment>
1334
<pre caption="Kernel configuration for the various suspend types">
1096
  [*] Suspend-to-Disk Suport
1335
PM Options --->
1097
  (/dev/"your-swap-here") Default resume partition
1336
   [*] Power Management support
1337
   
1338
   <comment>(hibernate with swsusp)</comment>
1339
   [*] Software Suspend
1340
   
1341
   <comment>(hibernate with swsusp2)</comment>
1342
   [*] Software Suspend 2 --->
1343
      [ ]     File Writer
1344
      [*]     Swap Writer
1345
      ---   Page Transformers? We now use Cryptoapi.
1346
      ---   User Interface Options
1347
      [*]     Userspace user interface support
1348
      <comment>(Text mode console support scheduled for deprecation.)</comment>
1349
      [ ]     Text mode console support
1350
      ---   General Options
1351
      ()      Default resume device name (NEW)
1352
      [ ]     Allow Keep Image Mode (NEW)
1353
      [*]     Warn if possibility of filesystem corruption (NEW)
1354
      
1355
   <comment>(sleep and standby)</comment>
1356
   ACPI(Advanced Configuration and Power Interface) Support --->
1357
   [*] ACPI Support
1358
   [*] Sleep States
1098
</pre>
1359
</pre>
1099
1360
1100
<p>
1361
<p>
1101
Compile your kernel with the appropriate options enabled and issue <c>cat
1362
Compile your kernel (with the appropriate options enabled), then issue the
1102
/proc/acpi/sleep</c> for 2.4 series respectively <c>cat /sys/power/state</c>
1363
following commands: <c>cat /proc/acpi/sleep</c> (for 2.4.x kernels) or
1103
for 2.6 to find out what is supported. The latter gives me <c>standby mem
1364
<c>cat /sys/power/state</c> (for 2.6.x kernels) to find out what is supported.
1104
disk</c>. For swsusp, the kernel parameter <c>resume=/dev/"your-swap-here"</c>
1365
The output for the latter command with a 2.6.11.10 kernel is
1105
has to be appended. If booting is not possible due to a broken image, use
1366
<c>standby mem disk</c>. For swsusp, the kernel parameter
1106
<c>noresume</c> for swsusp, <c>pmdisk=off</c> for Suspend-to-Disk and
1367
<c>resume=/dev/SWAPFILE</c> has to be appended to the boot loader's
1107
<c>noresume2</c> for swsusp2.
1368
list of arguments (replace SWAPFILE with the actual swap device file.) If
1369
booting is not possible due to a broken image, use <c>noresume</c> for swsusp,
1370
or <c>noresume2</c> for swsusp2.
1108
</p>
1371
</p>
1109
1372
1373
<warn>
1374
Backup your data before activating any sleep states on your system. Issue the
1375
<c>sync</c> command to have cached data written to disk. First try this without
1376
X running, then with X running, but without being logged into the system.
1377
</warn>
1378
1110
<p>
1379
<p>
1111
To put your system in one of the sleep states, use
1380
While the above should be sufficient to get swsusp running (not functional),
1381
swsusp2 needs special care. First, install an appropriate kernel (e.g. 
1382
swsusp2-sources), or enhance a generic kernel with the patches available at
1383
<uri link="http://softwaresuspend.berlios.de/">
1384
http://softwaresuspend.berlios.de/</uri>. Next, emerge <c>hibernate-script</c>.
1385
Once hibernate-script is installed, configure this utility using the script in
1386
<path>/etc/hibernate/hibernate.conf</path>. Finally, issue the <c>hibernate</c>
1387
command:
1112
</p>
1388
</p>
1113
1389
1114
<pre caption="Activating sleep states">
1390
<pre caption="Configuring (and enabling) hibernation">
1115
<comment>(kernel 2.4 series)</comment>
1391
<i># emerge hibernate-script</i>
1116
# <i>echo 1 &gt; /proc/acpi/sleep</i>          <comment>(standby)</comment>
1392
<i># $EDITOR /etc/hibernate/hibernate.conf</i>
1117
# <i>echo 3 &gt; /proc/acpi/sleep</i>          <comment>(sleep)</comment>
1393
<comment>(Last chance to backup any data)</comment>
1118
1394
<i># hibernate</i>
1119
<comment>(kernel 2.6 series)</comment>
1395
</pre>
1120
# <i>echo -n standby &gt; /sys/power/state</i> <comment>(standby)</comment>
1121
# <i>echo -n mem &gt; /sys/power/state</i>     <comment>(sleep)</comment>
1122
1396
1123
<comment>(swsusp)</comment>
1397
<p>
1124
# <i>echo 4 &gt; /proc/acpi/sleep</i>          <comment>(hibernate)</comment>
1398
To put a system running a 2.4.x kernel in one of the sleep states, issue one of
1399
the following commands:
1400
</p>
1125
1401
1126
<comment>(Suspend-to-Disk)</comment>
1402
<pre caption="Activating sleep states for 2.4.x kernels">
1127
# <i>echo -n disk &gt; /sys/power/state</i>    <comment>(hibernate)</comment>
1403
# <i>echo 1 &gt; /proc/acpi/sleep</i>           <comment>(standby)</comment>
1404
# <i>echo 3 &gt; /proc/acpi/sleep</i>           <comment>(sleep)</comment>
1128
1405
1129
<comment>(swsusp2)</comment>
1406
<comment>(swsusp2)</comment>
1130
# <i>/usr/sbin/hibernate</i>                   <comment>(hibernate, see below)</comment>
1407
# <i>/usr/sbin/hibernate</i>                 <comment>(hibernate)</comment>
1131
</pre>
1408
</pre>
1132
1409
1133
<warn>
1134
Backup your data before doing this. Run <c>sync</c> before executing one of the
1135
commands to have cached data written to disk. First try it outside of X, then
1136
with X running, but not logged in.
1137
</warn>
1138
 
1139
<p>
1410
<p>
1140
If you experience kernel panics due to uhci or similar, try to compile USB
1411
To put a system running a 2.6.x kernel in one of the sleep states, issue one of
1141
support as module and unload the modules before sending your laptop to sleep
1412
the following commands:
1142
mode.
1143
</p>
1413
</p>
1144
1414
1145
<p>
1415
<pre caption="Activating sleep states for 2.6.x kernels">
1146
While the above should be sufficient to get swsusp and Suspend-to-Disk running
1416
# <i>echo -n standby &gt; /sys/power/state</i>  <comment>(standby)</comment>
1147
(I didn't say working), swsusp2 needs special care. 
1417
# <i>echo -n mem &gt; /sys/power/state</i>      <comment>(sleep)</comment>
1148
The first thing to do is patching the kernel with the patches provided at <uri
1149
link="http://softwaresuspend.berlios.de/">
1150
http://softwaresuspend.berlios.de/</uri>. Additionally you've got to emerge
1151
<c>hibernate-script</c>. Once it is installed, configure
1152
<path>/etc/hibernate/hibernate.conf</path> and try whether it works:
1153
</p>
1154
1418
1155
<pre caption="Configure hibernation">
1419
<comment>(swsusp)</comment>
1156
<i># emerge hibernate-script</i>
1420
# <i>echo 4 &gt; /proc/acpi/sleep</i>           <comment>(hibernate)</comment>
1157
<i># $EDITOR /etc/hibernate/hibernate.conf</i>
1421
1158
<comment>(Last chance to backup any data)</comment>
1422
<comment>(swsusp2)</comment>
1159
<i># hibernate</i>
1423
# <i>/usr/sbin/hibernate</i>                 <comment>(hibernate)</comment>
1160
</pre>
1424
</pre>
1425
 
1426
<p>
1427
If you experience kernel panics due to uhci or similar utilities, try to compile
1428
USB support as module and unload the modules before sending your laptop into
1429
sleep mode.
1430
</p>
1161
1431
1162
</body>
1432
</body>
1163
</section>
1433
</section>
Lines 1208-1216 Link Here
1208
<p>
1478
<p>
1209
<e>A:</e> Probably you have activated symmetric multiprocessing support
1479
<e>A:</e> Probably you have activated symmetric multiprocessing support
1210
(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older
1480
(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older
1211
kernels had a bug causing this. In that case, run <c>emerge x86info</c>,
1481
kernels had a bug causing this. In that case, install a CPU diagnostic utility
1212
update your kernel as asked and check the current frequency with
1482
by issuing the <c>emerge x86info</c> command. Next, update your kernel and
1213
<c>x86info -mhz</c>.
1483
check the current frequency with <c>x86info -mhz</c>.
1214
</p>
1484
</p>
1215
1485
1216
<p>
1486
<p>
Lines 1296-1301 Link Here
1296
</p>
1566
</p>
1297
1567
1298
<p>
1568
<p>
1569
<e>Q:</e> The response from the command <c>watch x86info -mhz</c> is:
1570
 "/dev/cpu/0/cpuid: No such file or directory." What am I doing wrong?
1571
</p>
1572
1573
<p>
1574
<e>A:</e> It is likely that support for Model Specific Registers (MSR) and CPU
1575
information is not enabled in the kernel. To fix the problem, recompile the
1576
kernel and include the following options:
1577
</p>
1578
1579
<pre caption="MSR/CPU information support">
1580
  Processor type and features --->
1581
  <comment>(MSR support)</comment>
1582
    &lt;*&gt; /dev/cpu/*/msr - Model-specific register support
1583
  <comment>(CPU information support)</comment>
1584
    &lt;*&gt; /dev/cpu/*/cpuid - CPU information support
1585
</pre>
1586
<p>
1587
Be sure to select Y, not M. Selecting M may result in the same problem.
1588
</p>
1589
1590
<p>
1299
<e>Q:</e> My problem is not listed above. Where should I go next?
1591
<e>Q:</e> My problem is not listed above. Where should I go next?
1300
</p>
1592
</p>
1301
1593

Return to bug 98395