How Linux Uses ACPI for Power Management
The Linux operating system manages modern hardware power consumption primarily through the Advanced Configuration and Power Interface (ACPI), an open industry standard that abstracts platform hardware. This article examines how the Linux kernel discovers hardware capabilities via ACPI tables, implements the ACPI Component Architecture (ACPICA), regulates processor performance and sleep states, handles thermal constraints, and translates firmware-level power events into actionable system behaviors.
Firmware Initialization and ACPI Tables
The interaction begins at boot when the platform firmware (UEFI or BIOS) presents a set of ACPI tables in system memory to the Linux kernel. The most critical tables include:
- RSDP/XSDT (Root/Extended System Description Tables): Pointer structures that identify all other available ACPI tables.
- FADT (Fixed ACPI Description Table): Contains fixed-hardware register details, system power flags, and pointers to the DSDT.
- DSDT (Differentiated System Description Table): Contains the primary platform hardware definitions written in ACPI Source Language (ASL) and compiled into ACPI Machine Language (AML) byte code.
- SSDT (Secondary System Description Table): Supplies optional and modular device definitions that extend the DSDT, often used for dynamic hardware configurations.
Linux parses these tables using ACPICA (ACPI Component Architecture), an OS-independent reference implementation maintained by Intel and built directly into the kernel. The ACPICA interpreter evaluates the AML byte code, creating a hierarchical namespace representing devices, power resources, thermal zones, and control methods.
CPU Power Management
Linux links ACPI definitions directly to its CPU power subsystems:
Processor Sleep States (C-States)
The cpuidle subsystem queries ACPI _CST
(C-State) objects to discover platform idle modes. When a CPU core has
no threads to execute, cpuidle selects an appropriate
low-power C-state (ranging from C1 to deeper states like C6/C10). Deeper
states save more power by powering down execution units and caches, but
incur higher wake-up latencies.
Processor Performance States (P-States and CPPC)
For active workloads, the Linux cpufreq subsystem
manages processor operating frequencies and voltages:
- Legacy P-States: Described via ACPI
_PSSand_PCTobjects, allowing the kernel's CPU governors (e.g.,schedutil,powersave,performance) to manually select discrete performance points. - Collaborative Processor Performance Control (CPPC):
Modern systems use ACPI
_CPCobjects, implemented in drivers likeamd_pstateandintel_pstate. Under CPPC, the Linux kernel conveys abstract performance requirements directly to hardware, allowing the processor itself to autonomously scale clocks and voltages at microsecond intervals.
System Sleep and Suspensions (S-States)
Linux exposes ACPI-defined system sleep states to userspace via
/sys/power/state:
- S3 (Suspend-to-RAM): Execution halts, device
contexts are saved to RAM, and platform clocks stop. The kernel invokes
ACPI
_PTS(Prepare to Sleep) and writes to ACPI control registers to enter the sleep state. - S4 (Hibernation / Suspend-to-Disk): System memory is written to non-volatile storage, and the hardware transitions to a full ACPI S4 or G2/S5 soft-off state.
- Suspend-to-Idle (s2idle / Modern Standby): An alternative to S3 common in modern laptops. Instead of relying on firmware S3 transitions, the Linux kernel coordinates deep runtime power down across all devices and puts CPUs into their deepest package C-states while remaining in the ACPI S0 working state.
Device Power Management (D-States)
Individual devices within the ACPI tree define power resources and
methods (_PS0 through _PS3) to manage device
states from D0 (fully on) to D3cold (completely unpowered). The Linux
Runtime Power Management (Runtime PM) framework monitors device
utilization. When a device (such as a PCIe controller, storage drive, or
network card) becomes idle, the kernel executes its ACPI power
transition methods to cut power automatically, restoring it
instantaneously when the device is accessed again.
Thermal Management and Event Handling
ACPI provides dynamic event reporting and thermal management capabilities through interrupts:
- Fixed and General Purpose Events (GPEs): Hardware
triggers an ACPI event (like closing a laptop lid, pressing the power
button, or inserting a battery charger) via a low-level interrupt. The
Linux ACPI driver catches this interrupt, evaluates the corresponding
GPE handler, and forwards the event to userspace daemons (such as
systemd-logindoracpid) via netlink sockets or the/dev/inputsubsystem. - Thermal Control: The Linux thermal framework
interacts with ACPI thermal zones (
_TZobjects). If temperatures exceed defined thresholds (_ACxfor active cooling,_CRTfor critical shutdown,_PSVfor passive cooling), the kernel automatically activates fans via ACPI fan drivers or throttles CPU frequency to prevent thermal damage.