From owner-cvs-all@FreeBSD.ORG Wed Aug 15 21:39:52 2007 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 369A816A417; Wed, 15 Aug 2007 21:39:52 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id DF3FA13C48D; Wed, 15 Aug 2007 21:39:51 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id CFDFD20B0; Wed, 15 Aug 2007 23:39:44 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: 0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id B26FB208A; Wed, 15 Aug 2007 23:39:44 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 8FE2B8444F; Wed, 15 Aug 2007 23:39:44 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: src-committers@FreeBSD.org References: <200708151926.l7FJQ3Md029693@repoman.freebsd.org> <20070815204708.GA11724@tirith.brixandersen.dk> Date: Wed, 15 Aug 2007 23:39:44 +0200 In-Reply-To: <20070815204708.GA11724@tirith.brixandersen.dk> (Henrik Brix Andersen's message of "Wed\, 15 Aug 2007 22\:47\:08 +0200") Message-ID: <864pj0qxy7.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/amd64/include specialreg.h src/sys/conf files.amd64 files.i386 src/sys/dev/coretemp coretemp.c src/sys/i386/include specialreg.h src/sys/modules Makefile src/sys/modules/coretemp Makefile src/sys/amd64/conf NOTES ... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Aug 2007 21:39:52 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Henrik Brix Andersen writes: > $ dmesg | grep coretemp > coretemp0: on cpu0 > coretemp1: on cpu1 > > $ sysctl dev.cpu.0.temperature > dev.cpu.0.temperature: -50 > > $ sysctl dev.cpu.1.temperature > dev.cpu.1.temperature: -49 This means Tj(max) is not properly detected. The CPU actually reports the temperature as a delta from the maximum rated operating temperature in degrees Celsius; you're seeing the raw value. Actually, the bug is easy to see: if ((cpu_model =3D=3D 0xf && cpu_mask > 3) || cpu_model =3D=3D 0xe) { msr =3D rdmsr(MSR_IA32_EXT_CONFIG); if ((msr >> 30) & 0x1) sc->sc_tjmax =3D 85; } else sc->sc_tjmax =3D 100; Initializing sc->sc_tjmax to 100 before the outer if test should fix this. Could you please test the attached patch? > The ACPI thermal zones seem to provide much more realistic readings: > > $ sysctl hw.acpi.thermal.tz0.temperature > hw.acpi.thermal.tz0.temperature: 65.0C > > $ sysctl hw.acpi.thermal.tz1.temperature > hw.acpi.thermal.tz1.temperature: 67.0C Those are not the same temperature sensors. The actual temperature in your CPU is around 50 degrees Celsius. The ACPI thermal zones are probably sensors on the motherboard. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=tjmax.diff Index: sys/dev/coretemp/coretemp.c =================================================================== RCS file: /home/ncvs/src/sys/dev/coretemp/coretemp.c,v retrieving revision 1.1 diff -u -r1.1 coretemp.c --- sys/dev/coretemp/coretemp.c 15 Aug 2007 19:26:02 -0000 1.1 +++ sys/dev/coretemp/coretemp.c 15 Aug 2007 21:35:31 -0000 @@ -168,12 +168,12 @@ * The if-clause for CPUs having the MSR_IA32_EXT_CONFIG was adapted * from the Linux coretemp driver. */ + sc->sc_tjmax = 100; if ((cpu_model == 0xf && cpu_mask > 3) || cpu_model == 0xe) { msr = rdmsr(MSR_IA32_EXT_CONFIG); - if ((msr >> 30) & 0x1) + if (msr & (1 << 30)) sc->sc_tjmax = 85; - } else - sc->sc_tjmax = 100; + } /* * Add the "temperature" MIB to dev.cpu.N. --=-=-=--