kern/171410: [coretemp] [patch] add support for Atom E6xx and add
tunable coretemp.tjmax
Noralf Tronnes
notro at tronnes.org
Fri Sep 7 12:00:14 UTC 2012
>Number: 171410
>Category: kern
>Synopsis: [coretemp] [patch] add support for Atom E6xx and add tunable coretemp.tjmax
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Sep 07 12:00:13 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Noralf Tronnes
>Release: 9.0-RELEASE
>Organization:
>Environment:
FreeBSD coretemp2 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root at obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
coretemp reports the wrong temperature on Intel Atom E6xx.
This is because coretemp does not recognize the CPU:
CPU: Genuine Intel(R) CPU @ 1.00GHz (1000.02-MHz 686-class CPU)
Origin = "GenuineIntel" Id = 0x20661 Family = 6 Model = 26 Stepping = 1
The Atom E6xx series has a TjMax of either 110 (extended temp version) or 90 (commercial version) degrees celcius.
Patch coretemp.c
- Add support for the Atom E6xx commercial temperature version
- Add a solution for users with CPUs not supported by coretemp with regards to TjMax.
The solution is by implementing a tunable: coretemp.tjmax
Patch coretemp.4
- ENVIRONMENT add info about tunable
- BUGS add note about TjMax could be wrong on Atom's that are not supported yet
>How-To-Repeat:
# kldload coretemp
coretemp0: <CPU On-Die Thermal Sensors> on cpu0
coretemp0: Can not get Tj(target) from your CPU, using 100C.
# sysctl -n dev.cpu.0.coretemp.tjmax
100.0C
>Fix:
Apply patches
Patch for: $FreeBSD: release/9.0.0/sys/dev/coretemp/coretemp.c 225662 2011-09-19 10:58:30Z attilio $
--- coretemp.c.org 2012-01-03 04:26:36.000000000 +0100
+++ coretemp.c 2012-09-07 12:34:33.000000000 +0200
@@ -154,6 +154,7 @@
uint64_t msr;
int cpu_model, cpu_stepping;
int ret, tjtarget;
+ static int force_tjmax = 0;
struct sysctl_oid *oid;
struct sysctl_ctx_list *ctx;
@@ -199,7 +200,13 @@
*/
sc->sc_tjmax = 100;
- if ((cpu_model == 0xf && cpu_stepping >= 2) || cpu_model == 0xe) {
+ // See if user has forced tjmax
+ TUNABLE_INT("coretemp.tjmax", &force_tjmax);
+
+ if (force_tjmax > 0) {
+ sc->sc_tjmax = force_tjmax;
+ device_printf(dev, "TjMax=%d forced by user\n", force_tjmax);
+ } else if ((cpu_model == 0xf && cpu_stepping >= 2) || cpu_model == 0xe) {
/*
* On some Core 2 CPUs, there's an undocumented MSR that
* can tell us if Tj(max) is 100 or 85.
@@ -227,6 +234,8 @@
sc->sc_tjmax = 90;
break;
}
+ } else if (cpu_model == 0x26) {
+ sc->sc_tjmax = 90; /* Atom E6xx series */
} else {
/*
* Attempt to get Tj(max) from MSR IA32_TEMPERATURE_TARGET.
Patch for: $FreeBSD: release/9.0.0/share/man/man4/coretemp.4 222176 2011-05-22 14:03:30Z uqs $
--- coretemp.4.org 2012-01-03 04:25:37.000000000 +0100
+++ coretemp.4 2012-09-07 13:36:22.000000000 +0200
@@ -56,8 +56,14 @@
driver reports each core's temperature through a sysctl node in the
corresponding CPU device's sysctl tree, named
.Va dev.cpu.%d.temperature .
+.Sh ENVIRONMENT
+For CPUs not properly detected by
+.Nm
+TjMax can be forced with kernel environment variable
+.Va coretemp.tjmax .
.Sh SEE ALSO
.Xr sysctl 8
+.Xr kenv 1
.Sh HISTORY
The
.Nm
@@ -72,3 +78,7 @@
as part of a Google Summer of Code project.
This manual page was written by
.An Dag-Erling Sm\(/orgrav Aq des at FreeBSD.org .
+.Sh BUGS
+The Intel Atom CPUs have no register for TjMax. This can lead to a wrong value on Atom's that are not supported by
+.Nm
+yet.
# kldload coretemp
coretemp0: <CPU On-Die Thermal Sensors> on cpu0
# sysctl -n dev.cpu.0.coretemp.tjmax
90.0C
# kenv coretemp.tjmax=110
# kldload coretemp
coretemp0: <CPU On-Die Thermal Sensors> on cpu0
coretemp0: TjMax=110 forced by user
# sysctl -n dev.cpu.0.coretemp.tjmax
110.0C
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list