RemoveLaptopModeToolsFromDefaultInstall

Differences between revisions 16 and 17
Revision 16 as of 2009-12-19 10:34:09
Size: 12427
Editor: 77-21-62-108-dynip
Comment:
Revision 17 as of 2010-02-11 00:41:09
Size: 10554
Editor: minbar
Comment: Delete comments that are not part of the spec. If you have comments, please use the 'discussion' section.
Deletions are marked like this. Additions are marked like this.
Line 39: Line 39:
   * Not exactly, see http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync laptop-mode-tools increases the 5sec commit interval of ext3 anyway (a prerequisite to actually let a disk stay spun down) and it does the same with ext4, the latter delays allocation longer by default. Ext4 is supported by l-m-t since 1.47-1 in ubuntu. Without the laptop_mode delaying fsync() in the kernel (while active), any fsync() call will of course spin up a disk. This could be enhenced in the kernel by delaying fsysc() in laptop_mode, but would break the coherent and expected "sync does sync" behaviour. A discussed separate and "softer" call like fbarrier() might be better, but unlikely implemented or used widely according to Linus http://lwn.net/Articles/326505/. An increased use of fsync() in apps, as only portable way to ensure data consistency, will of course cause more disk IO (resulting in bad delays with ext3 yes, not ext4 http://lwn.net/Articles/326471/). Please read also Bug Bug:317781.   * setting the disk readahead value. The value used in `laptop-mode-tools` is arbitrary, based on one user's experience with the size of typical mp3 files; this should not be implemented by default without more research.
  * setting the idle timeout for hard drives. This setting is, however, disabled when battery level is critical, which we don't have a way to emulate currently with pm-utils, so we should forego setting this by default currently.
  * remounting ext3, ext4 filesystems with commit=600. It's not clear whether this also has adverse effects, similar to `laptop_mode`, so this should not be enabled without further investigation.
  * adjusting the `dirty_writeback_centisecs`, `dirty_expire_centisecs`, `dirty_ratio`, and `dirty_background_ratio` settings in `/proc/sys/vm`. The `dirty_writeback_centisecs` setting, at least, is recommended by the powertop tool; configuring this setting should be addressed in connection with UbuntuSpec:desktop-lucid-powermanagement-tweaks
Line 41: Line 44:
  * setting the disk readahead value. The value used in `laptop-mode-tools` is arbitrary, based on one user's experience with the size of typical mp3 files; this should not be implemented by default without more research.
   * Do your research and leave l-m-t defaults in place, come up to the l-m-t mailinglist if you think you have better ones.
  * setting the idle timeout for hard drives. This setting is, however, disabled when battery level is critical, which we don't have a way to emulate currently with pm-utils, so we should forego setting this by default currently.
   * The l-m-t feature to disable laptop-mode on critical battery has been crippled by ubuntu.
  * remounting ext3, ext4 filesystems with commit=600. It's not clear whether this also has adverse effects, similar to `laptop_mode`, so this should not be enabled without further investigation.
   * See note about laptop_mode above. If you want your disks to spin down while working (laptop-mode aka disk idleing) you *want* to read ahead considerable amounts and buffer all disk writes until next read is necessary or say 600sec have passed. Of course your risk data loss on crashes with unflushed buffers.
  * adjusting the `dirty_writeback_centisecs`, `dirty_expire_centisecs`, `dirty_ratio`, and `dirty_background_ratio` settings in `/proc/sys/vm`. The `dirty_writeback_centisecs` setting, at least, is recommended by the powertop tool; configuring this setting should be addressed in connection with UbuntuSpec:desktop-lucid-powermanagement-tweaks
   * Question: What is the difference between good defaults and good settings when letting disks spin down with laptop_mode?
Line 50: Line 45:
  * Please don't remove l-m-t if they are enabled.
  * If pm-utils wants to start maintainig laptop-mode (aka disk-idleing) settings on its own, it has to stop messing with them as soon as l-m-t are enabled.

Summary

The laptop-mode-tools package is installed by default, but provides a completely parallel interface for power management that duplicates functionality of pm-utils and the rest of the freedesktop.org stack, frequently tripping up users when one of the tools overrides the settings of the other. We should remove laptop-mode-tools from the default install, to have only one set of infrastructure in the default system for configuring and applying power management settings.

Release Note

The laptop-mode-tools package is no longer installed by default on the desktop in Ubuntu 10.04 LTS. Upgrading to 10.04 LTS with update-manager or do-release-upgrade will have the package automatically removed; users who upgrade manually with apt-get or other tools are advised to remove this package manually with sudo apt-get purge laptop-mode-tools.

Users who wish to continue using laptop-mode-tools to administer their power management settings may reinstall the package from the Ubuntu universe repository.

Rationale

The laptop-mode-tools package provides a completely parallel mechanism for configuring power management, duplicating most of the functionality already provided by the fd.o stack in the pm-utils package and packages that hook into it, such as hdparm. Although it provides tweaks for many aspects of power management that aren't currently supported in pm-utils, having two separate configuration mechanisms for the same functionality is inappropriate and results in confusing behavior when one setting overrides the other.

User stories

  • Fred has an oddball hard drive that locks up when using the default apm setting of '128'. He edits /etc/hdparm.conf to set apm_battery=254 instead, so that he can use his system on battery without it crashing.

  • Mary knows that enabling the kernel's laptop_mode on her laptop is safe (because she uses ext3) and will extend her battery life by 20%. She installs the laptop-mode-tools package for this purpose, and expects this to automatically turn on laptop_mode when she's running on battery.

Assumptions

The pm-utils package, as part of the freedesktop.org stack, is the correct infrastructure to standardize on for power management options.

Implementation

  • The hdparm and pm-utils packages already coordinate setting the hard drive APM value.

    • hdparm integrates with pm-utils (though 95hdparm-apm is in package pm-utils and not in hdparm) and gives enabled l-m-t precedence.

The other features that are active by default when laptop-mode-tools is enabled are:

  • enabling kernel laptop_mode when on battery. It should not be implemented by default; according to Ted T'so, this causes adverse interactions with ext4 filesystems, which we use by default.

  • setting the disk readahead value. The value used in laptop-mode-tools is arbitrary, based on one user's experience with the size of typical mp3 files; this should not be implemented by default without more research.

  • setting the idle timeout for hard drives. This setting is, however, disabled when battery level is critical, which we don't have a way to emulate currently with pm-utils, so we should forego setting this by default currently.
  • remounting ext3, ext4 filesystems with commit=600. It's not clear whether this also has adverse effects, similar to laptop_mode, so this should not be enabled without further investigation.

  • adjusting the dirty_writeback_centisecs, dirty_expire_centisecs, dirty_ratio, and dirty_background_ratio settings in /proc/sys/vm. The dirty_writeback_centisecs setting, at least, is recommended by the powertop tool; configuring this setting should be addressed in connection with desktop-lucid-powermanagement-tweaks

  • The laptop-mode-tools package is also not enabled by default despite being installed, so for the vast majority of users, removing it will be a no-op. For users that wish to use it, it should be easier to enable going forward because there's no longer a reason for the acpi-support package to forcibly disable it if it's not installed by default.

revert laptop-mode-tools patches from ubuntu

  • remove laptop-mode-tools from the seeds

  • add a quirk to update-manager to remove the package on upgrades

    • only remove the package if laptop-mode has not been enabled!
  • merge the latest Debian version of laptop-mode-tools

  • drop the code in acpi-support and laptop-mode-tools to disable laptop_mode by default

  • eliminate the Ubuntu delta from the Debian package related to the policy of not enabling laptop-mode-tools by default

    • delta related to making laptop-mode-tools integrate with pm-utils instead of directly with acpid should be retained and submitted upstream to Debian

  • add dirty_writeback_centisecs handling to pm-utils

    • No, don't do that. Disks won't spin down with only that, you need laptop_mode plus aditinal tweaks enabled to let disks idle! So use that l-m-t package if you want disks to spin down properly.

laptop-mode-tools integration into pm-utils

  • In laptop-mode-tools.conf: Default to turn off and comment those l-m-t features (non disk-idleing) that are handled by pm-utils. (Pointing to the corresponding pm-utils setting and a possibility to change the precedence.)
  • Hook l-m-t into AC/battery (power) state changes. [present]
  • Hook l-m-t into battery (low) events. (to have it disable things on low bat)
  • Hook l-m-t into lid state changes.
  • Document (also in config file) how to switch between l-m-t's and pm-utils *system* settings taking precedence. (Empty files in /etc/pm-utils to override pm-utils? Or links to call l-m-t after pm-utils scripts, or keep pm-tools granting l-m-t precedence if l-m-t are enabled, as it is the case with hdparm now.)

pm-utils

  • Give pm-utils an option not to mess with any settings handled by l-m-t if /var/run/laptop-mode-tools/enabled is present.
  • Document (also in config files) how to make *system* settings take precedence over pm-utils/gnome-energy-managager *user* settings (to centrally override non-pleasing/non-working defaults).

Test/Demo Plan

It's important that we are able to test new features, and demonstrate them to users. Use this section to describe a short plan that anybody can follow that demonstrates the feature is working. This can then be used during testing, and to show off after release. Please add an entry to http://testcases.qa.ubuntu.com/Coverage/NewFeatures for tracking test coverage.

This need not be added or completed until the specification is nearing beta.

BoF agenda and discussion

Summary

The laptop-mode-tools package is installed by default, but if enabled it adds a completely separate power management overlay that doesn't integrate with any of the rest of the system packages (and doesn't respect preferences set in those packages). This should be rectified.

Discussion

Confusion: There is the kernel's laptop_mode (/proc/sys/vm/laptop_mode) and there is the laptop-mode-tools package. The latter perfoms several additonal tweaks to optimize disk idleing in addition to the kernel's laptoop_mode. Additionaly it is capable to handle most power management tasks.

  • This spec looks less like integration and more like droping plus reimplementation and repeating errors. laptop-mode-tools is a very well maintained package widely used on debian laptops. Mangling the three tasks of power management (https://wiki.ubuntu.com/PowerManagement) into one (acpi-support) already failed miserably once. Use small tools specialized for its task. Why not adeqately calling the laptop-mode-tools script from pm-utils so that they do not trip over each other. (possibly deactivating/changing and properly commenting some of the laptop-mode-tools options) But dropping laptop-mode-tools from the distribution really does not look like a solution at all, much more if crucial laptop_mode (disk idleing) gets no support.

    • It would actually be the fourth repetition of the failure not to use the maintained laptop-mode-tools script. 1st ubuntu used to have a rather outdated package "laptop-mode" http://ubuntuforums.org/showthread.php?t=36976, 2nd package "acpi-support" was messing with laptop-mode, 3rd pm-utils used to ship a buggy laptop-mode script messing with laptop_mode (Bug #241590).

  • Upstream notes: http://samwel.tk/laptop_mode/packages/ubuntu

  • laptop-mode should not be enabled because it causes power performance degradation on ext4 which is the default filesystem on new installs. Enabling it when on battery if the filesystem is ext3 would be ok (except for the data loss), but laptop-mode-tools doesn't handle this today and this is not straightforward to implement (and data loss, which upsets people)

    • Fuzzy writing. Please provide references. Bug #317781 does not serve as one.
    • Deliberately buffering disk writes with laptop-mode-tools of course means loosing data if system crashes (but not on battery run out because laptop-mode-tools will disable it when battery gets low.). A reason not to touch (disk idleing / laptop_mode) with pm-tools but make laptop-mode-tools work in a pm-tools environment (hook it appropriately into current apm/acpi/pm-utils event hooks).
    • ext4 is supported by laptop-mode-tools since 1.47-1.
  • Why is laptop-mode-tools installed?
    • to enable a script that enables the kernel laptop-mode (vm writeback changes)
      • except that this script is not enabled by default and certainly has not been for many releases
        • Whoever wants his laptop disk to spin down needs to enable this.
    • the package is neutered in karmic but it in available as a package
  • Note: The laptop-mode freeze/drive access bug on some machines seems fixed but ubuntu status was not updated. (Bug #12483, debbugs #426548)

Anecdote:

  • NC10 failed to resume because of laptop-mode-tools taking an action on resume from suspend when it was disabled
    • pm-utils was shiping and using a broken laptop-mode script itself in the past. Bug #241590


CategorySpec

FoundationsTeam/Specs/RemoveLaptopModeToolsFromDefaultInstall (last edited 2010-02-11 00:47:35 by minbar)