fedora linux overheat problem on sony vaio 

I have a Sony VAIO S laptop, with Intel i7 CPU and Radeon Graphics. I bought this pretty in the summer of 2012 when I was on a very well-paid internship at @WalmartLabs, CA. At the time I just started the job and was unsatisfied with a given MacBook Pro. My main complaint was the Apple keyboard places the function key at the left bottom corner where the control button usually is. This posts major problem for me since I’m a heavy command-line and vim user, all the muscle memory has already been wired in my both hands. And if you are about to type more than 1000 lines of code, it’s not so pleasant to have to hustle with the typing habit first.

So I bought a Sony VAIO, and loaded it with Fedora 17. The installation goes through nice and smooth like a charm. However, once I start typing or browsing the web for a few minutes, the fan starts blowing like a turbine and my wrists just can’t even bear the heat on the surface.

Measure the Temperature

I notice that it’s not totally my fan’s fault. It’s running up and down with varied speed, responding to hardware heating well enough. The temperature sensor tool that I use is lm_sensors. It gives a temperature reading for my CPU, graphic card and motherboard.

$ sudo yum install lm_sensors   # Install lm_sensors package
$ sensors-detect                # Detect available sensors
$ sensors                       # Get sensor readings

With light web browsing on Google Chrome, I got

$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +67.0°C (crit = +97.0°C)

radeon-pci-0100   # Radeon graphics card
Adapter: PCI adapter
temp1: +68.0°C (crit = +100.0°C)

coretemp-isa-0000   # CPU
Adapter: ISA adapter
Physical id 0:+67.0°C (high = +86.0°C, crit = +100.0°C)
Core 0: +68.0° (high = +86.0°C, crit = +100.0°C)
Core 1: +66.0°C (high = +86.0°C, crit = +100.0°C)

68°C is very very hot. Resting on your hands on the keyboard feels like grilling your wrists.

Turn off the Graphics Card

My first suspect to the overheating issue is the graphics card. Since Radeon’s graphics cards have long been known for poor linux support and hard to tame under the open source drivers, I am thinking about simply turning off the Radoen graphics card module from the Linux kernel. If it’s the graphics card that causes the heating on mother board, then I should see some dropping of temperature after disabling it.

Turning off the graphic card can be done in linux with the following shell commands:

$ modprobe radeon
$ chown -R $USER:$USER /sys/kernel/debug
# Turn off the Radeon graphics card
$ echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

Now the Radeon graphic card is turned off. It can be verified as:

$ cat /sys/kernel/debug/vgaswitcheroo/switch
# External Graphics card is turned off
0:DIS: :<strong>Off</strong>:0000:01:00.0     
# Intel graphics is on
1:IGD:+:Pwr:0000:00:02.0   

I shut down the computer, let it sit for a while to cool down to room temperature, and reboot again. Immediately after reboot I run the above commands to turn off the graphic card. I immediately notice the fan speed starts to wind down, and after some Chrome web browsing, here is a sample sensor reading:

$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +47.0°C (crit = +97.0°C)

radeon-pci-0100
Adapter: PCI adapter
temp1: -128.0°C  # Negative, because it's turned off!

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +50.0°C (high = +86.0°C, crit = +100.0°C)
Core 0: +48.0°C (high = +86.0°C, crit = +100.0°C)
Core 1: +50.0°C (high = +86.0°C, crit = +100.0°C)

It’s about 25% reduction on temperature! So the graphic card is really contributing to the overheating. Now I still notice some warming on the surface of the keyboard, but at least it’s not like the surface of the Sahara Desert anymore. Fan is tamed, and the battery is not drained as fast before. Good start.

Automation

Whatever we have achieved above doesn’t repeat after reboot. Before finding a way to further reduce the temperature, I find turning off the graphic card useful enough to automate this task at Fedora startup. Anyway I would always boot into Windows when I need to stream video on Hulu or Youtube. So here is how you do it: put the corresponding set of shell commands (which turns off the graphics card, as listed in the previous section) into /etc/rc.local, which is a system service that will automatically run the shell commands it contains at boot time. Remember to make the rc.local file executable afterwards.
/etc/rc.local

#!/usr/bin/bash
modprobe radeon
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

The next step is to enable the rc.local service. If you already have /etc/systemd/system/rc-local.service, enable and start it by

$ sudo systemctl enable rc-local.service
$ sudo systemctl start rc-local.service
# Check that rc.local service is indeed enabled and active
$ sudo systemctl status rc-local.service 
rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/etc/systemd/system/rc-local.service; enabled)
Active: active (exited) since XXX; XXX ago

If you don’t have /etc/systemd/system/rc-local.service, here is a good copy of it from my own Fedora, use it at your own risk 🙂

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

-Sam Zhao

Update
This solution also seems to prolong the battery life of my laptop quite significantly, from average 2 hours before to 4.5 hours now with web browsing and youtubing. Sweet.

Advertisements