Yet Another Blog

April 27, 2011

nVidia PowerMizer on Linux

Filed under: computer, linux, Software — Tags: , , , , , , — guilleml @ 11:20 pm

Nvidia settings panel has a tab called powermizer where you can set a power policy. It will change Graphics Clock, Memory Clock and Processor Clock depending on the system graphics load.

First get what modes do your card and driver support:

nvidia-settings -q GPUPerfModes -t

perf=0, nvclock=50, memclock=135, processorclock=101 ; perf=1, nvclock=405, memclock=324, processorclock=810 ; perf=2, nvclock=405,
memclock=1800, processorclock=810 ; perf=3, nvclock=715, memclock=1800, processorclock=1430

I have 4 levels, 0, 1, 2 and 3. 0 is the one I want to set as it sets the clocks to the lower frequency.

If you want to set it to a powersave mode with no scaling you can do it by editing /etc/X11/xorg.conf like this:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
Option  "Coolbits" "1"
 Option  "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerLevel=0x3; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3"
EndSection
 
"PowerMizerEnable=0x1;

enables PowerMizer feature (0×0 would disable it instead). This entry may not be needed since in recent driver versions PowerMizer is enabled by default.

PerfLevelSrc=0x2222;

sets the governor approach. 0×2222 means fixed frequencies for both battery and AC mode.

PowerMizerLevel=0x3;

sets the current mode. 0×3 is the lowest, least power intensive mode.

PowerMizerDefault=0x3;

sets the default level on battery. 0×3 is the lowest, least power intensive mode.

PowerMizerDefaultAC=0x3"

sets the default level while with an AC plug. 0×3 is the lowest, least power intensive mode.

Sources: http://linux.aldeby.org/nvidia-powermizer-powersaving.html

http://tutanhamon.com.ua/technovodstvo/NVIDIA-UNIX-driver/

September 9, 2008

Increase battery life in your linux laptop

Filed under: computer, hacks, linux, Software — Tags: , , , , , , , , , — guilleml @ 7:10 pm

Recently I’ve bought a laptop, Dell Inspiron 1525 with a T5750@2Ghz and a 9 cell battery.

I installed KDE4, plasma, desktop effects…it’s cool, really cool,  but then I discovered powertop, a tool that is able to recommend some settings to make  your CPU to awake less times every second. The tools shows yo a list of the tasks that are awaking the CPU so you can try to get a more power-efficent system.

It recomends you some actions to take, you just accept or not them, as set the SATA bus in low-power mode, USB autosuspend, set ondemand cpu freq governor, delay writing to the hard disc, etc…

I noted KDE4 is cool but not when you’re using the battery so I installed fluxbox and XFCE, both are nice, XFCE seems to wake up less the CPU, then I started to look for scripts and patchs to waste less energy.

So here are the tuning I’ve done to my laptop:

From http://ubuntuforums.org/showthread.php?t=847773

#!/bin/bash

# Go fast on AC power.  Similar to default Ubuntu settings
if on_ac_power; then
# Set the drive to mostly stay awake
hdparm -B254 -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 /media/sda3

# 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/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

# 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.  Note: Currently Firefox is very poorly behaved and some
# might find these settings too aggressive.  If so, change “-S 4” to
# something larger like -S 24 (two minutes).
hdparm -B180  /dev/sda

#set the LCD bright to 60%

echo 60 > /proc/acpi/video/VID/LCD/brightness

# 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
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

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

# Remove the webcam driver
modprobe -r uvcvideo
modprobe -r sbp2
modprobe -r ieee1394
modprobe -r uvcvideo
modprobe -r videodev
modprobe -r v4l1_compat
modprobe -r compat_ioctl32
modprobe -r v4l2_common
fi

The script is commented, I only changed a few things from the original, it works fine, some drivers are able to set the hardware in low-power mode but it seems they don’t do by default, GNU/Linux seems to have to polish laptop distributions.

Powertop shows you the watts you’re currently using when the laptop is not connected to the AC, so I played with phc to undervolt the CPU, now I’m able to use less power for the CPU, this doesn’t decrease the performance.

You can use this tutorial http://ubuntuforums.org/showthread.php?t=786402 to get a kernel able to undervolt the cpu, you just have to replace a module.

My original settings are:

43 35 27 19

Now they are:

24 1 1 1

Powertop shows the laptop uses less energy now and the cpu is colder at high load.

Create a free website or blog at WordPress.com.