Skip to content

Intel SpeedStep for XNU / Mac OS X

Note: This project is now deprecated. The original project page on Google Code is still available. The source code can be downloaded from that page.

Problem

PDF icon

Mac OS X includes support for processor power management in the form of a kernel extension which hooks into the kernel and controls processor frequency throttling.This kernel extension, however, is specific to Intel processor models which ship as part of Apple’s products, causing a kernel panic during startup on unsupported processors (which includes a wide range of Intel and AMD processors). Moreover, this kernel extension relies on presence of a working HPET, making it impractical for use even on supported processors due to BIOS’es which disable the HPET by default. Apple’s power management implementation is also closed source, and thus undesirable for use by the open-source Darwin operating system. It also offers very little customization possibilities, and does not support compensating for variableTSC frequency on older processors.

Solution

All these issues could be solved by simply doing away with Apple's kernel extension, and implementing an alternative power-management driver from scratch. Such a driver can be made to support a wide range of processor models and power management methods such as Intel's Enhanced SpeedStep™, or AMD’s Cool'n'Quiet™. XNU-SpeedStep is such an alternative power- management driver for Mac OS X and Darwin, which supports power management on Intel’s processors.

Procedure

The SpeedStep driver is implemented as a regular IOKit kernel extension.The driver controls the processor’s operating frequency and voltage in response to usage conditions. Each supported combination of frequency and voltage is called a P-State. The driver reads the ACPI tables to retrieve the list of possible P-States set up by the system’s BIOS. It then populates these values into several sysctl keys.The user can control the current operating frequency by setting the appropriate sysctl key for their desired frequency. Each set request is handled by the driver by calcuating the proper Frequency and Voltage IDs (according to Intel’s guidelines) and writing the values to the IA32_PERF_CTL machine-specific register. On processors which have a variable timestamp counter frequency, the driver also re-calibrates the kernel timing structures by calling appropriate functions to notify the kernel of the change in clock speed.

The driver includes an auto-throttler, which measures the processor usage every for quantum of time (currently set to 100 ms), and calculating the most appropriate clock speed to achieve a given target CPU load.The auto-throttler then automatically switches the processor to the closest P-State.

The driver allows the user to override the P-States table populated by ACPI, and create their own P- States. Provided that they follow Intel’s guidelines for frequency and voltage, the custom P-States offer finer control over the processor’s stepping.

Under-volting

A further possibility is that of under-volting the processor.Although not generally supported by the manufacturer, under-volting allows running the processor at a lower voltage than its specifications. Since the power dissipation in a processor is dependent on the core voltage, this results in a cooler core temperature (and consequently quieter heat-sink fan) without incurring the performance loss of under-clocking. Our testing shows that a reduction in core voltage of up to 250 mV was possible, with a corresponding reduction in core temperature by as much as 20°C.This is especially useful for laptop users where under-volting the processor results in much lower power consumption and therefore longer battery life and comfortable operating temperature.

Future

The driver is now deprecated. The work was picked up by the open-source community, and currently a much more evolved version of the power-management driver, called VoodooPower is available. It features support for many more processors, including latest Intel Core, Core 2 and Core ix processors, as well as most models of AMD’s processors (via Cool'n'Quiet).

Future work includes the possibility of controlling C-states in addition to P-states. C-states allow the processor to sleep for shorter durations while staying in the same P-state. T-state control for older processors is also planned. VoodooPower is currently in active development to implement these and more features. It is also being used as the power-management solution for the open-source PureDarwin project.