Difference between revisions of "Power management"

From ArchWiki
Jump to: navigation, search
m (Disable NMI Watchdog)
m (merge suggestion)
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
[[Category:Power management]]
 
[[Category:Power management]]
 +
{{Merge|Power saving|probably most general article on ArchWiki on this topic}}
 
{{Stub|The purpose of this article currently overlaps other introductions like [[General Recommendations#Power management]] and [[Laptop#Power Management]]; application-specific information must be moved to the respective articles; only a generic introduction to power management in Arch and to related articles should stay here.}}
 
{{Stub|The purpose of this article currently overlaps other introductions like [[General Recommendations#Power management]] and [[Laptop#Power Management]]; application-specific information must be moved to the respective articles; only a generic introduction to power management in Arch and to related articles should stay here.}}
 
The aim of this page is to try to gather all the informations which are available on the topic of linux power management features. There are several places where one can change power management settings:
 
The aim of this page is to try to gather all the informations which are available on the topic of linux power management features. There are several places where one can change power management settings:
Line 9: Line 10:
 
Power settings you set in one place could be overwritten in another place.
 
Power settings you set in one place could be overwritten in another place.
  
== Where To Change Power Settings ==
+
==Power saving==
One can pass a kernel command line parameter in the boot loader to activate power management features in certain kernel modules. If you are using systemd you can change some power management options in systemd config files or execute your own config file. pm-utils and upower are working together. pm-utils is responsible for changing the power management options while upower informs pm-utils about system changes. For example if you unplug your laptop from AC upower will signal to pm-utils that the laptop is running on battery. This will cause pm-utils to change some power management options according to it's config files.
+
See [[power saving]].
 
+
Have a look at the power management category to get an overview on what power management options exists in Archlinux: [[:Category:Power management]].
+
  
 
== Kernel Command Line Parameters ==
 
== Kernel Command Line Parameters ==
Append the lines to your kernel command line parameter to enable these options. If you change settings for kernel modules make sure they are either compiled into your initrd (insert module name in MODULES in /etc/mkinitcpio.conf) or pass an option via a modprobe config file ([[Kernel_modules#Using_files_in_.2Fetc.2Fmodprobe.d.2F]]).
 
  
=== PCI-e ASPM ===
+
See [[Kernel modules#Using kernel command line]] for more information.
  pcie_aspm=force
+
 
+
=== Disable NMI Watchdog ===
+
  nmi_watchdog=0
+
  
 
=== Enable RC6 Power Save Options ===
 
=== Enable RC6 Power Save Options ===
Line 31: Line 25:
 
* '''7''': enable rc6, deep and deepest rc6
 
* '''7''': enable rc6, deep and deepest rc6
  
=== Activate Power Save For Intel HD Audio ===
+
== Troubleshooting ==
  snd_hda_intel.power_save=1
+
=== Connection problems with Atheros AR9485 Wireless Network Adapter ===
 
+
You may experience connection problems with the Atheros AR9485 Wireless Network Adapter, which is caused by incorrect power management functioning. You can notice the problem if you're experiencing random disconnections in [[Wikipedia:Instant messaging|IM]] or other software that keeps connection alive for a long time.
=== Change Usbcore Autosuspend Time ===
+
In case you're using laptop, first you must disable battery power-over-perfomance feature:
  usbcore.autosuspend=<time in seconds>
+
'''Settings / Power Manager / On Battery / Prefer power savings over perfomance'''
 
+
== Systemd Settings ==
+
There is a nice blog post from Andrea Scarpino about using systemd for power management: [http://www.andreascarpino.it/blog/posts/power-saving-with-systemd/ Power Saving With Systemd]
+
== pm-utils Settings ==
+
The pm-utils (see also: [[Pm-utils#Power_saving]]) package provides quirks for suspend to RAM and suspend to disk but also includes some scripts for power management. You need upower which registers power changes and signals that information to pm-utils.
+
 
+
=== Enable SATA Link Power Management ===
+
Execute the following command to enable SATA link power management when on battery:
+
  # echo SATA_ALPM_ENABLE=true > /etc/pm/config.d/sata_alpm
+
 
+
=== Scripts For Pm-utils Which Enable Power Management Options ===
+
These scripts have to be made executable via
+
  # chmod +x <script file>
+
 
+
==== Enable Runtime PM for PCI Devices ====
+
{{Hc|head=/etc/pm/power.d/device_pm|output=
+
<nowiki>#!/bin/sh
+
 
+
device_pm() {
+
    for dpcontrol in /sys/bus/{pci,spi,i2c}/devices/*/power/control; do
+
        [ -w "$dpcontrol" ] || continue
+
        echo $1 > "$dpcontrol"
+
    done
+
}
+
 
+
case "$1" in
+
    true)
+
        echo "**device power management ON"
+
        device_pm auto
+
        ;;
+
    false)
+
        echo "**device power management OFF"
+
        device_pm on
+
        ;;
+
esac
+
 
+
exit 0</nowiki>}}
+
 
+
==== Enable Power Management For USB Devices ====
+
{{Hc|head=/etc/pm/power.d/usb_pm|output=
+
#!/bin/sh
+
case "$1" in
+
    true)
+
      # USB powersaving
+
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
+
            echo 1 > $i
+
        done
+
        for i in /sys/bus/usb/devices/*/power/control; do
+
            echo auto > $i
+
        done
+
sysctl kernel.nmi_watchdog=0
+
    ;;
+
    false)
+
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
+
            echo 2 > $i
+
        done
+
        for i in /sys/bus/usb/devices/*/power/control; do
+
            echo on > $i
+
        done
+
sysctl kernel.nmi_watchdog=1
+
    ;;
+
esac
+
 
+
exit 0}}
+
 
+
==== Increase VM Writeback Timeout ====
+
{{Hc|head=/etc/pm/power.d/vm-writeback|output=
+
<nowiki>#!/bin/sh
+
 
+
# VM writeback timeout power savings
+
 
+
wm_writeback() {
+
    if [ -w /proc/sys/vm/dirty_writeback_centisecs ]; then
+
printf "Set VM writeback timeout to %d..." "$1"
+
        echo $1 > /proc/sys/vm/dirty_writeback_centisecs && echo Done. || echo Failed.
+
    fi
+
}
+
 
+
case $1 in
+
    true)
+
wm_writeback '1500'
+
;;
+
    false)
+
wm_writeback '500'
+
;;
+
esac
+
 
+
exit 0</nowiki>}}
+
 
+
==== Disable NMI Watchdog ====
+
{{Hc|head=/etc/pm/power.d/nmi-watchdog|output=
+
<nowiki>#!/bin/sh
+
 
+
# NMI Watchdog timer power savings
+
 
+
nmi_watchdog() {
+
    if [ -w /proc/sys/kernel/nmi_watchdog ]; then
+
        echo $1 > /proc/sys/kernel/nmi_watchdog && echo Done. || echo Failed.
+
    fi
+
}
+
 
+
case $1 in
+
    true)
+
echo "Disable NMI Watchdog..."
+
nmi_watchdog 0
+
;;
+
    false)
+
echo "Enable NMI Watchdog..."
+
nmi_watchdog 1
+
;;
+
esac
+
  
exit 0</nowiki>}}
+
Next thing to do is switch off power management for adapter:
 +
You should add
 +
{{bc|<nowiki>iwconfig wlan0 power off</nowiki>}} (assuming wlan0 is your AR9485 adapter) anywhere it can be executed on system init (or simply run it once, to fix the problem for current session) and that should do it.
  
 
== See Also ==
 
== See Also ==
 
[[CPU Frequency Scaling]]
 
[[CPU Frequency Scaling]]

Revision as of 15:02, 26 June 2013

Merge-arrows-2.pngThis article or section is a candidate for merging with Power saving.Merge-arrows-2.png

Notes: probably most general article on ArchWiki on this topic (Discuss in Talk:Power management#)

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: The purpose of this article currently overlaps other introductions like General Recommendations#Power management and Laptop#Power Management; application-specific information must be moved to the respective articles; only a generic introduction to power management in Arch and to related articles should stay here. (Discuss in Talk:Power management#)

The aim of this page is to try to gather all the informations which are available on the topic of linux power management features. There are several places where one can change power management settings:

Power settings you set in one place could be overwritten in another place.

Power saving

See power saving.

Kernel Command Line Parameters

See Kernel modules#Using kernel command line for more information.

Enable RC6 Power Save Options

 i915_enable_rc6=#Nr

Where #Nr:

  • 1: enable rc6
  • 3: enable rc6 and deep rc6
  • 5: enable rc6 and deepest rc6
  • 7: enable rc6, deep and deepest rc6

Troubleshooting

Connection problems with Atheros AR9485 Wireless Network Adapter

You may experience connection problems with the Atheros AR9485 Wireless Network Adapter, which is caused by incorrect power management functioning. You can notice the problem if you're experiencing random disconnections in IM or other software that keeps connection alive for a long time. In case you're using laptop, first you must disable battery power-over-perfomance feature: Settings / Power Manager / On Battery / Prefer power savings over perfomance

Next thing to do is switch off power management for adapter: You should add

iwconfig wlan0 power off
(assuming wlan0 is your AR9485 adapter) anywhere it can be executed on system init (or simply run it once, to fix the problem for current session) and that should do it.

See Also

CPU Frequency Scaling