Page 2 of 4

Re: lm_sensors on Fit-PC2

Posted: Tue Nov 10, 2009 9:36 am
by gjrussell
Thanks ... the smartctl command works also ... the hdd temp hit 51C today, I've
now put 2 cpu heatsinks on the top and they have cut the temp down a few degrees.
It was 39C in the shade here today and my aircon is a little under engineered :)

Re: lm_sensors on Fit-PC2

Posted: Wed Jan 13, 2010 2:00 am
by prj
Hi Denis, I've managed to get the CPU temp by reading MSR 0x19c

Do you know the correct Tj_max for the CPU? I assume it is 90C but that gives me a much lower temperatures than your script does (~10-15C lower).

This is what I did on a vanilla Ubuntu 9.10 server install:
sudo apt-get install msr-tools
sudo modprobe msr
sudo rdmsr --processor 0 --decimal --bitfield 22:16 0x19c

The bits 22:16 are the "Digital readout" on MSR IA32_THERM_STATUS. This is then subtracted from Tj_max to give the actual temperature. I also found that support for reading the temp on Atom CPUs are included in kernel 2.6.32 through the coretemp driver.

Thanks

Re: lm_sensors on Fit-PC2

Posted: Wed Jan 13, 2010 2:03 am
by prj
Here is a script for reading the temperature

Code: Select all

#!/bin/bash
TJ_MAX=90

if [ $EUID -ne 0 ]; then
        echo "This script must be run as a root user"
        exit 1
fi

if  [ ! -x /usr/sbin/rdmsr ]; then
    echo You need msr-tools to run this script.
        exit 1
fi

n=`/sbin/lsmod | grep -c "msr"`
if [ ! $n -gt 0 ]; then
        echo Kernel module msr must be loaded before running this script.
        echo Load with: sudo modprobe msr
        exit 1
fi

READOUT=`rdmsr --processor 0 --unsigned --bitfield 22:16 0x19c`
let TEMP=$TJ_MAX-$READOUT
echo $TEMP
Edit 2010-01-14: Fixed signed decimal bug

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 9:43 am
by PieterPan
I tried it, but it returns 100, while the temperature is <= 50 degrees Celsius. (cannot measure accurately with other script from this thread).

I would like to see the value below 50, even if it is less accurate.

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 11:25 am
by prj
That is strange. In that case you are getting a reading from MSR that is -10C, since 90-(-10)=100. Can you tell me the Ubuntu version you are running, the version of msr-tools and your BIOS version. Can you also tell me what you get when running:

Code: Select all

rdmsr --processor 0 --decimal --bitfield 22:16 0x19c
My specs:
  • msr-tools is 1.1.2
  • Ubuntu version 9.10 server
  • BIOS 23 Dec 2009
  • Underclocked to 75%

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 12:53 pm
by prj
I've found the problem. The --decimal parameter for rdmsr gives the value in signed decimal. Instead you should use the --unsigned parameter. The bit pattern you got was 111011 which as an unsigned integer gives 59. Hence your system temp was 90-59=31 Celcius.

I've updated the script above to fix this.

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 3:17 pm
by PieterPan
Thanks for your replies, but we're not quite there yet. I now get 15 degrees, while my harddrive is 30. :)

rdmsr --processor 0 --decimal --bitfield 22:16 0x19c
-11

uname -a
Linux servertje 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:01:29 UTC 2009 i686 GNU/Linux

rdmsr --version
rdmsr: version msr-tools-1.1.2

Bios: I think before, at least no overclock options. I don't have physical access to it now.
Not under or overclocked.

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 3:31 pm
by prj
Did you try the updated version of the script?
-11 signed = 53 unsigned so your temp is 90-53=37 C

Note the change I did:

rdmsr --processor 0 --unsigned --bitfield 22:16 0x19c

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 5:22 pm
by PieterPan
Hmm, I thought I did, but I did copy the wrong line in the reply. I now get 28/29 degrees for the cpu while the harddrive is at 38. It is possible, but I would have thought both temperatures to be closer. I will have to wrap up the fit-pc in order to make the CPU temps go above 50 to verify with the other script :)
Maybe the wrong TJmax, or the low reliability of the cpu temp sensor below 50?

This is my setup, with a big heatsink (no fan) on the hdd and a smaller on the cpu side.
http://www.fit-pc2.com/forum/viewtopic. ... =hot#p4419

Re: lm_sensors on Fit-PC2

Posted: Thu Jan 14, 2010 7:12 pm
by prj
Nice mod :)

I've done some measuring on my unit and my numbers seems to make sense. The HD is warmer than the CPU but that is not unusual. In your case it could be that the CPU temp is much lower than the HD if the HD doesn't transfer the heat to the case. Your heatsinks obviously work fine.

I've measured the case surface temp and it pretty much follows the CPU temp from my script at different loads. More testing is needed but from the looks of it the readings from the other script (that pretty much says 59-60 C all the time no matter what my CPU load is) is wrong.

Denis, if you read this, could you please explain how you are getting the temperature in your script. I cannot find any documentation on where you read it from and how it is calculated. Thanks.