Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Main Support Categories > Dell Ubuntu Support
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Dell Ubuntu Support
Got a Dell powered by Ubuntu? Or thinking about getting one? Discuss it here.

 
Thread Tools Display Modes
Old July 2nd, 2008   #1
sdennie
Ubuntu Café con Leche
 
sdennie's Avatar
 
Join Date: Jan 2007
Location: Buenos Aires
Beans: 3,564
Ubuntu 8.04 Hardy Heron
HOWTO: XPS m1330 power savings

Depending on how you use the machine, with a 9 cell battery, it's possible to get over 6 hours of battery life with an XPS m1330. This is a guide for the scripts and general tips I've used on my XPS m1330.

Specs:
XPS m1330
T9300 CPU
NVidia 8400M GS GPU
7200rpm 200G disk
LED display
Intel 3945 wireless
9 cell battery

Basic scripts

[Edit]
Several other people have written scripts in this thread and some of them have more options or go about doing things a different way. There are many ways to do what I'm trying to accomplish and the other scripts are worth looking at once you've looked through this post and understand the basic idea of what's going on. I'll link to them here so that people don't have to wade through the entire thread to find them:

- atlas95s script
- tinivoles script
- motins script
- bubbalouies script
[/Edit]

The first script is similar to laptop-mode but with tips from powertop and www.lesswatts.org. It's possible to use laptop-mode and make this script smaller but, my personal preference is to have everything in one place. Here is the main script:

Code:
#!/bin/bash

# Go fast on AC power.  Similar to default Ubuntu settings
if on_ac_power; then
  # Set the drive to mostly stay awake.  Some may want to change -B 200
  # to -B 255 to avoid accumulating Load_Cycle_Counts
  hdparm -B 200 -S 240 -M 254 /dev/sda

  # Remount ext3 filesystems so the journal commit only happens every 60
  # seconds.  By default this is 5 but, I prefer to reduce the disk
  # activity a bit.
  mount -o remount,commit=60 /
  mount -o remount,commit=60 /home

  # Turn off the laptop mode disk optimization
  echo 0 > /proc/sys/vm/laptop_mode

  # Manually set the wifi driver to no power savings.
  echo 6 > /sys/bus/pci/drivers/iwl????/0000\:??\:00.0/power_level  

  # Set kernel dirty page value back to default
  echo 10 > /proc/sys/vm/dirty_ratio
  echo 5 > /proc/sys/vm/dirty_background_ratio

  # Only wakeup every 60 seconds to see if we need to write dirty pages
  # By default this is every 5 seconds but, I prefer 60 to reduce disk
  # activity.
  echo 6000 > /proc/sys/vm/dirty_writeback_centisecs

  # Turn off sound card power savings
  echo 0 > /sys/module/snd_hda_intel/parameters/power_save
  
  # Set the SATA to max performance
  echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
  echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy

  # Make sure ondemand governor is set
  echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 

  # Enable the webcam driver
  modprobe uvcvideo

else # Save power

  # Set the disks to aggressively save power and use the lowest acoustic
  # level.  Some might find these settings too aggressive.  If so, change 
  # "-S 4" to something larger like -S 24 (two minutes) and -B 1 to -B 255.
  hdparm -B 1 -S 4 -M 128 /dev/sda
  
  # Change the ext3 commit times to 10 minutes.  This reduces disk
  # activity
  mount -o remount,commit=600 /

  # Set laptop disk write mode
  echo 5 > /proc/sys/vm/laptop_mode

  # Manually set the iwl3945 driver to power savings.
  echo 5 > /sys/bus/pci/drivers/iwl????/0000\:??\:00.0/power_level  

  # Reduce disk activity by waiting up to 10 minutes before doing writes
  echo 90 > /proc/sys/vm/dirty_ratio
  echo 1 > /proc/sys/vm/dirty_background_ratio
  echo 60000 > /proc/sys/vm/dirty_writeback_centisecs

  # Set sound card power savings
  echo 10 > /sys/module/snd_hda_intel/parameters/power_save

  # Set SATA to minimum power
  echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
  echo min_power > /sys/class/scsi_host/host1/link_power_management_policy

  # Make sure ondemand governor is set
  echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 

  # Remove the webcam driver
  modprobe -r uvcvideo
fi
Most these settings come from powertop/www.lesswatts.org but, some of them are using different values. To install this script on Hardy, name it 99-savings and use:

Code:
sudo install 99-savings /etc/pm/sleep.d
sudo install 99-savings /etc/pm/power.d
To install it on Gutsy, use:

Code:
sudo install 99-savings /etc/acpi/start.d
sudo install 99-savings /etc/acpi/resume.d
sudo install 99-savings /etc/acpi/ac.d
sudo install 99-savings /etc/acpi/battery.d
NVidia and compiz
If you don't have an NVidia card (this is only tested on an 8400M GS in fact), and you aren't using compiz, this section propably won't be of any use to you.

First, I recommend using this tutorial to get good compiz performance on AC and good power savings on battery: http://ubuntuforums.org/showthread.php?t=828369

Then, we will set it up so that the NVidia driver uses as little power as possible. First, edit /etc/X11/xorg.conf and find the section that describes the nvidia card. You may have customized it in the past but, be sure it at least contains the following information:

Code:
Section "Device"
    Driver    "nvidia"
    Option    "OnDemandVBlankInterrupts" "True"
Now we will install a script that does 2 things: 1) Turns of sync to vblank when the machine is on battery power. 2) Changes the compiz Wall plugin to use a lower value. This means that you can switch desktops without forcing the GPU into maximum power (it saves a lot of power).

Code:
#!/bin/bash


# Change this to your user name
XUSER=your_username


if on_ac_power; then
  # Set vblank to on when on AC power
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type boolean --set /apps/compiz/general/screen0/options/sync_to_vblank 1"

  # Change wall switch time to default
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type float --set /apps/compiz/plugins/wall/allscreens/options/slide_duration 0.3"

  # Touch the nvidia card so it immediately goes to full power when we
  # plug the machine in
  DISPLAY=:0.0 su ${XUSER} -c "nvidia-settings -q all > /dev/null"

else

  # Turn off sync to vblank when on battery power so we reduce the nvidia
  # wakeups
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type boolean --set /apps/compiz/general/screen0/options/sync_to_vblank 0"
  
  # Set the wall slide duration much lower to prevent it from forcing the
  # card into full power
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type float --set /apps/compiz/plugins/wall/allscreens/options/slide_duration 0.1"
fi
Depending on what plugins you use, you may want to add even more values to that to prevent compiz from forcing the GPU to max power as often. To find the names/values of particular features, use gconf-editor and go to /apps/compiz. To install that script, name it 99-nvidia and do the following on Hardy:

Code:
sudo install 99-nvidia /etc/pm/sleep.d
sudo install 99-nvidia /etc/pm/power.d
On Gutsy:

Code:
sudo install 99-nvidia /etc/acpi/start.d
sudo install 99-nvidia /etc/acpi/resume.d
sudo install 99-nvidia /etc/acpi/ac.d
sudo install 99-nvidia /etc/acpi/battery.d
General

- If you never use bluetooth, I recommend going into the BIOS and setting the wifi/bluetooth switch on the laptop to only control Bluetooth and then leaving that switch off at all times.

- If you never use the webcam, it may be sufficient to just modprobe -r uvcvideo however, I haven't thoroughly checked this out. It may be best to completely blacklist the driver but, I'm not sure if that setting sticks between suspend/resume so, you may have to delete the driver (make a backup of it first).

- If you never use USB/Bluetooth while on battery, removing most of the usb and bluetooth subsystem can save a huge amount of power. In the first section of first script add:

Code:
  # Optional: Put back most of the bluetooth/usb subsystem
  modprobe  hci_usb
  modprobe  rfcomm
  modprobe  l2cap
  modprobe  bluetooth
  modprobe  usbhid
  modprobe  uhci_hcd
  modprobe  ehci_hcd
In the section for battery mode, add:

Code:
  # Optional: Remove the most of the bluetooth/usb subsystem
  modprobe -r hci_usb
  modprobe -r rfcomm
  modprobe -r l2cap
  modprobe -r bluetooth
  modprobe -r usbhid
  modprobe -r uhci_hcd
  modprobe -r ehci_hcd
This can save upwards of 1 watt of power.

- For anyone running the new 2.6.26 kernel, the PCI Express power savings seems to save a huge amount of power (about 0.7W). The commands to do this are:

Code:
# Use default on AC
echo default > /sys/module/pcie_aspm/parameters/policy
And, on battery:

Code:
# Use powersave on battery
echo powersave > /sys/module/pcie_aspm/parameters/policy
There is also a "performance" setting but, it makes the power usage so incredibly high that it can't be what the BIOS is using by default so I'm not willing to use it.

- Do *not* leave a firefox tab open with things like gmail while on battery power. If at all possible, close all tabs but one and try to keep to sites that are light on javascript and try to stay away from anything with flash.

- If you find the disk spinning up too often, try:

Code:
sudo sh -c "echo 1 > /proc/sys/vm/block_dump"
tail -f /var/log/syslog
Then, to turn that functionality off:
Code:
sudo sh -c "echo 0 > /proc/sys/vm/block_dump"
Wait for a while and see if you can figure out what application is causing the disk to wakeup too often. The script above reduces the number of wakeups due to writes but, reads can still cause the disk to wakeup.

- Do *not* use virtual machines while on battery power. They will drain the battery very quickly.

- I'm currently testing whether turning off the Firefox disk cache will keep the disk suspended for longer amounts of time (the theory being the disk won't wakeup to read the cached files). It's hard to tell if it's making a difference but, to try it, type "about:config" in Firefox and search for cache and you can turn off the disk cache.

- Use powertop and top in conjunction with each other in two different windows to see if you have any misbehaving applications. If possible, put them in small windows that stay on top (maybe reduce the font size too) and keep an eye on both while going about your normal work.

- Use the ondemand governor and not the powersave governor. See: http://mjg59.livejournal.com/88608.html

- Keep the backlight as low as you can possibly stand it. Try to at least keep it at half power or less. This can save a lot of power.

- Avoid listening music while on battery power. In fact, don't keep any music applications open while on battery power because many will prevent the sound card from going to sleep.

- For the machine as spec'd above, you should expect idle power consumption in the range of ~12 watts with a handful of apps open. For example, with Firefox, Pidgin, Nautilus, Evolution and a few terminals running, if I type the following and then walk away from the machine for 1 minute:

Code:
acpi
sudo powertop -d -t 60
The output looks like this on the lowest backlight setting (note that the machine is at 85% battery and not 100% battery in this example):

Code:
sdennie@zorba:~/src/scripts$ acpi
     Battery 1: discharging, 85%, 06:19:34 remaining
sdennie@zorba:~/src/scripts$ sudo powertop -t 60 -d
PowerTOP 1.9    (C) 2007 Intel Corporation 

Collecting data for 60 seconds 
Cn	          Avg residency
C0 (cpu running)        ( 4.6%)
C1		  0.0ms ( 0.0%)
C2		  0.5ms ( 1.1%)
C3		  5.5ms (94.4%)
P-states (frequencies)
  2.51 Ghz    83.3%
  2.50 Ghz     0.0%
  2.00 Ghz     0.0%
   800 Mhz    16.7%
Wakeups-from-idle per second : 191.3	interval: 60.0s
Power usage (ACPI estimate): 12.1W (6.4 hours) 
Top causes for wakeups:
  63.5% (137.1)      <kernel IPI> : Rescheduling interrupts 
   7.1% ( 15.3)       <interrupt> : iwl3945 
   6.7% ( 14.4)       <interrupt> : extra timer interrupt 
   6.5% ( 14.0)           firefox : futex_wait (hrtimer_wakeup) 
   6.3% ( 13.6)       compiz.real : schedule_timeout (process_timeout) 
...
If you are using the 2.6.26 kernel and have enabled PCI Express savings and the machine is very idle, you can expect these numbers to be much lower (as low as 10.3W for me).

I hope that helps.
__________________
Don't try to make something "fast" until you are able to quantify "slow".

Last edited by sdennie; December 11th, 2008 at 11:38 AM.. Reason: More advice about hdparm
sdennie is offline   Reply With Quote
Old July 2nd, 2008   #2
madsmeg
Gee! These Aren't Roasted!
 
madsmeg's Avatar
 
Join Date: Dec 2005
Location: South Wales, UK
My beans are hidden!
Send a message via MSN to madsmeg
Re: HOWTO: XPS m1330 power savings

Great guide even though i do not own a laptop (yet)

When i do i will be sure to put this to use.
__________________
<tronyx> "you should hire me to stare at your wireshark because i can spot a virus being downloaded in a compressed file over bit torrent at up to 600 kb/s"
madsmeg is offline   Reply With Quote
Old July 3rd, 2008   #3
sultanoswing
A Carafe of Ubuntu
 
Join Date: Aug 2006
Beans: 94
Re: HOWTO: XPS m1330 power savings

Great thread, thanks Vor...just in time for my brand new XPS 1330 with x64 Ubuntu!

This an other threads are MUCH appreciated as we optimise these already nice laptops with a much better OS than the default (being not in the US, I had to order mine with Vista, sadly, but MS is deluded if they count all such purchases as 'Windows users'. It was wiped within an hour.).

Having implemented most of your above suggestions has reduced battery drain markedly (not objectively measured yet, but the bar is going down much more slowly).

Your NVIDIA 8400M GS ac-power full-speed guide was great - I had been wondering why compiz wasn't quite smooth prior to enabling the card properly!

EDIT: one tiny amendment to your guide - you mention saving the file as '99-savings.sh', yet then sudo install '99-savings'
sultanoswing is offline   Reply With Quote
Old July 3rd, 2008   #4
atlas95
Gee! These Aren't Roasted!
 
atlas95's Avatar
 
Join Date: Jul 2005
Location: FRANCE
Beans: 162
Ubuntu 9.04 Jaunty Jackalope
Send a message via ICQ to atlas95 Send a message via MSN to atlas95 Send a message via Skype™ to atlas95
Exclamation Re: HOWTO: XPS m1330 power savings

* Here my script for powersave my m1330 (sorry comment are in french and i don't remember all the tweak I have do)

If someone can help me to optimise it most, i run it with an icon, not automatically on plug on un-plug ac.

Code:
#! /bin/bash


verif_root(){ # Fonction qui verifi que l'on lance bien en tant que ROOT
	        	UID_ROOT=0
			if [ "$UID" -ne "$UID_ROOT" ]
			    then
			            zenity --error --title="Accès refusé" --text="Les droits d'administrateur n'ont pas été octroyés pour ce script. Veuillez le relancer avec les permissions root !"
			            exit
			fi
			}	

function icon(){
	zenity --notification --text="Cliquer ici pour revenir a la normal, performance max" --window-icon="/home/cyril/.icons/tango-d/scalable/apps/gstreamer-properties.svg"
}

function puissance_min(){
verif_root

XUSER=cyril

  # Set vblank to on when on AC power
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type boolean --set /apps/compiz/general/screen0/options/sync_to_vblank 1"

  # Change wall switch time to default
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type float --set /apps/compiz/plugins/wall/allscreens/options/slide_duration 0.3"

  # Touch the nvidia card so it immediately goes to full power when we
  # plug the machine in
  DISPLAY=:0.0 su ${XUSER} -c "nvidia-settings -q all > /dev/null"

# arret de service inutile sur batterie
/etc/init.d/postfix stop
/etc/init.d/anacron stop
/etc/init.d/ntp stop
/etc/init.d/rsync stop
/etc/init.d/smartmontools stop
/etc/init.d/cupsys stop
/etc/init.d/tor stop
/etc/init.d/cron stop
/etc/init.d/sysklogd stop
/etc/init.d/klogd stop
# powersave scheduler cpu
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
# disque dur
hdparm -B 1 -S 4 -M 128 /dev/sda
mount -o remount,commit=600 /
mount -o remount,commit=600 /home
# powersave carte son
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
# powersave usb
echo 1 > /sys/module/usbcore/parameters/autosuspend
# powersave iwl4965 wifi
echo 5 > /sys/bus/pci/drivers/iwl4965/0000\:0c\:00.0/power_level
# reglage sata
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
echo min_power > /sys/class/scsi_host/host2/link_power_management_policy
echo min_power > /sys/class/scsi_host/host3/link_power_management_policy
echo min_power > /sys/class/scsi_host/host4/link_power_management_policy
# reglage vm
echo 10 > /proc/sys/vm/swappiness
echo 0 > /proc/sys/vm/dirty_expire_centisecs
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 60 > /proc/sys/vm/dirty_background_ratio
echo 95 > /proc/sys/vm/dirty_ratio
# arret du polling cdrom
hal-disable-polling --device /dev/scd0
# vitesse lecture cd au mini
setcd -x min
# arret de la cam
modprobe -r uvcvideo
modprobe -r usbvision
# désactiver le Wake-On-Lan
ethtool -s eth0 wol d #inutile si module decharger ci-dessous
modprobe -r tg3
# si son système est stable, pas la peine de causer de nombreux
# réveils CPU avec la surveillance des "Non Maskable Interrupt".
echo 0 > /proc/sys/kernel/nmi_watchdog
# driver lecteur de carte off
#modprobe -r tifm_sd
modprobe -r ricoh_mmc
## switch off usb
modprobe -r ehci_hcd
modprobe -r uhci_hcd
# undervoltage
echo "27 27 17 11 6" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
synclient TouchpadOff=1
#openbox --replace
zenity --warning --text "Appuyer sur windows+F4 pour reactiver le touchpad"
}

function puissance_max(){
verif_root
########## parti pour revenir a la normal
XUSER=youruser

  # Turn off sync to vblank when on battery power so we reduce the nvidia
  # wakeups
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type boolean --set /apps/compiz/general/screen0/options/sync_to_vblank 0"
  
  # Set the wall slide duration much lower to prevent it from forcing the
  # card into full power
  DISPLAY=:0.0 su ${XUSER} -c "gconftool-2 --type float --set /apps/compiz/plugins/wall/allscreens/options/slide_duration 0.1"

# sheduler des 2core
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
# pas d'autosuspend usb
echo 2 > /sys/module/usbcore/parameters/autosuspend
# voltage normal
if on_ac_power = 1 ; then
cat /sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
else
# possibly on battery
echo "30 30 20 14 9" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
fi
cat /sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
# polling du cd on
hal-disable-polling --enable-polling --device /dev/scd0   
# pas de powersave audio et wifi
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
echo 6 >  /sys/bus/pci/drivers/iwl4965/0000\:0c\:00.0/power_level
# vitesse cd au max
setcd -x max
# sata performance
echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host2/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host3/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host4/link_power_management_policy

# reglage memoire virtuelle
echo 60 > /proc/sys/vm/swappiness
echo 3000 > /proc/sys/vm/dirty_expire_centisecs
echo 30 > /proc/sys/vm/dirty_writeback_centisecs
echo 10 > /proc/sys/vm/dirty_background_ratio
echo 40 > /proc/sys/vm/dirty_ratio

# switch on bluetooth
#/etc/init.d/bluetooth restart
#dellWirelessCtl --sw_bt 1
#modprobe rfcomm
#modprobe l2cap
#modprobe bluetooth
#modprobe hci_usb
#hciconfig hci0 up
## switch on usb
modprobe ehci_hcd
modprobe uhci_hcd
# cam 
modprobe usbvision
modrobe uvcvideo
# si son système est stable, pas la peine de causer de nombreux
# réveils CPU avec la surveillance des "Non Maskable Interrupt".
# re-on
echo 1 > /proc/sys/kernel/nmi_watchdog
# driver lecteur de carte on
modprobe ricoh_mmc
#modprobe tifm_sd
# recharge module ethernet
modprobe tg3
# Power manager off
hdparm -B 255 -S 240 -M 254 /dev/sda
mount -o remount,commit=5 /
mount -o remount,commit=5 /home
#gestionnaire de fenetre par default
#metacity --replace
# demarrage des daemon
/etc/init.d/cupsys restart
/etc/init.d/cron restart
/etc/init.d/klogd restart
/etc/init.d/sysklogd restart
/etc/init.d/tor restart
/etc/init.d/privoxy restart
/etc/init.d/postfix restart
/etc/init.d/anacron restart
/etc/init.d/ntp restart
/etc/init.d/rsync restart
/etc/init.d/smartmontools restart
}


case $1 in
	*)
		zenity --question --title="Optimisation de l'autonomie" --text "Etes vous sur de vouloir baisser la puissance ?"
		if [ $? == 0 ]; then
		puissance_min
		icon
		puissance_max
		fi
		;;
	"--min")
		puissance_min
		icon
		;;
	"--max")
		puissance_max
		;;
esac
* Could you say me where I can buy a 9cellular battery cheaper

Last edited by atlas95; July 3rd, 2008 at 07:23 AM..
atlas95 is offline   Reply With Quote
Old July 3rd, 2008   #5
sdennie
Ubuntu Café con Leche
 
sdennie's Avatar
 
Join Date: Jan 2007
Location: Buenos Aires
Beans: 3,564
Ubuntu 8.04 Hardy Heron
Re: HOWTO: XPS m1330 power savings

Quote:
Originally Posted by sultanoswing View Post
Having implemented most of your above suggestions has reduced battery drain markedly (not objectively measured yet, but the bar is going down much more slowly).
Let me know what you find. I keep thinking I've forgotten something.

Quote:
EDIT: one tiny amendment to your guide - you mention saving the file as '99-savings.sh', yet then sudo install '99-savings'
Fixed, thanks.

Quote:
Originally Posted by atlas95 View Post
* Here my script for powersave my m1330 (sorry comment are in french and i don't remember all the tweak I have do)

If someone can help me to optimise it most, i run it with an icon, not automatically on plug on un-plug ac.
That looks good to me. The only thing I see that doesn't look right is that you have the nvidia commands backwards. You have the power savings nvidia commands in puissance_max and the reset to default commands in puissance_min.

Quote:
* Could you say me where I can buy a 9cellular battery cheaper
I'm not sure. I just ordered a 4 cell battery from Dell (they wouldn't sell me one at order time with an nvidia card in the laptop) and it was US$150 (more expensive than a 6 cell and about the same price as a 9 cell).
__________________
Don't try to make something "fast" until you are able to quantify "slow".
sdennie is offline   Reply With Quote
Old July 4th, 2008   #6
ajmorris
Fresh Brewed Ubuntu
 
ajmorris's Avatar
 
Join Date: Sep 2006
Location: Victoria, Australia
My beans are hidden!
Ubuntu Jaunty Jackalope (testing)
Send a message via AIM to ajmorris Send a message via MSN to ajmorris Send a message via Yahoo to ajmorris Send a message via Skype™ to ajmorris
Re: HOWTO: XPS m1330 power savings

very nice Vor, but if i may suggest a couple of things?:

increase the VM dirty writeback time from 5.00 to 15 seconds with:
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
This wakes the disk up less frequenty for background VM activity
-- You set yours to 60 seconds... i thought this was a bit too long, and found 15 to be nice, but to each their own

Enable the ondemand cpu speed governor for all processors via:
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
(you could do conservative if you really wanted to... i prefer it ondemand though...)

These get wiped upon a reboot, so they would want to be added to the script to be run at boot time.


Also, for anyone that compiles their own kernel (i believe these are on by default in the ubuntu kernel):

Enable the CONFIG_NO_HZ kernel configuration option.
This option is required to get any kind of longer sleep times in the CPU.

Enable the CONFIG_USB_SUSPEND kernel configuration option.
This option will automatically disable UHCI USB when not in use, and could
save someone about 1 Watt of power.


AJ
__________________
Want real-time help, away from the hustle and bustle of #ubuntu? Check out the beginners team IRC focus group IRC channel, ##beginners-help on irc.freenode.net
BeginnersAreaTeam

Please mark your threads, where applicable, as solved
HOWTO 'thank' useful posts.
Want to find out more about your ubuntu system? see HowTO Ubuntu System
Want to know a little more about networking? see HOWTO Ubuntu Networking
Looking for help with something on your ubuntu? see the tutorial of the week sticky


Last edited by ajmorris; July 4th, 2008 at 08:56 AM.. Reason: Fixed Typo
ajmorris is offline   Reply With Quote
Old July 4th, 2008   #7
sdennie
Ubuntu Café con Leche
 
sdennie's Avatar
 
Join Date: Jan 2007
Location: Buenos Aires
Beans: 3,564
Ubuntu 8.04 Hardy Heron
Re: HOWTO: XPS m1330 power savings

Quote:
Originally Posted by ajmorris View Post
very nice Vor, but if i may suggest a couple of things?:

increase the VM dirty writeback time from 5.00 to 15 seconds with:
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
This wakes the disk up less frequenty for background VM activity
-- You set yours to 60 seconds... i thought this was a bit too long, and found 15 to be nice, but to each their own
Actually, I set it to 60 seconds on AC and 10 minutes on battery. The 60 seconds on AC is to reduce disk activity a bit which seems to help keep the palm rest a bit cooler on this machine. The 10 minutes is to keep the disks in standby for long periods of time to help reduce power, heat and noise. Unfortunately, there is a bug in firefox 3 that causes to disk to wakeup every time firefox loads a page which more or less defeats putting the disk into standby. It's possible (but maybe slightly dangerous) to fix this bug and keep the disk suspended but, I would imagine that a proper fix will be out fairly soon.

Quote:
Enable the ondemand cpu speed governor for all processors via:
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
(you could do conservative if you really wanted to... i prefer it ondemand though...)
Yeah, I mentioned to run ondemand (which should be the default) but, I'll go ahead and explicitly put it into the script to make sure. Thanks.
__________________
Don't try to make something "fast" until you are able to quantify "slow".
sdennie is offline   Reply With Quote
Old July 4th, 2008   #8
tinivole
Should have gone to University
 
tinivole's Avatar
 
Join Date: Jan 2008
Location: UK
My beans are hidden!
Ubuntu 9.04 Jaunty Jackalope
Re: HOWTO: XPS m1330 power savings

Hey Vor, I somehow managed to drop 10W...

Went from 25.9 to 15.4W.

I'm still trying to figure out what I did. (Tried to implement everything as I tweaked, but I seem to have forgotten to puts some things in, and haven't quite managed to acheive it again, yet).

This is what I have so far (It's a mixture of yours plus a few addons).
Code:
#!/bin/bash
# Disable Wake on LAN and Reduce eth0 speed
  ethtool -s eth0 wol d
  ethtool -s eth0 speed 100 duplex half autoneg off
# Remove Other unnecessary modules
  hciconfig hci0 down
  MODULES="hci_usb rfcomm l2cap bluetooth usbhid uhci_hcd ehci_hcd i2c_algo_bit crc_ccitt joydev radeon serio_raw pcspkr i2c_i801 uvcvideo compat_ioctl32 videodev"
  for i in $MODULES
  do modprobe -r $i
  done
# Re-enable USB for those who need
  modprobe uhci_hcd
# Set Min Power to SATA Drives
  for i in /sys/class/scsi_host/*/link_power_management_policy
  do echo min_power > $i
  done
# Frequency Scaling = ondemand
  echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# Lower Power Level of Wireless
  echo 5 > /sys/bus/pci/drivers/iwl????/0000\:??\:00.0/power_level
  iwconfig wlan0 txpower 7
# Auto Suspend Unused USB Busses (Timeout in seconds)
  for i in /sys/bus/usb/devices/usb?/power/autosuspend
  do echo 1 > $i
  done
# auto = autosupend
  for i in /sys/bus/usb/devices/usb?/power/level
  do echo auto > $i
  done
# Low Soundcard Power Level
  echo 10 > /sys/module/snd_hda_intel/parameters/power_save
# Reduce Disk activity
  echo 10 > /proc/sys/vm/swappiness
  echo 0 > /proc/sys/vm/dirty_expire_centisecs
  echo 90 > /proc/sys/vm/dirty_ratio
  echo 1 > /proc/sys/vm/dirty_background_ratio
  echo 60000 > /proc/sys/vm/dirty_writeback_centisecs
# Laptop disk write mode
  echo 5 > /proc/sys/vm/laptop_mode
# Change mount commit
  mount -o remount,commit=600 /
# Separate partition needs separate command?
  mount -o remount,commit=600 /home
# Lowest HDPARM Values
  hdparm -B 1 -S 4 -M 128 /dev/sda
# Configure to use only one power core
  echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
# Stop unneccessary  services
  /etc/init.d/cron stop
  /etc/init.d/bluetooth stop
  /etc/init.d/preload stop
#  /etc/init.d/laptop-mode stop # Is this worth stopping?
# FINISH?
  echo FINISHED
Ooh, also.
Open up xorg.conf and put in the following section.
Code:
Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        Defaultdepth    24
        Option          "Coolbits"      "1"
EndSection
Then restart X, and open up "nvidia-settings", then go into "Clock Frequencies" and enable Overclocking...
You can now underclock your Nvidia Card and save a bit more energy

[EDIT]
Thank-you Vor for pointing out the "ondemand" over "conservative" power savings. It now drops to 14Watts again!!!

Regards
Iain

Last edited by tinivole; July 4th, 2008 at 01:55 PM..
tinivole is offline   Reply With Quote
Old July 6th, 2008   #9
var
5 Cups of Ubuntu
 
var's Avatar
 
Join Date: Aug 2005
Beans: 36
Ubuntu 7.10 Gutsy Gibbon
Re: HOWTO: XPS m1330 power savings

hi vor,

thanks for your guide: is it usable on a Dell XPS M1530?

thanks again. :)
__________________
Python-it.org - The Italian largest Python community
var is offline   Reply With Quote
Old July 6th, 2008   #10
sdennie
Ubuntu Café con Leche
 
sdennie's Avatar
 
Join Date: Jan 2007
Location: Buenos Aires
Beans: 3,564
Ubuntu 8.04 Hardy Heron
Re: HOWTO: XPS m1330 power savings

Quote:
Originally Posted by var View Post
hi vor,

thanks for your guide: is it usable on a Dell XPS M1530?

thanks again.
If I'm not mistaken, the m1530 is almost identical to the m1330 but slightly bigger. Most of the guide should work on an m1530 I think. It's certainly worth a try because it's very simple to undo/modify all the changes above.
__________________
Don't try to make something "fast" until you are able to quantify "slow".
sdennie is offline   Reply With Quote

Bookmarks

Tags
laptop battery, power consumption

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:36 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry