Platform Power Management
Power subsystems in a modern Personal ComputerAt the very lowest level, it is the hardware which consumes power, in order to perform the computations requested of it by the software on which it runs. Yet, it is the software which best knows its own execution characteristics, and which, if implemented well, gives a power manager incredible potential to save energy. In this article, we will be discussing the industry standard in hardware-software power management — the Advanced Configuration and Power Interface.
ACPI
The Advanced Configuration and Power Interface (ACPI) is an open standard, proposed by Intel, Microsoft and Toshiba, and first released in December 1996. It aimed to supplant the previous power management architecture, Advanced Power Management, which had been incumbent since at least early in 1990 in IBM PC-compatibles.
APM provided a rather coarse and somewhat low-level means by which power consumption of the system could be adapted. It was implemented primarily in the BIOS, with software-level control dependent upon an APM driver in the operating system, and an application aware of APM, with calls to change power state made through BIOS interrupts.
By virtue of operating at a very low level, power management was independent of the currently installed OS, and would work no matter the configuration of the system, but this led to trade-offs in accuracy and effectiveness as power management code running in the BIOS had very little awareness of what was happening in the system. The limited number of APM-aware applications meant that crude power management through observation of memory and disk accesses, CPU activity, and interrupts meant it was difficult to balance power savings with spurious transitions to idle states — such as during a presentation, when the computer is still in use, but sees no activity.
Designing a modern interface
Clearly, co-operative power management, where primarily the operating system issues commands, which are despatched and accepted by platform firmware to transition between power states, would offer finer-grained control, and hence efficacy, was required.
The new design crucially affords application software to drive power management functionality, by exposing a powerful and flexible interface to the operating system, which is not dependent on the programming of the firmware by the manufacturer. Hence, a uniform, consistent, and upgradeable management machinery is realised.
To understand and explore how the operating system in conjunction with application software can make use of this interface, it is necessary to briefly detail the specification of ACPI.
OSPM
The OSPM paradigm, Operating System-directed Configuration and Power Management, is enabled by ACPI-compatible firmware and OS. In order to effect power management commands, the concept of power states, processor states, and performance states are exposed to the ACPI stack. In the interests of scope, this article will examine only the effects of the last two.
Processor states
The following states govern the overall status of the CPU. Power consumption is in descending order.
- C0: normal operation
- C1: halted, can resume execution immediately
- C2: clock stopped, can resume quickly
- C3: sleeping, takes longer to resume
Performance states
The following states govern the performance characteristics of the CPU whilst in processor state C0. The CPU control circuitry will gate clocks and reduce voltage increasingly aggressively at higher states through dynamic voltage scaling. Power consumption is in descending order.
- P0: maximum performance
- P1: reduced clocks and voltages
- P2: reduced clocks and voltages
- Pn: reduced clocks and voltages
With this abstraction, and depending on the capabilities of the hardware, the operating system power management subsystem will be able to dynamically place the processor into low power states as necessary, and when required. Furthermore, it can intelligently optimise its execution to keep the processor in one of these states for as long as possible. These techniques will form the basis of this subtopic. Read on!