Day 3: Conferences: Power Management

Andrew Henroid, who is a software engineer at Intel, has been writing the ACPI stack for linux and rewrote the power management architecture.


Power management has become increasingly important lately with more and more people using linux. It can be done on the CPU, but also on the busses like USB

APM, which is supported as of linux 1.3.46 is a bit crude, there is little or no OS control, the bios is an opaque box and buggy bioses are plentiful.
ACPI is much better designed, it's completely OS-directed and can be nicely controlled through hardware registers. Power management policies are left to the OS, which lessens the number of bugs in the bios :-).

Likewise, inside linux, most of the code is left in user space, where memory is cheaper and bugs are less critical. The kernel itself contains the minimal hardware support and encapsulates the power manager drivers (APM or ACPI)

The kernel interface can send down information to devices for them to shut down or accomplish a specific task before the system goes to sleep, and you can also set "callbacks" where a device can wake up the system (the network card for instance)

The new device driver interface which replaced APM as of 2.3.43 is designed to be both flexible and easy to use so that hopefully driver authors will be more likely to include it in their drivers.

The suspend procedure works as such: the drivers each get a suspend request, which they either acknowledge or reject if something vital is happening.
Likewise, the resume procedure notifies all the drivers with interrupts disabled in order to work around buggy hardware that leaves interrupt lines in unknown states and could confuse hardware devices while they are still initializing.
The request can then be sent to user space to do things like renewing a DHCP lease.

The goal right now is to get driver writers to provide power management support, and they can do debugging and testing with the pmtools package available from the ACPI4Linux website.

Newer machines all come with ACPI, and often offer APM support too so that you get to chose which interface you want to use.
Devices provide information in a simple interpreted AML language to describe what they can do and how to access the features. This means that linux needs an AML interpreter in the kernel (which is unfortunately 100KB)

ACPI gives you control to:

The system idle policy is configurable, but you can enter in different power saving modes: C1 (older hlt instruction), C2 (deeper savings, but still able to talk to most hardware), C3 (even more savings, but can't do bus mastering for instance, so you need to wake up from that state, but the latency is pretty good)

The problems with ACPI implementation are:

You can find info here:

[library] Picture library [back] Back to Main Page [next] Next page

[ms free site] Email
Link to Home Page

2000/08/23 (19:45): Version 1.0