Sunday, 3 July 2011

Dell Studio 1558 fan problems

So we have a dell studio 1558. It's a beast of a laptop, quad core, radeon hd 5400, and in windows land can play quite a few games at a respectable fps.

Now therein lies the problem - this is one hell of a power hungry laptop

The Debian install has been a bit of a nightmare: the fan was on all the time, frequent hard lockups especially when on battery power and add to that the flaky broadcom wifi drivers. It has been an interesting year with this beast.

The only stable configuration seemed to be to run the laptop with the closed source fglrx and leave the laptop plugged into the wall. Anything else was tempting fate.

Recently kernel 2.6.39 hitting testing I though I would try the open source radeon KMS drivers. Last time there was no power control so the gpu was running hot so the fan was always flat out. Installing the flgrx drivers fixed the overheating problem, but the laptop was still quite flakey.

I uninstalled the fglrx drivers and enabled KMS by changing /ect/modprobe.d/radeon-kms.conf to:
options radeon modeset=1


I rebooted and once again got the dreaded maxed out fan. This time I knew it was most probably the kernel running the gpu at maximum speed. A quick look at the following (mount -t debugfs debugfs /sys/kernel/debug/,cat /sys/kernel/debug/dri/0/radeon_pm_info) showed:

default engine clock: 750000 kHz
current engine clock: 750000 kHz
default memory clock: 800000 kHz
current memory clock: 800000 kHz
voltage: 900 mV
PCIE lanes: 16

The gpu was running flat out. A quick google later gave me the following commands to stick into my rc.local:
echo profile > /sys/class/drm/card0/device/power_method
echo low > /sys/class/drm/card0/device/power_profile
Now cat /sys/kernel/debug/dri/0/radeon_pm_info gives:
default engine clock: 750000 kHz
current engine clock: 156990 kHz
default memory clock: 800000 kHz
current memory clock: 199960 kHz
voltage: 900 mV
PCIE lanes: 16
Now the computer seems to be running a lot cooler - I have yet to get it to crash on battery power and if I do have any problems I will hopefully get some help. I did a quick test with fullscreen flash video and there was no significant screen fps problems to hopefully the majority of our problems with this machine are over.

I'm going to do a bit more googling to see if I can reduce the number of PCIE lanes or even the voltage but for the time being at least I have a useable laptop.

The only unsolvable problem seems to be if I try and change the brightness too quickly I get a total crash....

Saturday, 2 July 2011

Replacing a hard drive on my QNAP debian install

My replacement drive arrived - time to add it to the existing raid. From my exisiting hard drive I get the following output:

Partition Table: gpt
Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  3000MB  3000MB               Root  raid
 2      3000MB  4000MB  1000MB               Var   raid
 3      4000MB  4512MB  512MB                Swap  raid
 4      4512MB  2000GB  1996GB               Data  raid
Here are the commands I issued in parted:
mktable gpt
mkpart Root 17.4kB 3000MB
toggle 1 raid true
mkpart Var 3000MB 4000MB
toggle 2 raid true
mkpart Swap 4000MB 4512MB
toggle 3 raid true
mkpart Data 4512MB 100%
toggle 4 raid true
To add the partitions to the existing, degraded arrays you have to first drop the old drive and add the new one using mdadm. Double check which drive you are replacing and type the following:
mdadm /dev/md0 --fail /dev/sdb1 --remove /dev/sdb1
mdadm --manage --add /dev/md0 /dev/sdb1
mdadm /dev/md1 --fail /dev/sdb2 --remove /dev/sdb2
mdadm --manage --add /dev/md1 /dev/sdb2
mdadm /dev/md2 --fail /dev/sdb3 --remove /dev/sdb3
mdadm --manage --add /dev/md2 /dev/sdb3
mdadm /dev/md3 --fail /dev/sdb4 --remove /dev/sdb4
mdadm --manage --add /dev/md3 /dev/sdb4
I found that for some reason the /dev/md2 (swap partition) didn't seem to be happy - so I totally deleted /dev/md2: and created a new one from scratch
swapoff /dev/md2
mdadm --stop /dev/md2
mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3
mkswap /dev/md2
swapon /dev/md2
I used the new UUID information to alter the /etc/fstab info to amke sure swap came on every reboot.