Bug 32582

Summary: coretemp:TjMax is assumed as 100 C
Product: Drivers Reporter: Hrvoje Senjan (hrvoje.senjan)
Component: Hardware MonitoringAssignee: Guenter Roeck (linux)
Status: RESOLVED CODE_FIX    
Severity: enhancement CC: florian, hrvoje.senjan, jdelvare, linux
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35 to 2.6.39 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 16055    

Description Hrvoje Senjan 2011-04-03 22:06:26 UTC
Since 2.6.35 kernel , coretemp driver assumes TjMax for Core2Duo T5800 (and maybe others) , but as stated on intel.ark , and official coretemp documentation TjMax for this model is 85 C.
Comment 1 Jean Delvare 2011-04-04 06:42:13 UTC
Is this a regression? Was the coretemp driver in kernel 2.6.34 and earlier properly setting TjMax to 85°C for your Core2 Duo T5800 CPU?
Comment 2 Hrvoje Senjan 2011-04-04 07:09:45 UTC
Yes , TjMax was set with 85 degrees , and since 2.6.35 kernels , it assumes it as 100 C. At first i thought that for some reason CPU got hotter with newer kernels , but then i read the documentation and saw that TjMax is incorectly set. Should i put an attachment with pre-.35 krenels , and >= .35 ?
Comment 3 Hrvoje Senjan 2011-04-04 07:13:19 UTC
Here is clearly stated that TjMax for C2Duo T800 is 85°C.
http://www.mjmwired.net/kernel/Documentation/hwmon/coretemp
http://ark.intel.com/Product.aspx?id=35581
Comment 4 Hrvoje Senjan 2011-04-26 11:17:40 UTC
(In reply to comment #3)
> Here is clearly stated that TjMax for C2Duo T800 is 85°C.
> http://www.mjmwired.net/kernel/Documentation/hwmon/coretemp
> http://ark.intel.com/Product.aspx?id=35581

C2Duo T5800
Comment 5 Guenter Roeck 2011-05-30 20:19:21 UTC
TjMax detection was updated in 2.6.35 to use the MSR_IA32_TEMPERATURE_TARGET register if available. If the register is not available, the code no longer adjusts TjMax unconditionally, but only for CPU families 0x17 (Core 2 Extreme and some Xeons)and 0x1c (Atom). Core 2 Duo is family 0xe or 0xf, thus TjMax is no longer adjusted for those CPUs.

Please try the driver at http://roeck-us.net/linux/drivers/coretemp/ and let me know if it fixes your problem. Note that it is based on the latest driver code in 3.0-rc1, so it might not compile on versions older than 2.6.35, and the output will be a bit different as well.
Comment 6 Hrvoje Senjan 2011-05-31 06:45:44 UTC
(In reply to comment #5)
> TjMax detection was updated in 2.6.35 to use the MSR_IA32_TEMPERATURE_TARGET
> register if available. If the register is not available, the code no longer
> adjusts TjMax unconditionally, but only for CPU families 0x17 (Core 2 Extreme
> and some Xeons)and 0x1c (Atom). Core 2 Duo is family 0xe or 0xf, thus TjMax
> is
> no longer adjusted for those CPUs.
> 
> Please try the driver at http://roeck-us.net/linux/drivers/coretemp/ and let
> me
> know if it fixes your problem. Note that it is based on the latest driver
> code
> in 3.0-rc1, so it might not compile on versions older than 2.6.35, and the
> output will be a bit different as well.

This works as it should! 
Core 0:       +58.0°C  (high = +85.0°C, crit = +85.0°C)
Compiled against 2.6.38.7.
Thanks!
Comment 7 Hrvoje Senjan 2011-05-31 08:24:20 UTC
Will this go into mainline?
Comment 8 Guenter Roeck 2011-05-31 13:48:41 UTC
At some point yes. I'll have to make sure that the fix doesn't break something else, though - maybe there was a reason for excluding Core 2 Duo CPUs from temperature adjustment.
Comment 9 Florian Mickler 2011-06-06 10:57:16 UTC
A patch referencing this bug report has been merged in v3.0-rc2:

commit 4f5f71a7abe329bdad81ee6a8e4545054a7cc30a
Author: Guenter Roeck <guenter.roeck@ericsson.com>
Date:   Tue May 31 06:54:21 2011 -0700

    hwmon: (coretemp) Fix TjMax detection for older CPUs
Comment 10 Guenter Roeck 2011-06-06 13:55:34 UTC
Patch should hopefully make its way into 2.6.35 and 2.6.39. Its final version (or, rather, the resulting driver) is also available at the link provided earlier.