Battery Powered Linux Mini-HOWTO
Prev |  | Next

# 2. Power Management

If you have a relatively recent x86 laptop, odds are it supports either Advanced Power Management (APM) or Advanced Configuration and Power Interface (ACPI). ACPI is the newer of the two technologies and puts power management in the hands of the operating system, allowing for more intelligent power management than is possible with BIOS controlled APM. You can only have one power management interface in control of your machine at a time, so it's important you decide which method best suits your situation.

## 2.1. Advanced Power Management (APM)

Advanced Power Management (APM) is a specification for allowing the BIOS to control your system's power management without the knowledge of the operating system. The advantages to APM under Linux are that it's stable and has been around for some time, although not much development has happened with it over the past few years.

To use it, you'll need to enable APM in the kernel and fetch the APM daemon from http://www.worldvisions.ca/~apenwarr/apmd/

The APM daemon is actually made up of three primary programs:

- apmd - handles power management tasks

- apm - a command-line tool to print the current battery status or suspend the computer

- xapm - a simple battery meter for X

Currently, most major Linux distributions have not started to configure ACPI into their kernel, choosing to stick with APM. Therefore, configuration may be easier with APM depending on your distro's included utilities.

If you're looking for a simple, "works out of the box" approach to power management for your Laptop, APM is definitely the way to go.

## 2.2. Advanced Configuration and Power Interface (ACPI)

Advanced Configuration and Power Interface (ACPI) is the successor to APM, which places the responsibility of power management away from the BIOS and into the hands of the operating system. ACPI Linux is newer than APM Linux, more flexible in responding to power management events, has seen much more development as of late, and as a result of all this is prone to its own share of bugs from time to time.

If you're into cutting-edge development, are running a relatively recent (>2.4.10) kernel, and are not intimidated with kernel builds and applying patches against source code, ACPI is 0 the way to go.

There are two parts to ACPI under Linux: The ACPI driver built into the kernel itself, and the ACPI daemon (ACPID). ACPID in its current incarnation is pretty simple: monitor /proc/acpi/event and do things in response. Even if you don't load the daemon, you'll still get the benefit of ACPI features built into the kernel such as processor thermal support. You can fetch ACPID from http://acpid.sourceforge.net

When booting your ACPI-enabled system, you can determine which version of the ACPI driver you are using by looking for something similar to this:

    	ACPI: Subsystem revision 20021002

ACPI development is progressing at a steady rate, so you might want to consider patching your kernel against any recent updates to the kernel-level ACPI code at http://sourceforge.net/projects/acpi/ This is also useful if you are running into problem getting ACPI to work on your system and are experiencing Ps_execute: method failed ACPI error messages on boot. You may need to enable ACPI debugging in the kernel in order to determine if you are having a problem, and is generally considered a good idea.

A bit of history... Microsoft was the first vendor to implement ACPI. This is both good and bad. It is good because when you buy a system, you can pretty much guarantee that it has passed Microsoft's hardware compliance tests, including the test of its ACPI implementation. However, these tests come up short in that they do not indicate compliance with the ACPI specification, but rather with Microsoft's implementation of ACPI. When that same machine is used with Linux, some classes of errors that did not manifest themselves under Windows may become apparent. To protect against this problem, the Linux ACPI driver maintains a "bad BIOS" blacklist of known BIOS's that are known to not be ACPI compliant, and as a result will refuse to enable ACPI if your system is listed.

Many manufacturers are now validating that their systems run on Linux. However, they use major Linux distributions with the default kernel. This means that it is somewhat difficult to get OEMs to ensure that their systems work with ACPI-enabled Linux until a major Linux distribution ships an ACPI kernel. This presents a slight dilemma in that Linux distributions want to ship kernels that run on as many systems as possible, but there have been some positive moves in this area lately.

Current goals for the ACPI project include the implementation of sleep support, improvement of power-related daemons and libraries to take advantage of ACPI, and of course continued improvements in the ACPI driver itself.

For more specific background information on ACPI itself, you can visit the ACPI website at http://www.acpi.info

## 2.3. APM vs. ACPI: Which one?

There are currently two competing standards for providing power management: APM and ACPI. Both cannot be used at the same time, so which one is best for your situation? If you have a relatively recent (>2.4.10) kernel and are not intimidated by kernel builds and patching source code, you'll find many benefits with the flexibility of ACPI. If you just want to enable generic power management, or are using an older machine, choose APM. Neither method spins down idle hard drives; use hdparm for that instead. Either way, your system's BIOS must correctly support the power management scheme you'd like to use as well; if your system does not fully support either standard, some of the power management options might crash your system and/or cause data loss. You have been warned!

Regardless, you should be aware that even if you don't enable any power management on your laptop, on the x86 architecture Linux will always issue the "hlt" instruction to your processor whenever nothing needs to be done. This results in lowering the power consumption of your CPU. Note that the system doesn't power down when it receives the hlt instruction; it just stops executing instructions until there is an interrupt.

Some system manufacturers may have omitted the pre-ACPI tables used for SMP configuration. In this case, ACPI is required. If a system supports HyperThreading, it must use ACPI tables to discover all the virtual processors present. IA64 machines require ACPI, and NUMA servers are starting to require it for proper initialization as well. There is generally no advantage to enabling either type of power management on servers or workstations that do not fall into these categories.

If your computer's BIOS does not offer any power saving settings, you can use hdparm to define your harddisk's standby period. This will still help you out a lot, since harddisk activity typically consumes a lot of power.

Prev | Home | Next
Introduction |  | Power Management Techniques