Tuesday, January 15, 2008

Little tweak here and there

I am unfortunate that I own a hard disk (Hitachi HTS722012K9SA00) that had a too aggressive power management. See https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/59695 for details.

I tried different settings of "hdparm -B" and have observed the following:

127 - spins down and parks the head
128 to 191 - parks the head
192 to 255 - never parks the head

I have also observed that when the 6910p is on battery it does not keep on unparking the head. It seems that the best settings in battery is the default 128. I am now using 128 as the apm value when on battery. I have also added a script "/etc/acpi/resume.d/99-fix-hd.sh" as it seems "/etc/acpi/power.sh" will set never call "hdparm -B" as the power has never changed state when the laptop resumes. My 99-fix-hd.sh contains the following:


#!/bin/sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

for x in /proc/acpi/ac_adapter/*; do
grep -q off-line $x/state

if [ $? = 0 ] && [ x$1 != xstop ]; then
if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
$HDPARM -S $SPINDOWN_TIME /dev/sda 2>/dev/null
$HDPARM -B 128 /dev/sda 2>/dev/null
fi
else
if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
$HDPARM -S 0 /dev/sda 2>/dev/null
$HDPARM -B 254 /dev/sda 2>/dev/null
fi
fi
done


For the past 2 days my 6910p wireless seems to be disconnecting. I am not sure if my wireless is getting interference from another AP or not, as this has happened to my other laptops before. I haven't seen this problem from the 6910p for a few weeks or my old nx8220. I have also changed my WRT54G firmware from thibor to tomato firmware for the past few days. Maybe the tomato firmware is causing the problem, but I doubt it so I decided to upgrade my iwlwifi from 1.2.22 to 1.2.23 and mac80211 from 10.0.2 to 10.0.4. So far it looks alright after several hours of use. I have to wait a few more hours, as it it happened for the past few days near midnight... maybe there is something happening to the 2.4ghz rf during that time in our neighborhood.

I am also trying to look at my power draw with the help of powertop from intel. Not sure how much I can save with the tweaks... still playing with it.

3 comments:

mizu said...

Hi,

I just searched around for powersaving tipps and found this:

http://samwel.tk/laptop_mode

I just removed laptop-mode-tools from Ubuntu (Hardy) and installed the deb pkg from this site. It has far more options than the one packaged with Ubuntu (an outdated one, I guess).

It can switch on/off BT, HAL polling of the CD, powersave the Wifi, and so on. I clearly can see the power usage differences between the to pkg-s with powertop.

And one more suggestion from powertop for SATA disks:
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy

max_performance on AC.

Anyway, thanks for your blog, it helped me a lot! cheers.

Duru Can Celasun said...

Do you explicitly call this script (99-fix-hd.sh) everytime you plug/unplug the AC or is it automagically called by /etc/acpi/power.sh?

Jun Yamog said...

It called every time by power.sh if you are on Gutsy. This has changed on Hardy, as Hardy uses pm-utils. My acer guide explains this more in the hard disk power management section.

http://jkyamog.blogspot.com/2008/07/acer-aspire-4315-short-review-and.html