power-management-in-Ubuntu

Differences between revisions 19 and 20
Revision 19 as of 2007-10-31 20:03:05
Size: 7998
Editor: 12
Comment: Updated for Hardy
Revision 20 as of 2007-10-31 21:51:00
Size: 8377
Editor: mx2
Comment: clarify : force-enable hpet patches and SATA ALPM and AN got merged in 2.6.24
Deletions are marked like this. Additions are marked like this.
Line 37: Line 37:
  * Force-enable HPET patches are merged and on by default for documented chipsets (even when hidden by BIOS), present but off for some undocumented chipsets
  * SATA ALPM (AHCI link power management) and AN (asynchronous notifications)
  * Intel HDA audio powersaving rework
  * USB autosuspend for a few devices, like HID
  * USB URB statistics exported to userland (Sarah Sharp patches), exploited in powertop >= 1.9
Line 39: Line 44:
* AHCI link power stuff might go into 2.6.25

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

  • Jane wants to be able to watch a couple of DVD movies on a cross-Atlantic flight
  • Robert wants to be able to attend one full day of a conference taking notes on his laptop without having to carry a power supply and searching for power sockets.

Scope

Hardy

  • Tickless on x64
  • Use cpuidle infrastructure to idle processors

  • 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 e.g. gtimeout_at_secs in glib, deferred timers in kernel,
  • 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
  • Profile userspace for unexpected block I/O accesses while idling. This wakes up the block devices and ATA buses from power saving modes, but PowerTOP doesn't track I/O. Tools : sysctl vm.block_dump=1 (then dmesg will show every block access), blktrace, systemtap.
  • Profile userspace with powertop from Intel (www.linuxpowertop.org) that lists offending processes that poll or set frequent timers and get them fixed

  • Includes patches from powertop website that fix application issues
  • Fix packages in the default install which can cause excessive battery usage: accessing the harddrive, polling for WLAN AP, keeps HW awake, etc.

Design

Implementation

  • We get the following for free with 2.6.24:
    • Tickless on x64
    • cpuidle
    • Force-enable HPET patches are merged and on by default for documented chipsets (even when hidden by BIOS), present but off for some undocumented chipsets
    • SATA ALPM (AHCI link power management) and AN (asynchronous notifications)
    • Intel HDA audio powersaving rework
    • USB autosuspend for a few devices, like HID
    • USB URB statistics exported to userland (Sarah Sharp patches), exploited in powertop >= 1.9

* Need to check KDE libs for deferred timer implementation

Outstanding Issues

  • laptop-mode (should enable patented laptop-drive-killing mode by default).
  • 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

  • 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, ...)
  • Start a whitelist for USB devices that support autosuspend
  • AHCI link level PM to be pulled in - will lose hotswap support on desktop and server.
  • 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, SATA ALPM, wireless powersaving mode, USB autosuspend, fglrx, ...)
  • Pulse audio (better-than-esd(tm) "drop-in" replacement with extensions). Allows multi-application access at a high-level than direct ALSA
  • Ensure HPET (High Precision Event Timer) is enabled on platforms that support it.
  • NetworkManager general issues:

    • NetworkManager has agressive scanning.

    • NetworkManager keeps eth0 up even when no cable is plugged in. Needs syncing with kernel about up/down states for the interface.

    • If NIC disappears, should accept that rather than going AWOL.
    • Switch to NM 0.7 as 0.6 (Ubuntu is shipping) has been dropped by upstream.
    • Scan on event (screen unlock, icon-click) rather than on timer (which is too slow for user-experience and too fast for good power saving).
  • MID: Nokia routes all network connection through a connection tracker. So they can disable network interface and when an application tries to access the network, they can start a new connection quickly. It needs to be reimplemented in open source.
    • Netfilter connection tracking (better than LD_PRELOAD grabbing of connect()).

    • Investigate dummy network interface used with PPP bring up.

Notes for benchmarking

  • Remounting an ext3 filesystem as ext2 will attribute the block I/O requests directly to a process rather than to kjournald.

References and See also

BoF agenda and discussion

FAQs

  • Enable "usbcore.autosuspend=1" by default? Done! Drivers need to enable it - whitelisting could fix it.
  • BenjaminPineau: Some very importants aspects (mostly: available and supported hadware power saving features) has been somehow tested, but may need a larger scale testing before we can confidently choose to use or not use them by default in a released Ubuntu version. So it'd make sense to have this soon enabled during Gutsy+1 testing phase. On the other hand, some of those features had just been merged in 2.6.24-rc1, therefore may not be released soon enough (if we wait for 2.6.24 official release). Some power saving related decisions to be made ASAP:

    • Enable Alsa's AC97 and HDA power saving features by default?
    • Enable laptop mode by default when running on battery? (ie. are the suspend/resume problems been fixed as of now (let alone the "hdparm -B" thinggy) ? or would more exposure help to finaly fix them ?).
    • Enable "hpet=force" by default? (to enable hpet for supported but undocumented hpet timers, ie. on ICH4, VT8235/8237, nVidia chipsets)---specificed by Intel since ICH5, though not setup by BIOSes; arbituary timeout.

    • Enable Intel's "ondemand" kernel scaling governor by default? Done (Why is the CPU still attributed to the setter---powernowd.sh).

    • Disable "aggressive scanning when not associated on pre-mac80211 wireless drivers"? (as per Intel's [http://www.lesswatts.org/tips/wireless.php lesswatts] recommandation)?

    • Running Ubuntu desktop is down to ~40 wakeups per second, which is acceptable for the moment.


CategorySpec CategoryLaptop

power-management-in-Ubuntu (last edited 2008-08-06 16:22:27 by localhost)