Skip to content

Instantly share code, notes, and snippets.

@akwala
Last active August 29, 2015 14:22
Show Gist options
  • Save akwala/ce478a1d9394b19242e2 to your computer and use it in GitHub Desktop.
Save akwala/ce478a1d9394b19242e2 to your computer and use it in GitHub Desktop.
CPU Power Management for Intel Haswell Chips

These notes are for Intel Haswell desktop chips running Linux. YMMV depending on the specific processor and Linux distro/version.

(User's Guide)

The following will generate a snapshot of everything powertop measures in a file called powertop.html, which can then be viewed in a web browser:

> sudo powertop --html

This includes commands for tuning the "tunables," which can be added to /etc/init.d/rc.local so that they are set during boot-up. Alternatively, the following will tune all tunables (there may be auto-tuned settings that fail to be set or are not optimal for a given system, some trial-and-error may be needed):

> powertop --auto-tune
  • To disable Ethernet Wake-on-LAN, add to /etc/udev/rules.d/71-disable_wol.rules:

      ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*", RUN+="/usr/local/sbin/ethtool -s %k wol d"
    

    %k is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to eth00, the %k specifier will be replaced with eth0. To apply the rules to only a particular interface, just replace the pattern eth* and specifier %k with the desired interface name.

    If not using eth0 and it's still draining power, turn off the interface (to have this happen at boot-up, add to /etc/init.d/rc.local):

      > sudo ifconfig eth0 down
    

    To turn eth0 on (reverse the above):

      > sudo ifconfig eth0 up
    
  • To enable power-save on wirless interfaces, add to /etc/udev/rules.d/71-wifi-powersave.rules:

      ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*", RUN+="/usr/sbin/iw dev %k set power_save on
    

    %k is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to wlan0, the %k specifier will be replaced with wlan0. To apply the rules to only a particular interface, just replace the pattern wlan* and specifier %k with the desired interface name.

    If power-save for wireless interfaces still remains off, enable it manually:

      > iw wlan0 set power_save on
    

    If using the ath9k driver, this may report "command failed: Operation not supported (-95)." To fix this, add the following to /etc/modprobe.d/ath9k.conf:

      options ath9k ps_enable=1
    

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment