Temperature monitoring / coretemp config

  • Hello everyone!

    I'm using a modded Xeon L5420 for my home pfSense box - everything's fine, with a very small exception - temperature monitoring. While most Intel CPUs have a usual TJMax of around 100C [or 85C for the newer ones], this Xeon should be at 70C - this makes all the temperature reporting useless.

    Right now it's reporting between 65 and 72C on all cores, while everything is cold to the touch.

    So, the question is: how can I modify the TJMax for the coretemp driver? Where's the config file?

    I just checked the current tjmax and here's what I get:

    sysctl -a | grep tjmax
    dev.cpu.0.coretemp.tjmax: 105.0C
    dev.cpu.1.coretemp.tjmax: 105.0C
    dev.cpu.2.coretemp.tjmax: 105.0C
    dev.cpu.3.coretemp.tjmax: 105.0C

    If the machine was in a cool datacenter, I wouldn't care about temp monitoring, but it's in my home, it gets really hot in summer, so I want to get a reliable reading.

    Any idea on how to configure the TJMax in the coretemp driver? Thanks!

  • Netgate Administrator

    Isn't that data handed to the OS via ACPI? That would explain why it's so far out if you're using a modified CPU. What does the  BIOS/OS think the CPU is?


  • Not really, since using the coretemp driver goes directly to the CPU sensor. The ACPI variant should go through the BIOS [which shows the proper temps, around 42-43], but instead shows the same thing as coretemp.

    The BIOS can see the CPU properly, as an Intel Xeon L5420, FSB1333, 12MB cache, 2.5GHz. I added the microcodes to the BIOS, just to make sure. pfSense can see it properly as well.

    As far as I know the temperature is calculated as TJmax - sensor_value = TempC

    So, it all comes down to configuring coretemp properly. Sysctl shows the current TJmax value [105C] and I need to modify that [70C].

    Unfortunately, I don't know where to search for the coretemp config and my BSD skills are pretty much non existent…

  • Netgate Administrator

    Can you modify the sysctl directly? Maybe at boot time.

    Edit: Doesn't look like you can. Also the value for tjmax appears to be hard coded in the coretemp driver.

    Edit: In fact 105°C must be being read from the MSR. Even in recent versions there is no other way to see it:


  • So, the solution would be to modify the coretemp sources and recompile? If that's the case, I'll give up :D

  • Netgate Administrator

    Yes.  ::)
    Though might not too tricky. The code exists in Linux already so would mostly be copy and paste.


  • Netgate Administrator

    Alternative suggestion:
    Mod the dashboard code that shows the temp to remove 35°C.


  • Sorry to bring up a old thread but I have the  same situation with a L5420.

    If someone could point me in the right direction to get all the source for coretemp to recompile, or which pfsense file to mod to update the dash it would be appreciated

    Thank you.

  • Netgate Administrator

    The value of 70 for tjmax should be read from the MSR in your CPU. It looks like the mod required to get this working prevents that. You could add an exception case like those already present in the driver for your CPU. Look at the code I linked to earlier, here we see an exception case for mobile Core2duos:

    else if (cpu_model == 0x17) {
     	switch (cpu_stepping) {
     	case 0x6: /* Mobile Core 2 Duo */
     	sc->sc_tjmax = 105;
     	default: /* Unknown stepping */

    You need to determine the cpu_model and stepping values for your CPU and add a extra case to the coretemp driver.

    If you choose to modify the dash instead there are a number of posts here explaining how to enable the coretemp output (before it was included by default) that show which files need to be modified.
    For example: https://forum.pfsense.org/index.php?topic=52301.0


  • Stephenw:

    Thanks for the info, I think the BIOS doesn't see the chip as a low voltage xeon and instead shows it as a core2 (But then again it runs the fans at the lowest so it must be seeing the right temps), might be a microcode issue but I don't really feel comfortable messing with the microcode in the BIOS, so I'll stick to creating the exception.

    I'm used to compiling for windows rather then FreeBSD so still trying to work through it all, finally got the source from the SVN site, will hopefully make the changes…. then figure out what to do

    It's Model 17, Stepping 10 for the exemption

    Edit: I've given up on compiling it, not familiar enough with FreeBSD to correct it, even the source from the SVN and DVD doesn't compile, the include references are missing references which I'm not familiar enough to find, so unless I can find a source branch that will compile correctly before changes are made I'm just not familiar enough

  • Netgate Administrator

    Even if it's seeing the temperatures as 35 degrees too high it may still be below the target temperature as long as it's running the correct voltage. Hence the fans still run slow. You'd only really notice when some significant load was placed on the system.
    Interestingly the original poster here said that his BIOS reported the correct CPU temperatures in the hardware monitor, does yours?

    It should be easy enough to modify the dashboard code if you want to do that. Just add a '-35' somewhere in the get_temp() function in /usr/local/www/includes/functions.inc.php.

    Compiling modules for FreeBSD is easy enough if you start with a clean install, at least in my experience. Simply go to the source directory for whatever module you're wanting, modify the code, type 'make'. Kernel module appears in the appropriate directory (not the same one!).


  • I haven't checked the bios as I don't have a reliable RJ45 to console cable, my rigged one let me do the install but the firewall is away from any other machine right now.

    I've modified the dash, that was easy enough, I'll try the make on a clean install, I've tried CC but it failed to compile, that may have been why.


Log in to reply