From owner-freebsd-stable@FreeBSD.ORG Thu Sep 10 16:16:09 2009 Return-Path: Delivered-To: freebsd-stable@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 39F34106566B; Thu, 10 Sep 2009 16:16:09 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-stable@FreeBSD.org Date: Thu, 10 Sep 2009 12:15:58 -0400 User-Agent: KMail/1.6.2 References: <1252426982.00160755.1252414203@10.7.7.3> <20090910132107.GH48206@home.opsec.eu> <20090910133741.GA6000@onelab2.iet.unipi.it> In-Reply-To: <20090910133741.GA6000@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_AZSqKZvEDrempLW" Message-Id: <200909101216.01423.jkim@FreeBSD.org> Cc: Kurt Jaeger , Luigi Rizzo Subject: Re: Detecting CPU throttling on over temperature X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2009 16:16:09 -0000 --Boundary-00=_AZSqKZvEDrempLW Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 10 September 2009 09:37 am, Luigi Rizzo wrote: > On Thu, Sep 10, 2009 at 03:21:07PM +0200, Kurt Jaeger wrote: > > Hi! > > > > > > I thought coretemp had be modified in HEAD to support Phenoms > > > > but I can't find any evidence of that in SVN so I am not sure > > > > what I am thinking.. > > > > > > How about 'k8temp'? > > > > /usr/ports/sysutils/k8temp > > > > This works, very nice! > > note though that the numbers you get seem way off reality: > > bsd7# k8temp > CPU 0 Core 0 Sensor 0: 13c > CPU 0 Core 0 Sensor 1: 13c > CPU 0 Core 1 Sensor 0: 16c > CPU 0 Core 1 Sensor 1: 3c > > (they do increase with CPU load). I bet this is a Family 0Fh Revision G processor. In fact, I (accidently) found the problem and wrote the attached patch for amdtemp(4) last night. :-) Jung-uk Kim --Boundary-00=_AZSqKZvEDrempLW Content-Type: text/plain; charset="iso-8859-1"; name="amdtemp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="amdtemp.diff" --- sys/dev/amdtemp/amdtemp.c.orig 2009-08-20 15:43:50.000000000 -0400 +++ sys/dev/amdtemp/amdtemp.c 2009-09-09 18:44:26.000000000 -0400 @@ -360,8 +360,13 @@ amdtemp_gettemp0f(device_t dev, amdsenso } pci_write_config(dev, AMDTEMP_REG0F, cfg, 1); temp = pci_read_config(dev, AMDTEMP_REG0F, 4); - temp = ((temp >> 16) & 0xff) * 10 + AMDTEMP_OFFSET0F; - + + /* Revision G has two more bits. */ + if ((cpu_id & CPUID_EXT_MODEL) >= 0x60000) + temp = ((temp >> 14) & 0x3ff) * 10 / 4 + AMDTEMP_OFFSET; + else + temp = ((temp >> 16) & 0xff) * 10 + AMDTEMP_OFFSET; + return (temp); } --Boundary-00=_AZSqKZvEDrempLW--