From nobody@FreeBSD.org  Sat Nov  7 15:16:46 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1C6C106568B
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  7 Nov 2009 15:16:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id E172D8FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  7 Nov 2009 15:16:46 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nA7FGk1L041188
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 7 Nov 2009 15:16:46 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id nA7FGkJS041187;
	Sat, 7 Nov 2009 15:16:46 GMT
	(envelope-from nobody)
Message-Id: <200911071516.nA7FGkJS041187@www.freebsd.org>
Date: Sat, 7 Nov 2009 15:16:46 GMT
From: Hannes <freebsd@soulrebel.in-berlin.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: speed-stepping broken on PhenomII (acpi?)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         140361
>Category:       kern
>Synopsis:       [cpufreq] speed-stepping broken on PhenomII (acpi?)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 07 15:20:01 UTC 2009
>Closed-Date:    
>Last-Modified:  Tue Nov 13 20:56:07 UTC 2012
>Originator:     Hannes
>Release:        FreeBSD 8-RC2
>Organization:
>Environment:
FreeBSD fbsdmain.lan.home 8.0-RC1 FreeBSD 8.0-RC1 #0: Thu Sep 17 18:50:57 UTC 2009     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
I have a new AMD PhenomII X4 (3.0Ghz) CPU. However powerd doesn't
automatically reduce the freq.

I suppose this is due to the CPU-Load being incorrectly detected:

> sysctl -a | grep usage
dev.cpu.0.cx_usage: 100.00% last 500us
dev.cpu.1.cx_usage: 100.00% last 500us
dev.cpu.2.cx_usage: 100.00% last 500us
dev.cpu.3.cx_usage: 100.00% last 500us

(these are always 100% although system is mostly idle)

I would really like to be able to reduce freq, for energy, noise/heat
and long--livety reasons!

Thank you very much!
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:

From: Hannes <freebsd@soulrebel.in-berlin.de>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII (acpi?)
Date: Wed, 24 Mar 2010 10:27:34 +0000

 *ping*
 
 Is there anything I can do to help solve this issue?
 (still there on a current RELENG_8)
 
 Thank you very much,
 Regards,
 Hannes
State-Changed-From-To: open->feedback  
State-Changed-By: brucec 
State-Changed-When: Thu Mar 25 08:40:49 UTC 2010 
State-Changed-Why:  
Note that feedback was requested. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=140361 

From: Alexander Best <alexbestms@wwu.de>
To: <bug-followup@FreeBSD.org>
Cc: Hannes <freebsd@soulrebel.in-berlin.de>
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII
 (acpi?)
Date: Thu, 25 Mar 2010 10:51:16 +0100 (CET)

 i don't think you're looking at the right sysctl values. you should be
 checking `sysctl dev.cpu.0.freq dev.cpu.0.freq_levels`.
 
 'dev.cpu.0.freq_levels' tells you what steppings are available and
 'dev.cpu.0.freq' which current stepping your cpu is using. also be sure you're
 running powerd (`/etc/rc.d/powerd onestart`).
 
 i'm not an expert on est though. `dmesg -a|egrep '^est[0-9]*'` reports:
 
 est0: <Enhanced SpeedStep Frequency Control> on cpu0
 est: CPU supports Enhanced Speedstep, but is not recognized.
 est: cpu_vendor GenuineIntel, msr 925092506000925
 est1: <Enhanced SpeedStep Frequency Control> on cpu1
 est: CPU supports Enhanced Speedstep, but is not recognized.
 est: cpu_vendor GenuineIntel, msr 925092506000925
 
 on my machine so i'm not sure how much powersaving is really being performed.
 your cpu might report the same.
 
 anyway it's probably better to send a message to stable@.
 
 -- 
 Alexander Best

From: Hannes <freebsd@soulrebel.in-berlin.de>
To: bug-followup@freebsd.org
Cc: Alexander Best <alexbestms@wwu.de>, brucec@freebsd.org
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII (acpi?)
Date: Thu, 25 Mar 2010 13:12:59 +0000

 Thanks for your replies!
 
 > i don't think you're looking at the right sysctl values. you should
 > be checking `sysctl dev.cpu.0.freq dev.cpu.0.freq_levels`.
 >
 
 I checked those, they looked fine, so i didnt mention it:
 
 dev.cpu.0.freq: 3000
 dev.cpu.0.freq_levels: 3000/23530 2300/17400 1800/14520 800/7315
 
 (freq just never goes down [unlike my intel laptop])
 
 > 'dev.cpu.0.freq_levels' tells you what steppings are available and
 > 'dev.cpu.0.freq' which current stepping your cpu is using.
 
 They look right, or not?
 
 > also be
 > sure you're running powerd (`/etc/rc.d/powerd onestart`).
 
 hannes@fbsdmain /c/h/hannes> ps ax | grep powerd
   925  ??  Ss     0:05,09 /usr/sbin/powerd -a adaptive -i adaptive
 
 
 > i'm not an expert on est though. `dmesg -a|egrep '^est[0-9]*'`
 > reports:
 > 
 > est0: <Enhanced SpeedStep Frequency Control> on cpu0
 > est: CPU supports Enhanced Speedstep, but is not recognized.
 > est: cpu_vendor GenuineIntel, msr 925092506000925
 > est1: <Enhanced SpeedStep Frequency Control> on cpu1
 > est: CPU supports Enhanced Speedstep, but is not recognized.
 > est: cpu_vendor GenuineIntel, msr 925092506000925
 > 
 > on my machine so i'm not sure how much powersaving is really being
 > performed. your cpu might report the same.
 
 fbsdmain# dmesg -a | egrep '^est[0-9]*'
 fbsdmain#
 
 Hm, whats this? Never saw it before, and it isnt mentioned in the 
 freebsd-wiki and has no man-page, also i can't load it as module and 
 dont have it built-in. Are you on current maybe?
 
 
 Concerning  bruce's input:
 hannes@fbsdmain /c/h/hannes> sysctl dev.cpu | grep cx
 dev.cpu.0.cx_supported: C1/0
 dev.cpu.0.cx_lowest: C1
 dev.cpu.0.cx_usage: 100.00% last 500us
 dev.cpu.1.cx_supported: C1/0
 dev.cpu.1.cx_lowest: C1
 dev.cpu.1.cx_usage: 100.00% last 500us
 dev.cpu.2.cx_supported: C1/0
 dev.cpu.2.cx_lowest: C1
 dev.cpu.2.cx_usage: 100.00% last 500us
 dev.cpu.3.cx_supported: C1/0
 dev.cpu.3.cx_lowest: C1
 dev.cpu.3.cx_usage: 100.00% last 500us
 
 -> FreeBSD doesnt recognize any other states. Thats probably the issue, 
 or not?
 
 > anyway it's probably better to send a message to stable@.
 
 So this is not a Bug?
 
 Thanks for your help!

From: Hannes <freebsd@soulrebel.in-berlin.de>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII (acpi?)
Date: Thu, 19 Aug 2010 15:16:53 +0000

 I can re-afirm this bug with 8.1-RELEASE on the system mentioned before 
 and also on a second system.
 
 The second system uses this CPU:
 
 %dmesg | grep -i amd
     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
 CPU: AMD Athlon(tm) II X2 240e Processor (2800.01-MHz K8-class CPU)
   Origin = "AuthenticAMD"  Id = 0x100f62  Family = 10  Model = 6  
 Stepping = 2
   AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!
 +,3DNow!>
   AMD 
 Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT>
 
 
 The levels look correct:
 
 %sysctl dev.cpu.0.freq dev.cpu.0.freq_levels
 dev.cpu.0.freq: 800
 dev.cpu.0.freq_levels: 2800/22790 2450/19941 2100/16660 1837/14577 
 1600/13837 1400/12107 1200/10377 1000/8648 800/6200 700/5425 600/4650 
 500/3875 400/3100 300/2325 200/1550 100/775
 
 
 There is no speed-stepping detected:
 
 %dmesg -a|egrep '^est[0-9]*'
 %
 
 
 
 
 Both mainboards are from Sapphire and both systems run amd64. Using the 
 x86 version of FreeBSD solves the problem, i.e. I do get est devices and 
 C2/C3-states!!!
 
 But this is not an option because of memory requirements.
 
 As this bug is marked as feedback, please let me know what I can do to 
 help get this issue fixed.
 
 Thank you very much!

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, freebsd@soulrebel.in-berlin.de
Cc:  
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII
 (acpi?)
Date: Sun, 12 Sep 2010 09:59:39 +0100

 Hannes,
 
 It looks like powerd is doing its job: the line "dev.cpu.0.freq: 800"
 shows that your CPU is running at 800MHz which is far below its
 maximum. By checking the value of dev.cpu.0.freq every so often you
 should see it reduce when the system is idle and increase when doing
 CPU-intensive work like running a build etc.
 
 The cx_usage lines (e.g. dev.cpu.0.cx_usage: 100.00% last 500us) are
 just reporting the amount of time the CPU was in a certain power state.
 Since your CPU doesn't support C2 and C3 all the time is spent in C1 -
 hence the "100%". That's normal, and would only be less than 100% if
 you had C2 or C3 and you'd set hw.acpi.cpu.cx_lowest.
 
 I don't think this is a bug in FreeBSD if you can confirm that the
 dev.cpu.0.freq value is changing. If so, I'd like to close this PR.
 
 -- 
 Bruce Cran

From: Hannes <freebsd@soulrebel.in-berlin.de>
To: "Bruce Cran" <bruce@cran.org.uk>
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII
	(acpi?)
Date: Wed, 15 Sep 2010 17:00:38 +0200

 Hi Bruce,
 
 thanks for your reply.
 
 > Hannes,
 >
 > It looks like powerd is doing its job: the line "dev.cpu.0.freq: 800"
 > shows that your CPU is running at 800MHz which is far below its
 > maximum. By checking the value of dev.cpu.0.freq every so often you
 > should see it reduce when the system is idle and increase when doing
 > CPU-intensive work like running a build etc.
 
 No, the point is that dev.cpu.0.freq is NOT adjusting automatically. =20
 That's what got me starting this whole report. In the above example I =20
 set it manually to 800, which actually works (e.g. the power =20
 consumption goes down), but it only works manually and powerd does not =20
 regulate it up, even if I put 100% load on all cores.
 
 > The cx_usage lines (e.g. dev.cpu.0.cx_usage: 100.00% last 500us) are
 > just reporting the amount of time the CPU was in a certain power state.
 > Since your CPU doesn't support C2 and C3 all the time is spent in C1 -
 > hence the "100%". That's normal, and would only be less than 100% if
 > you had C2 or C3 and you'd set hw.acpi.cpu.cx_lowest.
 
 The CPU should have C2 or C3.
 
 > I don't think this is a bug in FreeBSD if you can confirm that the
 > dev.cpu.0.freq value is changing. If so, I'd like to close this PR.
 
 - on FreeBSD i386 dev.cpu.0.cx_usage adjusts automatically, I have est =20
 devices and C2/C3-states
 - on FreeBSD amd64 nothing adjusts  automatically, est doesnt attach =20
 and I dont get states
 
 So unless there is some amd64-related vodoo you have to do that I =20
 don't know of (these are my only amd64-machines I ever had), I am =20
 pretty sure it's a bug.
 
 I don't have access to the machines the next two weeks but can provide =20
 further info then. I would gladly test patches aswell, if they apply =20
 to RELENG_8. I will also try to get hold of an i386 install again and =20
 then provide diffs of dmesg and sysctls.
 
 Thanks you very much for your help!
 
 Regards,
 Hannes
 

From: g <annona2@gmail.com>
To: bug-followup@FreeBSD.org, freebsd@soulrebel.in-berlin.de
Cc:  
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII (acpi?)
Date: Sun, 4 Sep 2011 16:06:52 +0900

 Hi, Hanns.
 
 I found this PR from search engine (google).
 This PR is slightly old, though, i send this e-mail.
 
 Phenom II or so will not have est(speed step) it's for intel cpu, and
 Instead amd cpu will have powernow or hwpstate, i think.
 
 Please send the results of followings.
 1) sysctl -a | grep freq (will show powernow or hwpstate related things)
 2) powerd -v ( make powerd run foreground and with verbose mode )
 and i hope powerd is doing its job.
 
 Thanks in advance.
 
 Gen <annona2@gmail.com>

From: Hannes <freebsd@soulrebel.in-berlin.de>
To: g <annona2@gmail.com>
Cc: bug-followup@freebsd.org
Subject: Re: kern/140361: [cpufreq] speed-stepping broken on PhenomII (acpi?)
Date: Sun, 04 Sep 2011 12:21:59 +0200

 Am Sonntag, 4. September 2011, 16:06:52 schrieb g:
 > Hi, Hanns.
 > 
 > I found this PR from search engine (google).
 > This PR is slightly old, though, i send this e-mail.
 > 
 > Phenom II or so will not have est(speed step) it's for intel cpu, and
 > Instead amd cpu will have powernow or hwpstate, i think.
 > 
 > Please send the results of followings.
 > 1) sysctl -a | grep freq (will show powernow or hwpstate related
 > things) 2) powerd -v ( make powerd run foreground and with verbose
 > mode ) and i hope powerd is doing its job.
 > 
 > Thanks in advance.
 > 
 > Gen <annona2@gmail.com>
 
 Thanks for your help, I am very interested in this, but do not have 
 access to the computer for the next ~6 weeks. I will get back to you 
 then!
 
 Regards,
 Hannes
State-Changed-From-To: feedback->open 
State-Changed-By: eadler 
State-Changed-When: Tue Nov 13 20:56:06 UTC 2012 
State-Changed-Why:  
Submitter provided requested information 

http://www.freebsd.org/cgi/query-pr.cgi?pr=140361 
>Unformatted:
