Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Feb 2023 05:08:49 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8362905cb69e - main - coretemp: Only log critical temperature events
Message-ID:  <202302050508.31558nGE002088@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8362905cb69e06b8946dd582ce2c1fb67d86081a

commit 8362905cb69e06b8946dd582ce2c1fb67d86081a
Author:     sadaszewski <s.adaszewski@gmail.com>
AuthorDate: 2021-11-17 07:27:46 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-02-05 05:05:48 +0000

    coretemp: Only log critical temperature events
    
    According to the Intel manual
    https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3b-part-2-manual.pdf
    the Thermal Status (0) and Thermal Status Log (1) bits report only a
    high temperature on the CPU, not a critical temperature as suggested in
    the coretemp driver. Check the Critical Temperature Log (5) instead.
    The critical temperature waives guarantees of correct function,
    therefore the CPU could have for example written some wrong values into
    memory at that point and the OS should be stopped ASAP as the state is
    no longer reliable.
    
    Reviewed by: imp (confirmed descriptions of bits, linux ignores these bits)
    Pull Request: https://github.com/freebsd/freebsd-src/pull/562
---
 sys/dev/coretemp/coretemp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c
index c81eb8371413..d8a67f257110 100644
--- a/sys/dev/coretemp/coretemp.c
+++ b/sys/dev/coretemp/coretemp.c
@@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
 
 #define	TZ_ZEROC			2731
 
+#define	THERM_CRITICAL_STATUS_LOG       0x20
+#define	THERM_CRITICAL_STATUS           0x10
 #define	THERM_STATUS_LOG		0x02
 #define	THERM_STATUS			0x01
 #define	THERM_STATUS_TEMP_SHIFT		16
@@ -393,7 +395,7 @@ coretemp_get_val_sysctl(SYSCTL_HANDLER_ARGS)
 		 * If we reach a critical level, allow devctl(4)
 		 * to catch this and shutdown the system.
 		 */
-		if (msr & THERM_STATUS) {
+		if (msr & THERM_CRITICAL_STATUS) {
 			tmp = (msr >> THERM_STATUS_TEMP_SHIFT) &
 			    THERM_STATUS_TEMP_MASK;
 			tmp = (sc->sc_tjmax - tmp) * 10 + TZ_ZEROC;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302050508.31558nGE002088>