power-management-in-Ubuntu

Revision 11 as of 2007-07-14 13:26:50

Clear message

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

The Ubuntu Mobile Distribution will run on battery-powered devices. This makes power management critical. This specification lists the things that need to be addressed.

Rationale

Currently, Ubuntu is popular on laptops. With the increasing interest in mobile computing with the advent of Nokia´s internet tablets, Microsoft-Intel UMPCs and Intel´s MID initiative, battery life is becoming increasingly important. To be successful on these mobile platforms, significant work needs to be addressed toward increasing battery life. This work spans the whole stack from kernel to user-space.

Use Cases

  • Be able to watch 3-4 hours of DVD on a flight without an extended battery

Scope

  • Any package in the default install which can cause excessive battery usage: accessing the harddrive, polling for WLAN AP, keeps HW awake, etc.
  • Fix drivers to automatically put hardware to increasing levels of power save states based on multiple timeouts
  • Fix bus drivers to automatically put buses into power save modes when no devices on the bus are active e.g. pci, usb, pcmcia
  • Improve Linux driver model to allow control power control of individual devices to allow userspace to override the default policy of the driver
  • Enable a tickless (dynamic tick) kernel to allow processor to stay sleep for longer periods
  • Profile userspace with a powertop from Intel that lists offending processes that poll or set frequent timers and get them fixed

  • Profile userspace for unexpected block I/O accesses while idling. Those wakes the block devices and ATA buses from power saving modes, but PowerTOP don't tracks I/O. Tools : sysctl vm.block_dump=1 (then dmesg will show every block access), blktrace, systemtap.
  • Develop a library that allows timer wake ups to be synchronized for non-real time apps. Get KDE and Gnome communities to use these libraries

Design

Implementation

From https://wiki.ubuntu.com/ReducedPowerUsage so that we don't lose these optimizations.

acpi scripts

/etc/acpi/ac.d/10-vm_settings.sh

# Tweak virtual memory for running on AC.

echo 60 > /proc/sys/vm/swappiness
echo 3000 > /proc/sys/vm/dirty_expire_centisecs
echo 500  > /proc/sys/vm/dirty_writeback_centisecs
echo 10   > /proc/sys/vm/dirty_background_ratio
echo 40   > /proc/sys/vm/dirty_ratio

/etc/acpi/battery.d/10-vm_settings.sh

# Tweak virtual memory to conserve power when running on batteries.

echo 10 > /proc/sys/vm/swappiness
echo 0 > /proc/sys/vm/dirty_expire_centisecs
echo 0 > /proc/sys/vm/dirty_writeback_centisecs
echo 60 > /proc/sys/vm/dirty_background_ratio
echo 95 > /proc/sys/vm/dirty_ratio

/etc/acpi/ac.d/20-wireless_power.sh

# Change the wireless power mode to AC.
#   This works for ipw3945, not sure about other chipsets
#   Make sure eth1 is your wireless.

/sbin/iwpriv eth1 set_power 6

/etc/acpi/battery.d/20-wireless_power.sh

# Change the wireless power mode to Battery.

/sbin/iwpriv eth1 set_power 7

video card low power mode

The following is a nasty hack for the fglrx driver. It sets the video card to low power mode on boot.

https://help.ubuntu.com/community/BinaryDriverHowto/Fglrx_lowpower

The need for this hack points to the usefulness there would be of an acpi event generated upon user login/display activation. (perhaps this event already exists). The event could then trigger an acpi script which sets the video card to low power mode.

Outstanding Issues

  • laptop-mode
  • take care of these patches by Intel too!!! [http://www.linuxpowertop.org/known.php #patches-by-intel] <- yes, all of those should be checked that we either ship recent enough upstream version or add a patch

  • other relevant patches to look at is Gleixner and Molnar hrtimers (esp. the "force enable HPET" set) [http://www.tglx.de/projects/hrtimers/ #here]

  • evaluate the best frequency scaling method (which userspace governor is best presently, is the recently reworked in kernel cpuidle/ondemand better than an userland daemon, ...)
  • detect and disable hardware when not needed (ie. NetworkManager could be made to kill wireless radio when running on ethernet, we may disable Wake-on-Lan by default, ensure xorg 7.3 detects and disable TV-out or CRT outputs when no external monitor is plugged, etc.)

  • ensure other (non-CPU) hardware power saving modes are really activated when on battery (like AC97's /sys/module/snd_ac97_codec/parameters/power_save, hard drives APM and spindown timeouts, fglrx, ...)

References and See also

BoF agenda and discussion


CategorySpec CategoryLaptop