Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Andriy Gapon
on 01/08/2011 03:28 Mario Lobo said the following:
> Hi to all
> 
> In my desktop machine, I had an AM2+ ASROCK mobo with Phenom II 955 BE that 
> showed each core temperature perfectly under FBSD 8-STABLE, via 
> dev.cpu.x.temp. amdtemp.ko loaded.
> 
> Unfortunately this Mobo died and only found AM3 boards for which my phenom 
> 955 
> doesn't fit. So I got an ASUS M4A88T-V EVO with a Phenom II 975 BE. 
> 
> Funny thing. An AM3 phenom II fits on an AM2 board but an AM3 board doesn't 
> accept an AM2/AM2+ phenom II :(.
> 
> Anyway, now, under the very same system, it shows 0 degrees on dev.cpu.x.temp 
> for all cores.

Sorry, I've got lost in all the config changes.  So what system do you have now?
Can please also provide CPU-related information from dmesg?

> I've been looking through k8temp and amdtemp src code. I am definitely not 
> sure of this but I believe something might have happened to those:
> 
> From k8temp.h
> 
> K10_THERM_REG  0xa4 
> K10_THERMTRIP_REG  0xe4
> K10_CURTMP(val)(((val) >> 21) & 0xfff)
> K10_THERMTRIP(val) ((val >> 1) & 1)
> 
> From amdtemp.c
> 
> /*
>  * Register control (K8 family)
>  */
> #define   AMDTEMP_REG0F   0xe4
> #define   AMDTEMP_REG_SELSENSOR   0x40
> #define   AMDTEMP_REG_SELCORE 0x04
> 
> /*
>  * Register control (K10 & K11) family
>  */
> #define   AMDTEMP_REG 0xa4
> 
> 
> Output of k8temp -dn:
> 
> CPUID: Vendor: AuthenticAMD, 0x100f43: Model=04 Family=f+1 Stepping=3
> Advanced Power Management=0x1f9
>Temperature sensor: Yes
>  Frequency ID control: No
>Voltage ID control: No
> THERMTRIP support: Yes
>HW Thermal control: Yes
>SW Thermal control: Yes
>100MHz multipliers: Yes
>HW P-State control: Yes
> TSC Invariant: Yes
> Temp=c0fef
> ThermTrip=1fc00c30
> 0
> 
> I keep a small win7 partition to test little things like this and see if the 
> same thing happens there, and it doesn't, so I concluded that the sensors are 
> there and are working.
> 
> One thing is worth noting though. I have used a free gadget that shows 
> activity/temp for each core. It worked fine with the previous MB/CPU.That 
> ALSO 
> stopped working with this new MB. Like FBSD, it shows 0 degrees for any core 
> too, although it correctly displays each core load.

Most likely that gadget just re-uses OS-provided information.

> The only windows tool that correctly shows the temperature are the ASUS tools 
> that came with the mobo.
> 
> Other than that, everything is working fine! The only thing I had to fix was 
> the fstab ada location.
> 
> I know this is not a big thing but I got accustomed to keeping an eye on 
> those 
> temperatures.
> 
> I have googled for a few days now searching for Thermal register address or 
> offsets for the Phenom II 975 BE, or anything related to this problem and 
> found nothing. Every search on AMD site was fruitless. I could not find a 
> single bit of tech info on this processor there, or any other tech info for 
> that matter.

http://support.amd.com/us/Processor_TechDocs/31116.pdf
> Would any one have any pointers/clues/suggestions on this?

I would try to add some printfs (or used dtrace - whichever is easier for you) 
to
see what's going on.  Or you can even use pciconf to directly sneak a peek at
what's reported by the hardware, e.g.:
# pciconf -r pci0:0:24:3 0xa4
1c881880

You can read the BKDG to see how to interpret the value - search for F3xA4.  See
F3xE4 for offset calculation.

Hopefully you should be able to see if hardware reports sane value and how the
amdtemp ends up reporting 0°C.

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Jung-uk Kim
On Monday 01 August 2011 10:14 am, Andriy Gapon wrote:
> on 01/08/2011 03:28 Mario Lobo said the following:
> > Hi to all
> >
> > In my desktop machine, I had an AM2+ ASROCK mobo with Phenom II
> > 955 BE that showed each core temperature perfectly under FBSD
> > 8-STABLE, via dev.cpu.x.temp. amdtemp.ko loaded.
> >
> > Unfortunately this Mobo died and only found AM3 boards for which
> > my phenom 955 doesn't fit. So I got an ASUS M4A88T-V EVO with a
> > Phenom II 975 BE.
> >
> > Funny thing. An AM3 phenom II fits on an AM2 board but an AM3
> > board doesn't accept an AM2/AM2+ phenom II :(.
> >
> > Anyway, now, under the very same system, it shows 0 degrees on
> > dev.cpu.x.temp for all cores.
>
> Sorry, I've got lost in all the config changes.  So what system do
> you have now? Can please also provide CPU-related information from
> dmesg?
>
> > I've been looking through k8temp and amdtemp src code. I am
> > definitely not sure of this but I believe something might have
> > happened to those:
> >
> > From k8temp.h
> >
> > K10_THERM_REG  0xa4
> > K10_THERMTRIP_REG  0xe4
> > K10_CURTMP(val)(((val) >> 21) & 0xfff)
> > K10_THERMTRIP(val) ((val >> 1) & 1)
> >
> > From amdtemp.c
> >
> > /*
> >  * Register control (K8 family)
> >  */
> > #define AMDTEMP_REG0F   0xe4
> > #define AMDTEMP_REG_SELSENSOR   0x40
> > #define AMDTEMP_REG_SELCORE 0x04
> >
> > /*
> >  * Register control (K10 & K11) family
> >  */
> > #define AMDTEMP_REG 0xa4
> >
> >
> > Output of k8temp -dn:
> >
> > CPUID: Vendor: AuthenticAMD, 0x100f43: Model=04 Family=f+1
> > Stepping=3 Advanced Power Management=0x1f9
> >Temperature sensor: Yes
> >  Frequency ID control: No
> >Voltage ID control: No
> > THERMTRIP support: Yes
> >HW Thermal control: Yes
> >SW Thermal control: Yes
> >100MHz multipliers: Yes
> >HW P-State control: Yes
> > TSC Invariant: Yes
> > Temp=c0fef
> > ThermTrip=1fc00c30
> > 0
> >
> > I keep a small win7 partition to test little things like this and
> > see if the same thing happens there, and it doesn't, so I
> > concluded that the sensors are there and are working.
> >
> > One thing is worth noting though. I have used a free gadget that
> > shows activity/temp for each core. It worked fine with the
> > previous MB/CPU.That ALSO stopped working with this new MB. Like
> > FBSD, it shows 0 degrees for any core too, although it correctly
> > displays each core load.
>
> Most likely that gadget just re-uses OS-provided information.
>
> > The only windows tool that correctly shows the temperature are
> > the ASUS tools that came with the mobo.
> >
> > Other than that, everything is working fine! The only thing I had
> > to fix was the fstab ada location.
> >
> > I know this is not a big thing but I got accustomed to keeping an
> > eye on those temperatures.
> >
> > I have googled for a few days now searching for Thermal register
> > address or offsets for the Phenom II 975 BE, or anything related
> > to this problem and found nothing. Every search on AMD site was
> > fruitless. I could not find a single bit of tech info on this
> > processor there, or any other tech info for that matter.
>
> http://support.amd.com/us/Processor_TechDocs/31116.pdf
>
> > Would any one have any pointers/clues/suggestions on this?
>
> I would try to add some printfs (or used dtrace - whichever is
> easier for you) to see what's going on.  Or you can even use
> pciconf to directly sneak a peek at what's reported by the
> hardware, e.g.:
> # pciconf -r pci0:0:24:3 0xa4
> 1c881880
>
> You can read the BKDG to see how to interpret the value - search
> for F3xA4.  See F3xE4 for offset calculation.
>
> Hopefully you should be able to see if hardware reports sane value
> and how the amdtemp ends up reporting 0�C.

I gave up the DiodeOffset recently because a lot of BIOSes do not set 
any meaningful values.  Instead, I added a tunable for that.  Please 
see the attached patch, which is also available from here:

http://people.freebsd.org/~jkim/amdtemp.diff

Jung-uk Kim
Index: share/man/man4/amdtemp.4
===
--- share/man/man4/amdtemp.4(revision 221788)
+++ share/man/man4/amdtemp.4(working copy)
@@ -25,12 +25,14 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 8, 2008
+.Dd May 11, 2011
 .Dt AMDTEMP 4
 .Os
 .Sh NAME
 .Nm amdtemp
-.Nd device driver for AMD K8, K10 and K11 on-die digital thermal sensor
+.Nd device driver for
+.Tn AMD
+processor on-die digital thermal sensor
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
@@ -49,22 +51,48 @@ amdtemp_load="YES"
 The
 .Nm
 driver provides support for the on-die digital thermal sensor present
-in AMD K8, K10 and K11 processors.
+in
+.Tn AMD
+Family 0Fh, 10h, 11h, 12h, and 14h processors.
 .Pp
-For the K8 family, the
+For Family 0Fh processors, the
 .Nm
-driver reports each core's temperature through a sysctl node in the
-corresponding CPU device

Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Jung-uk Kim
On Sunday 31 July 2011 08:28 pm, Mario Lobo wrote:
> Hi to all
>
> In my desktop machine, I had an AM2+ ASROCK mobo with Phenom II 955
> BE that showed each core temperature perfectly under FBSD 8-STABLE,
> via dev.cpu.x.temp. amdtemp.ko loaded.
>
> Unfortunately this Mobo died and only found AM3 boards for which my
> phenom 955 doesn't fit. So I got an ASUS M4A88T-V EVO with a Phenom
> II 975 BE.
>
> Funny thing. An AM3 phenom II fits on an AM2 board but an AM3 board
> doesn't accept an AM2/AM2+ phenom II :(.
>
> Anyway, now, under the very same system, it shows 0 degrees on
> dev.cpu.x.temp for all cores.
>
> I've been looking through k8temp and amdtemp src code. I am
> definitely not
>
> sure of this but I believe something might have happened to those:
> >From k8temp.h
>
> K10_THERM_REG  0xa4
> K10_THERMTRIP_REG  0xe4
> K10_CURTMP(val)(((val) >> 21) & 0xfff)
> K10_THERMTRIP(val) ((val >> 1) & 1)
>
> >From amdtemp.c
>
> /*
>  * Register control (K8 family)
>  */
> #define   AMDTEMP_REG0F   0xe4
> #define   AMDTEMP_REG_SELSENSOR   0x40
> #define   AMDTEMP_REG_SELCORE 0x04
>
> /*
>  * Register control (K10 & K11) family
>  */
> #define   AMDTEMP_REG 0xa4
>
>
> Output of k8temp -dn:
>
> CPUID: Vendor: AuthenticAMD, 0x100f43: Model=04 Family=f+1
> Stepping=3 Advanced Power Management=0x1f9
>Temperature sensor: Yes
>  Frequency ID control: No
>Voltage ID control: No
> THERMTRIP support: Yes
>HW Thermal control: Yes
>SW Thermal control: Yes
>100MHz multipliers: Yes
>HW P-State control: Yes
> TSC Invariant: Yes
> Temp=c0fef
> ThermTrip=1fc00c30
> 0
>
> I keep a small win7 partition to test little things like this and
> see if the same thing happens there, and it doesn't, so I concluded
> that the sensors are there and are working.
>
> One thing is worth noting though. I have used a free gadget that
> shows activity/temp for each core. It worked fine with the previous
> MB/CPU.That ALSO stopped working with this new MB. Like FBSD, it
> shows 0 degrees for any core too, although it correctly displays
> each core load.
>
> The only windows tool that correctly shows the temperature are the
> ASUS tools that came with the mobo.

FYI, FreeBSD has aibs(4) (or acpi_aiboost(4) depending on your FreeBSD 
version) and it does essentially the same thing.

Jung-uk Kim

> Other than that, everything is working fine! The only thing I had
> to fix was the fstab ada location.
>
> I know this is not a big thing but I got accustomed to keeping an
> eye on those temperatures.
>
> I have googled for a few days now searching for Thermal register
> address or offsets for the Phenom II 975 BE, or anything related to
> this problem and found nothing. Every search on AMD site was
> fruitless. I could not find a single bit of tech info on this
> processor there, or any other tech info for that matter.
>
>
> Would any one have any pointers/clues/suggestions on this?
>
> Thanks,
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Andriy Gapon

[cc list trimmed]

on 01/08/2011 19:23 Jung-uk Kim said the following:
> I gave up the DiodeOffset recently because a lot of BIOSes do not set 
> any meaningful values.  Instead, I added a tunable for that.  Please 
> see the attached patch, which is also available from here:
> 
> http://people.freebsd.org/~jkim/amdtemp.diff

I haven't tried your patch yet, but already have a few comments :-)

- at least on head pci_cfgregread() is public via x86/include/pci_cfgreg.h

- I am not sure if you really need it; shouldn't pci_read_config() just work
since amdtemp attaches under pci bus?

- about erratum 319 - I feel like objecting to amdtemp_force_enable approach;
given the wide spread of AM2+ and AM3 in consumer boards, and the very important
fact that I have AM2+ and I have never observed (with my own eyes) incorrect
reading from amdtemp, and the less important fact that the output of amdtemp is
not used for anything critical (for anything at all, in fact) in the base
system, and that that would be a kind of POLA violation (which is PITA) - I
propose to just print some warning message on the affected systems; at most,
export that warning as a sysctl node

Finally, I promise to test this patch soon-ish.
Thank you for digging into this!

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Matthew D. Fuller
On Sun, Jul 31, 2011 at 09:28:29PM -0300 I heard the voice of
Mario Lobo, and lo! it spake thus:
> 
> Unfortunately this Mobo died and only found AM3 boards for which my
> phenom 955 doesn't fit.

Not that it helps you now, but the 955 _is_ perfectly compatible with
AM3.  It's only the initial 920 and 940 that were AM2-only.


-- 
Matthew Fuller (MF4839)   |  fulle...@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
   On the Internet, nobody can hear you scream.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Jung-uk Kim
On Monday 01 August 2011 03:03 pm, Andriy Gapon wrote:
> [cc list trimmed]
>
> on 01/08/2011 19:23 Jung-uk Kim said the following:
> > I gave up the DiodeOffset recently because a lot of BIOSes do not
> > set any meaningful values.  Instead, I added a tunable for that. 
> > Please see the attached patch, which is also available from here:
> >
> > http://people.freebsd.org/~jkim/amdtemp.diff
>
> I haven't tried your patch yet, but already have a few comments :-)
>
> - at least on head pci_cfgregread() is public via
> x86/include/pci_cfgreg.h

That's cool.  Thanks.

> - I am not sure if you really need it; shouldn't pci_read_config()
> just work since amdtemp attaches under pci bus?

amdtemp(4) attaches under PCI bus but its sibling on function 2 isn't 
easy to address, i.e., hostbN.

> - about erratum 319 - I feel like objecting to amdtemp_force_enable
> approach; given the wide spread of AM2+ and AM3 in consumer boards,
> and the very important fact that I have AM2+ and I have never
> observed (with my own eyes) incorrect reading from amdtemp, and the
> less important fact that the output of amdtemp is not used for
> anything critical (for anything at all, in fact) in the base
> system, and that that would be a kind of POLA violation (which is
> PITA) - I propose to just print some warning message on the
> affected systems; at most, export that warning as a sysctl node

I have mixed feeling about this because I own a system with such 
CPU/motherboard combo, too.  I also believe it works well but errata 
is errata.  If vendor says we shouldn't use it, then we shouldn't.  
In fact, I am just following Linux as an example here but I have no 
problem with turning this into a warning message, either.  AMD says 
it shouldn't be interpreted as physical temperature but we are doing 
it anyway. ;-)

Jung-uk Kim

> Finally, I promise to test this patch soon-ish.
> Thank you for digging into this!
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Andriy Gapon
on 01/08/2011 22:48 Jung-uk Kim said the following:
> amdtemp(4) attaches under PCI bus but its sibling on function 2 isn't 
> easy to address, i.e., hostbN.

pci_find_bsf() should help with that.

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Andriy Gapon
on 01/08/2011 22:48 Jung-uk Kim said the following:
> I have mixed feeling about this because I own a system with such 
> CPU/motherboard combo, too.  I also believe it works well but errata 
> is errata.  If vendor says we shouldn't use it, then we shouldn't.  
> In fact, I am just following Linux as an example here but I have no 
> problem with turning this into a warning message, either.


Let's cut a deal :-)
If we start using amdtemp for fan control, emergency system shutdown or similar,
then we follow the strict path.  Until then, while we use amdtemp to amuse users
with numbers, let's just print a warning :-)

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Jung-uk Kim
On Monday 01 August 2011 04:10 pm, Andriy Gapon wrote:
> on 01/08/2011 22:48 Jung-uk Kim said the following:
> > I have mixed feeling about this because I own a system with such
> > CPU/motherboard combo, too.  I also believe it works well but
> > errata is errata.  If vendor says we shouldn't use it, then we
> > shouldn't. In fact, I am just following Linux as an example here
> > but I have no problem with turning this into a warning message,
> > either.
>
> Let's cut a deal :-)
> If we start using amdtemp for fan control, emergency system
> shutdown or similar, then we follow the strict path.  Until then,
> while we use amdtemp to amuse users with numbers, let's just print
> a warning :-)

Okay, here is the new patch (not tested on the affected system yet):

http://people.freebsd.org/~jkim/amdtemp2.diff

Jung-uk Kim
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Jung-uk Kim
On Monday 01 August 2011 04:07 pm, Andriy Gapon wrote:
> on 01/08/2011 22:48 Jung-uk Kim said the following:
> > amdtemp(4) attaches under PCI bus but its sibling on function 2
> > isn't easy to address, i.e., hostbN.
>
> pci_find_bsf() should help with that.

I thought about that but it seemed like an overkill because this 
driver is strictly MD anyway. :-)

Jung-uk Kim
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Mario Lobo
On Monday 01 August 2011 15:52:30 Matthew D. Fuller wrote:
> On Sun, Jul 31, 2011 at 09:28:29PM -0300 I heard the voice of
> 
> Mario Lobo, and lo! it spake thus:
> > Unfortunately this Mobo died and only found AM3 boards for which my
> > phenom 955 doesn't fit.
> 
> Not that it helps you now, but the 955 _is_ perfectly compatible with
> AM3.  It's only the initial 920 and 940 that were AM2-only.

I was just following this:

http://support.amd.com/us/kbarticles/Pages/CPU-6-socket-am2-plus-phenom-ii-
compatibility-alert.aspx
-- 
Mario Lobo
http://www.mallavoodoo.com.br
FreeBSD since 2.2.8 [not Pro-Audio YET!!] (99% winblows FREE)
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread RW
On Mon, 1 Aug 2011 19:21:38 -0300
Mario Lobo wrote:

> On Monday 01 August 2011 15:52:30 Matthew D. Fuller wrote:
> > On Sun, Jul 31, 2011 at 09:28:29PM -0300 I heard the voice of
> > 
> > Mario Lobo, and lo! it spake thus:
> > > Unfortunately this Mobo died and only found AM3 boards for which
> > > my phenom 955 doesn't fit.
> > 
> > Not that it helps you now, but the 955 _is_ perfectly compatible
> > with AM3.  It's only the initial 920 and 940 that were AM2-only.
> 
> I was just following this:
> 
> http://support.amd.com/us/kbarticles/Pages/CPU-6-socket-am2-plus-phenom-ii-
> compatibility-alert.aspx

It says "Although Socket AM3 processors can be used on Socket AM2+
motherboards, the opposite is not possible". 

I'm using a 955 in a M4A88T-M/USB3, which is minor variant of your AM3
board. My understanding is that the 955 is an AM3 processor.


BTW in my case only the temperature is correct, but is only given for
the first 2 cores.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: Phenom II 975 BE shows 0 celsius

2011-08-01 Thread Andriy Gapon
on 02/08/2011 00:08 Jung-uk Kim said the following:
> On Monday 01 August 2011 04:07 pm, Andriy Gapon wrote:
>> on 01/08/2011 22:48 Jung-uk Kim said the following:
>>> amdtemp(4) attaches under PCI bus but its sibling on function 2
>>> isn't easy to address, i.e., hostbN.
>>
>> pci_find_bsf() should help with that.
> 
> I thought about that but it seemed like an overkill because this 
> driver is strictly MD anyway. :-)

It's just that pci_cfgregread() has very low level feel to it, nothing else...

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"