Bug 171410 - [coretemp] [patch] add support for Atom E6xx and add tunable coretemp.tjmax
Summary: [coretemp] [patch] add support for Atom E6xx and add tunable coretemp.tjmax
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-07 13:00 UTC by Noralf Tronnes
Modified: 2018-05-20 23:53 UTC (History)
3 users (show)

See Also:


Attachments
file.diff (749 bytes, patch)
2012-09-07 13:00 UTC, Noralf Tronnes
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Noralf Tronnes 2012-09-07 13:00:13 UTC
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

Fix: Apply patches

Patch for: $FreeBSD: release/9.0.0/sys/dev/coretemp/coretemp.c 225662 2011-09-19 10:58:30Z attilio $
Patch for: $FreeBSD: release/9.0.0/share/man/man4/coretemp.4 222176 2011-05-22 14:03:30Z uqs $


# 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--AxE3bAvIH2ane276Yh72LtNoZ8RO1bgU7cVzedYBBz5Bj09j
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- 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.
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
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:53:02 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"