Bug 42648 - Frequencies higher than 1.5 GHz are not available for AMD A8-3500M
Summary: Frequencies higher than 1.5 GHz are not available for AMD A8-3500M
Alias: None
Product: Power Management
Classification: Unclassified
Component: cpufreq (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: herrmann.der.user
Depends on:
Reported: 2012-01-24 15:15 UTC by RussianNeuroMancer
Modified: 2012-06-05 03:26 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.2.1
Tree: Mainline
Regression: No


Description RussianNeuroMancer 2012-01-24 15:15:03 UTC
Listed pstates:
[    2.591543] powernow-k8: Found 1 AMD A8-3500M APU with Radeon(tm) HD Graphics (4 cpu cores) (version 2.20.00)
[    2.591570] powernow-k8: Core Performance Boosting: on.
[    2.591626] powernow-k8:    0 : pstate 0 (1500 MHz)
[    2.591629] powernow-k8:    1 : pstate 1 (1400 MHz)
[    2.591631] powernow-k8:    2 : pstate 2 (1200 MHz)
[    2.591634] powernow-k8:    3 : pstate 3 (1100 MHz)
[    2.591636] powernow-k8:    4 : pstate 4 (1000 MHz)
[    2.591639] powernow-k8:    5 : pstate 5 (900 MHz)
[    2.591641] powernow-k8:    6 : pstate 6 (800 MHz)

1.5 GHz is a base frequency, but maximum frequency (Turbo Core) should be 2.4 GHz, not 1.5 GHz.
Today tested with 3.3.0rc1 - same problem here.
Distribution is Kubuntu 11.10 x86_64, laptop is Acer Aspire 7560G.
Comment 1 herrmann.der.user 2012-02-01 11:19:17 UTC
powernow-k8 correctly shows all software visible Pstates on
your system.

All that the frequency driver can do is to select one of the
software visible Pstates. For highest performance software can
request to switch to Pstate number 0 (1.5GHz in your case).

In addition the CPU itself can boost the frequency of a core up to
2.4 GHz in your case if cpb (core performance boost) is enabled.
There are "boosted P-states" to do this, but those are not
visible/accessible to the powernow-k8 driver.

You can check whether CPB is enable with

  $ for i in `find /sys/ -name cpb`; do echo -n "$i: "; cat $i; done
  /sys/devices/system/cpu/cpu0/cpufreq/cpb: 1
  /sys/devices/system/cpu/cpu1/cpufreq/cpb: 1
  /sys/devices/system/cpu/cpu2/cpufreq/cpb: 1
  /sys/devices/system/cpu/cpu3/cpufreq/cpb: 1

You can display the actual (boosted) frequency with tools like
cpufreq-aperf (part of cpufrequtils), e.g.

 # cpufreq-aperf 
 CPU	Average freq(KHz)	Time in C0	Time in Cx	C0 percentage

 000	1088000			00 sec 120 ms	00 sec 879 ms	12
 001	0768000			00 sec 061 ms	00 sec 938 ms	06
 002	0768000			00 sec 062 ms	00 sec 937 ms	06
 003	0800000			00 sec 045 ms	00 sec 954 ms	04
 004	1184000			00 sec 109 ms	00 sec 890 ms	10
 005	3552000			01 sec 003 ms	5764607523 sec 031 ms	100

This example is from a system with Phenom X6 1090T processor.
There was load on the 6th core, which was boosted to 3.5 GHz.
The software visible Pstates of that system are

 powernow-k8: Found 1 AMD Phenom(tm) II X6 1090T Processor (6 cpu cores)(version 2.20.00)
 powernow-k8: Core Performance Boosting: on.
 powernow-k8:    0 : pstate 0 (3200 MHz)
 powernow-k8:    1 : pstate 1 (2400 MHz)
 powernow-k8:    2 : pstate 2 (1600 MHz)
 powernow-k8:    3 : pstate 3 (800 MHz)

More details about CPB can be found in the respective BKDG for your CPU,
see section " Core Performance Boost (CPB)" in

Comment 2 herrmann.der.user 2012-02-01 11:21:39 UTC
Forgot to mention that x86info is able to show full Pstate information
(including the boosted Pstates).


# ./x86info -a
x86info v1.30  Dave Jones 2001-2011
Feedback to <davej@redhat.com>.
Found 6 identical CPUs
Extended Family: 1 Extended Model: 0 Family: 15 Model: 10 Stepping: 0
CPU Model (x86info's best guess): Phenom/Athlon/Sempron/Turion (II)/Opteron (PH-E0)
Processor name string (BIOS programmed): AMD Phenom(tm) II X6 1090T Processor
PowerNOW! Technology information
Available features:
	Temperature sensing diode present.
	Thermal Trip
	Thermal Monitoring
	Software Thermal Control
	100MHz multiplier control
	Hardware P-state control
	invariant TSC
	Core Performance Boost
	Effective Frequency Interface

Boosting enabled
Number of boost states: 1
Pstate-Pb0: 3600MHz (boost state)
Pstate-P0:  3200MHz (current)
Pstate-P1:  2400MHz
Pstate-P2:  1600MHz
Pstate-P3:  800MHz
Comment 3 RussianNeuroMancer 2012-02-01 17:27:54 UTC
Thank you for very informative commentaries, but in case of AMD A8-3500M APU frequencies higher than 1.5 GHz are not available even with enabled cpb (/sys/devices/system/cpu/cpuN/cpufreq/cpb is 1) but even under heavy load (test case: 60 fps FullHD video playback, multithreading decoder) cpufreq-aperf report not more than 1.5 GHz:
000     1485000                 00 sec 976 ms   00 sec 023 ms   97
001     1485000                 00 sec 984 ms   00 sec 015 ms   98
002     1485000                 00 sec 987 ms   00 sec 012 ms   98
003     1485000                 00 sec 971 ms   00 sec 028 ms   97

At this moment I already back to 3.2.2 kernel. I need to check 3.3rc2?
Comment 4 herrmann.der.user 2012-02-02 11:43:45 UTC
All 4 cores are almost fully utilized (>=97% in C0) and operating
at highest frequency. Also the GPU part of your APU is loaded.

Obviously in your scenario the APU (CPU+GPU) is operating at its
design limits (power, thermal) and there is no room to switch any
of your cores into a boosted P-state.

AMD's Turbo Core (similar to Intel's Turbo Boost) can increase
frequency of cores if the entire processor is operating below its
power and thermal limits.

For example a Phenom X6 1090T Processor is able to boost 3 cores if
the other 3 cores are idle. On your processor the decision whether 
cores can boost depends on current CPU and GPU workload and the
corresponding power consumption.
I think it's best to quote from the BKDG:

"CPB hardware dynamically monitors processor activity and
generates an approximation of power consumption. If power
consumption exceeds a defined power limit, a P-state limit
is applied by CPB hardware to reduce
power consumption. CPB ensures that average power consumption
over a thermally significant time period remains
at or below the defined power limit. This allows P-states
to be defined with higher frequencies and voltages
than could be used without CPB. These P-states are
referred to as boosted P-states."
Comment 5 RussianNeuroMancer 2012-02-02 14:08:04 UTC
After switch GPU in APU to low power profile (that probably reduce power consumption and temperature of APU) at least one core under load increase frequency up to 1.8 GHz. 

Thank you for a full and detailed explanation. I'm sorry I take your time, but wikipedia article about AMD Turbo Core is available only in Deutsch. On AMD official web-site (in the consumer part) there is just short description "AMD Turbo Core Technology - Automatically scales performance on-demand to provide extra performance when you need it most. Amazing performance when you're pushing your system to the limits, with scaled back power consumption for everyday activities." that in my opinion doesn't explain real cpb behavior.
Comment 6 Thomas Renninger 2012-03-06 22:11:29 UTC
I guess this AMD A8-3500M is a family 12h CPU (/proc/cpuinfo, cpu family -> 18)?
If yes (or if it's fam14h, cpu family -> 20), can you give latest cpupower monitor tool a try from here:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpupowerutils.git
cd tools/power/cpupower
make    # make sure pciutils-devel or whatever provides pci.h is installed
./cpupower monitor

Do you get a fam12h or fam14h monitor column?
If yes, you should be able to obtain additional info from HW which deep sleep states were really entered, which core boosts, etc.
There is one special column: nbp1 (North Bridge P-state 1).
This one is only entered if graphics also enters power states.
It's a yes/no flag which always gets reset at measure beginning.
If you install cpupower, cpupower monitor --help should give you some more details, otherwise man -l man/*.1 shows you some additional info.
When I tried, I realized that the kernel radeon driver prevented the platform to enter NBP1 state (even with powersave profile). fglrx worked and NBP1 was entered immediately.

-> I add the cpufreq list again. This one sounds interesting for others and having this in the cpufreq archives for googling shouldn't be that bad.
Comment 7 Thomas Renninger 2012-03-06 22:12:50 UTC
cpupower monitor could need a -t (top) param, but you can use:
watch -n1 cpupower monitor to constantly track sleep states, frequency, boost, etc. behavior.

Note You need to log in before you can comment on or make changes to this bug.