Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Sep 2009 12:15:58 -0400
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        freebsd-stable@FreeBSD.org
Cc:        Kurt Jaeger <lists@c0mplx.org>, Luigi Rizzo <rizzo@iet.unipi.it>
Subject:   Re: Detecting CPU throttling on over temperature
Message-ID:  <200909101216.01423.jkim@FreeBSD.org>
In-Reply-To: <20090910133741.GA6000@onelab2.iet.unipi.it>
References:  <1252426982.00160755.1252414203@10.7.7.3> <20090910132107.GH48206@home.opsec.eu> <20090910133741.GA6000@onelab2.iet.unipi.it>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



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