Powersaving rc.local ubuntu karmic/NC10

Discussions about Linux installation and configuration on Samsung laptops
Post Reply
cywhale
Newbie
Newbie
Posts: 9
Joined: 18 Feb 2010, 10:31

Powersaving rc.local ubuntu karmic/NC10

Post by cywhale »

Hello everybody,

just for everyone interested I post my /etc/rc.local optimized for powersaving with my NC10 \w Supertalent 64Gb SSD . I'm using the PHC-enabled kernel and Intel-PHC for cpu undervolting and a self-compiled iwlagn driver for the Intel 5100agn wifi card which is replacing the built-in atheros.

Estimated battery time right now: 80% battery, ~6:30h (screen dimmed to 1/8, compiz, firefox, mail, feedreader, wifi). Realistic usage time is about ~5:30-6:00h. Powertop minimum watt usage reported 6,9W.

Problem #1: Soundchip powersaving does not work, sound remains muted :(

Problem #2: Setting suspend mode for HSDPA modem to "auto" only seems to work by doing "by hand" in a terminal after gnome has been fully loaded, setting the mode in rc.local or /usr/lib/pm-utils/sleep.d does not work. Any help would be greatly appreciated.


Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# cpu voltage powersaving
echo "12:20 10:15 8:15 6:15" | tee /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
echo "12:20 10:15 8:15 6:15" | tee /sys/devices/system/cpu/cpu1/cpufreq/phc_controls

# wifi powersaving
iwconfig wlan0 power on

# laptop mode
echo 5 | tee /proc/sys/vm/laptop_mode
echo 1 | tee /sys/devices/system/cpu/sched_smt_power_savings

# drive polling
hal-disable-polling --device /dev/scd0

# disc usage
echo noop | tee /sys/block/sda/queue/scheduler
echo 1 | tee /proc/sys/vm/swappiness
echo 1500 | tee /proc/sys/vm/dirty_writeback_centisecs
echo 20 | tee /proc/sys/vm/dirty_ratio
echo 10 | tee /proc/sys/vm/dirty_background_ratio

#echo 10 | tee /sys/module/snd_hda_intel/parameters/power_save
# disabled since with this line there is no sound at all

# HSDPA
#echo "auto" | tee /sys/bus/usb/devices/1-7/power/level
# disabled since "auto" cannot be set via /etc/rc.local. Timing issue?

# Webam
echo "auto" | tee /sys/bus/usb/devices/1-8/power/level

for dir in apparmor apt ConsoleKit cups dist-upgrade fsck gdm installer news ntpstats samba unattended-upgrades ; do
    if [ ! -e /var/log/$dir ] ; then
        mkdir /var/log/$dir
    fi
done


for d in /sys/bus/usb/devices/* ; do
  	if [ -e "$d/power/autosuspend" ]; then
  	    	echo "0" > $d/power/autosuspend
  	fi
done
exit 0
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

Re: Powersaving rc.local ubuntu karmic/NC10

Post by voria »

Hello,
welcome to the forum and thanks for sharing these infos, they are really interesting. :)

In my opinion a better way to set almost all of the options you have in your rc.local is by using laptop-mode.
Doing so your problems with sound card and HSDPA modem should also be resolved.

To be more specific:
  • In '/etc/laptop-mode/laptop-mode.conf', set:

    Code: Select all

    LM_SECONDS_BEFORE_SYNC=5
    LM_DIRTY_RATIO=20
    LM_DIRTY_BACKGROUND_RATIO=10
    LM_BATT_MAX_LOST_WORK_SECONDS=15
    
    in substitution, respectively, of:

    Code: Select all

    echo 5 | tee /proc/sys/vm/laptop_mode
    echo 20 | tee /proc/sys/vm/dirty_ratio
    echo 10 | tee /proc/sys/vm/dirty_background_ratio
    echo 1500 | tee /proc/sys/vm/dirty_writeback_centisecs
    
  • In '/etc/laptop-mode/conf.d/sched-mc-power-savings.conf', set:

    Code: Select all

    CONTROL_SCHED_MC_POWER_SAVINGS=1
    in substitution of:

    Code: Select all

    echo 1 | tee /sys/devices/system/cpu/sched_smt_power_savings
  • In '/etc/laptop-mode/conf.d/hal-polling.conf', set:

    Code: Select all

    CONTROL_HAL_POLLING=1
    in substitution of:

    Code: Select all

    hal-disable-polling --device /dev/scd0
  • In '/etc/laptop-mode/conf.d/intel-hda-powersave.conf', set:

    Code: Select all

    CONTROL_INTEL_HDA_POWER=1
    in substitution of:

    Code: Select all

    #echo 10 | tee /sys/module/snd_hda_intel/parameters/power_save
    # disabled since with this line there is no sound at all
    
  • In '/etc/laptop-mode/conf.d/usb-autosuspend.conf', set:

    Code: Select all

    CONTROL_USB_AUTOSUSPEND=1
    in substitution of:

    Code: Select all

    # HSDPA
    #echo "auto" | tee /sys/bus/usb/devices/1-7/power/level
    # disabled since "auto" cannot be set via /etc/rc.local. Timing issue?
    
    # Webam
    echo "auto" | tee /sys/bus/usb/devices/1-8/power/level
    
    for d in /sys/bus/usb/devices/* ; do
         if [ -e "$d/power/autosuspend" ]; then
                echo "0" > $d/power/autosuspend
         fi
    done
    
In addition to these, laptop-mode has many other options that can be configured. Take a look at '/etc/laptop-mode/laptop-mode.conf' and at all the config files inside the directory '/etc/laptop-mode/conf.d/'.

Also, you can set the swappiness to 1 in '/etc/sysctl.conf', by adding at the end of the file:

Code: Select all

vm.swappiness = 1
Concerning the cpu undervolting, this is an interesting topic. :)
I'm building right now a new kernel with the PHC patch applied. If everything is ok, I will add it to the kernel on the repository too.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
cywhale
Newbie
Newbie
Posts: 9
Joined: 18 Feb 2010, 10:31

Re: Powersaving rc.local ubuntu karmic/NC10

Post by cywhale »

Thank you for the laptop-mode suggestions, I'll try that. On the other hand I like the idea of having all settings in one single file...

I tried the undervolting/PHC in order to maybe turn off the (annoying) fan more often but this did not work. The fan switches on/off for every ~10 minutes after using the NC10 for ~20 minutes from boot :(
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

Re: Powersaving rc.local ubuntu karmic/NC10

Post by voria »

cywhale wrote:Thank you for the laptop-mode suggestions, I'll try that. On the other hand I like the idea of having all settings in one single file...
The fact is, laptop-mode manages the various options dinamically, by changing them as needed. Instead, by setting them statically once only at boot, the changes may be lost after a while. For instance, if you connect an USB device when the system is already running, the autosuspend would not be enabled for that device.
cywhale wrote:I tried the undervolting/PHC in order to maybe turn off the (annoying) fan more often but this did not work. The fan switches on/off for every ~10 minutes after using the NC10 for ~20 minutes from boot :(
I don't know if this is normal, I rarely hear the fan noise from my NC10. But it might just be because I never paid much attention to it.
What about power consumption? Have you noticed any significant difference by using undervolt?
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

Re: Powersaving rc.local ubuntu karmic/NC10

Post by voria »

The new kernel with the PHC patch applied is on the repository now. :)
After some tests, I've found the better VIDs for my NC10:
24 16 15 15
defaults were:
39 31 23 15
When CPU is under heavy load, I've gained 0.5W, not bad. :)
I have to say, I'm impressed by your VIDs, they are very low... did you do some tests to check if the system is stable (expecially when working at 1.6GHz)?

Anyway, now my system reports 6:20h as battery time, with battery at 100%, screen dimmed to 1, wifi on, bluetooth on, compiz enabled (just for the record, the battery max capacity is at 88% after ~1 year of life).

Well, it's time to update the laptop-mode thread with more optimizations.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
cywhale
Newbie
Newbie
Posts: 9
Joined: 18 Feb 2010, 10:31

Re: Powersaving rc.local ubuntu karmic/NC10

Post by cywhale »

Nice :)

Well, I'm using those values for nearly the whole time since buying the NC10, never tested long-time 1,6Ghz cpu load but using them in my usual workflow (mail, browser, chat, image converting, moving files,... even once converting an avi movie with mencoder) never gave me a system freeze.

Does your kernel have any other NC10/Atom specific optimizations?
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

Re: Powersaving rc.local ubuntu karmic/NC10

Post by voria »

No, it just fixes the FN keys release problem on various netbook models, and a SATA freezing problem on Samsung N130/N140.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
euri
Newbie
Newbie
Posts: 3
Joined: 20 Feb 2010, 19:00

Re: Powersaving rc.local ubuntu karmic/NC10

Post by euri »

cywhale wrote: I tried the undervolting/PHC in order to maybe turn off the (annoying) fan more often but this did not work. The fan switches on/off for every ~10 minutes after using the NC10 for ~20 minutes from boot :(
Perhaps you can try easy-slow-down-manager from
http://code.google.com/p/easy-slow-down-manager/
But I don't know if it works.
cywhale
Newbie
Newbie
Posts: 9
Joined: 18 Feb 2010, 10:31

Re: Powersaving rc.local ubuntu karmic/NC10

Post by cywhale »

*wwwoooow* !!
Can't count the times I wished someone would develope a tool like this for Linux - and finally it happened.

Thank you very much for this link. Tried it a few moments ago (quick look at the source, installed linux-headers and the DEB) - module loaded , switched to silent-mode -> as I'm typing this my NC10 is silent, absolutely silent! I'll test this and report here... thank you very much (btw. a silent fan should give us some more battery time, shouldn't it?) :)
euri
Newbie
Newbie
Posts: 3
Joined: 20 Feb 2010, 19:00

Re: Powersaving rc.local ubuntu karmic/NC10

Post by euri »

No problem. I'm testing your PHC-settings at the moment under Arch Linux with modified kernel-netbook from AUR. There I also found the easy-slow-down-manager.
cywhale
Newbie
Newbie
Posts: 9
Joined: 18 Feb 2010, 10:31

Re: Powersaving rc.local ubuntu karmic/NC10

Post by cywhale »

Nice.
As in Windows the CPU temperature seems te be allowed to go up to 54°-55°, then the fan starts and brings temp back down to ~ 51°. Without this module fan triggering temp was about 45°C :)
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

Re: Powersaving rc.local ubuntu karmic/NC10

Post by voria »

Thank you for letting us know about easy-slow-down-manager. ;)

I've uploaded a custom package on the repository, containing this kernel module.
I think I'll rewrite the 'samsung-scripts' in order to use this new module, as soon as I can. :)
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
cywhale
Newbie
Newbie
Posts: 9
Joined: 18 Feb 2010, 10:31

Re: Powersaving rc.local ubuntu karmic/NC10

Post by cywhale »

Nice, using the NC10 from time to time since this morning I never heard the fan running, sensors applet says ~51°C. The big difference here was switching off Compiz/AWN and returning to Metacity/Gnome-Panel.

Edit: K, right now as I'm typing this the fan starts spinning :)
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

Re: Powersaving rc.local ubuntu karmic/NC10

Post by voria »

cywhale wrote:Thank you for the laptop-mode suggestions, I'll try that. On the other hand I like the idea of having all settings in one single file...
Just for the record, I've just added laptop-mode support to the new 'Samsung Tools' application I'm writing. My idea is to add support for all customizable settings (PHC/undervolt support too), in order to configure them from a centralized place, in a friendly way. :)
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
Post Reply