Bug 78111

Summary: APU turbo core boost not working when radeon.dpm=1
Product: Drivers Reporter: B M (bgz.marko)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: NEW ---    
Severity: normal CC: alexdeucher, laszlo.kertesz, mad_sam, mirh, szg00000
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.14.6 Subsystem:
Regression: No Bisected commit-id:
Attachments: enable bapm
dmesg output (with enable bapm path)

Description B M 2014-06-16 14:21:43 UTC
I am testing with A6-1450 APU on Arch Linux. If I pass radeon.dpm=1 parameter at boot and start a single core workload then turbostat will report max frequency of about 1000 MHz:

    Core     CPU Avg_MHz Bzy_MHz TSC_MHz   time 
       -       -     262     998     998      5**
       0       0      12     998     998      5**
       1       1     998     998     998
       2       2      16     998     998
       3       3      21     998     998

"cpupower frequency-info" reports that boost state support is supported, but not active:

  boost state support:
    Supported: yes
    Active: no


However, when dynamic power management is disabled (radeon.dpm=0), turbostat reports higher frequencies for single core load, up to 1300 Mhz:

    Core     CPU Avg_MHz Bzy_MHz TSC_MHz   time 
       -       -     320    1214     998      5**
       0       0       9    1226     998      5**
       1       1      13    1194     998
       2       2      41    1143     998
       3       3    1216    1216     998

"cpupower frequency-info" confirms that boost is now active.

  boost state support:
    Supported: yes
    Active: yes
Comment 1 Alex Deucher 2014-06-16 15:03:37 UTC
Please attach your dmesg output with radeon.dpm=1
Comment 2 Alex Deucher 2014-06-16 15:10:47 UTC
Created attachment 139971 [details]
enable bapm

The attached patch will allow the GPU and CPU to share TDP, but note that this is disabled by default at the moment.
Comment 3 Kertesz Laszlo 2014-06-16 19:20:16 UTC
I reported basicalle the same thing in bug #62861.
How dangerous can this change be?
As in would i have to worry about frying the APU?
Comment 4 Alex Deucher 2014-06-16 19:42:37 UTC
You may get system or GPU hangs, but it shouldn't fry anything.
Comment 5 B M 2014-06-17 06:44:33 UTC
Created attachment 140061 [details]
dmesg output (with enable bapm path)
Comment 6 B M 2014-06-17 06:47:42 UTC
Thanks Alex. The patch that enables bapm works. Boost state is now active. Frequency gets boosted in single core workloads. 

Are there any plans to make 'bapm' tunable via boot parameters or /sys?
Comment 7 Alex Deucher 2014-06-17 16:38:11 UTC
We can probably enable it by default on KV/KB systems at some point.  It had some stability issues on trinity APUs so I disabled it across the board, so it remains to be seen if there are any problems with newer APUs.
Comment 8 Alex Deucher 2014-06-17 20:55:10 UTC
Does plugging/unplugging the AC adapter cause any problems with bapm enabled?  The reason it was disabled on TN/RL parts is because there were hangs on some systems when switching to/from AC power.
Comment 9 B M 2014-06-18 07:29:18 UTC
I've been using enable_bapm for a day now, here are my observations:

* There are no issues regarding lockups. Not even when plugging/unplugging AC adapter or sleeping/resuming.

* Boost state is active on boot regardless of AC begin plugged or not. However, boost will get deactivated if at a later time AC is deplugged, and get activated again on plugging. While this may make sense in some situations, I prefer boost being always active, so for the time being I just changed the relevant code so it's always on. I guess it would make sense for it to be an option that could be tuned.

* There is some strange behaviour associated with this particular APU (A6-1450). This is probably not Linux specific as I've seen reports on it for Windows too. After boot turbo would only work for a single core and up to 1.3Ghz. But after doing a sleep/resume cycle turbo works for all 4 cores and up to full 1.4Ghz (the difference is also quite audible since the fans go wild). As if available TDP would somehow get much bigger after sleep/resume.
Comment 10 Alex 2016-01-28 09:32:14 UTC
AMD A8-5557M (Richland). APU turbo core boost still is not working.

With radeon.dpm=1

  boost state support:
    Supported: yes
    Active: no
    Boost States: 3
    Total States: 8
    Pstate-Pb0: 3100MHz (boost state)
    Pstate-Pb1: 2800MHz (boost state)
    Pstate-Pb2: 2400MHz (boost state)
    Pstate-P0:  2100MHz
    Pstate-P1:  1900MHz
    Pstate-P2:  1700MHz
    Pstate-P3:  1400MHz
    Pstate-P4:  900MHz


    |Mperf               || Idle_Stats
CPU | C0   | Cx   | Freq || POLL | C1   | C2
   0| 20,65| 79,35|  2082||  0,00| 16,43| 66,12
   1| 42,31| 57,69|  2091||  0,00|  1,22| 57,65
   2| 72,17| 27,83|  2093||  0,00|  1,44| 26,81
   3| 16,95| 83,05|  2090||  0,00|  3,68| 82,30


With radeon.dpm=0

  boost state support:
    Supported: yes
    Active: yes


   |Mperf               || Idle_Stats
CPU | C0   | Cx   | Freq || POLL | C1   | C2
   0| 51,88| 48,12|  2731||  0,00|  6,83| 42,66
   1| 38,85| 61,15|  2742||  0,00|  0,40| 61,93
   2| 42,05| 57,95|  2821||  0,00| 32,44| 27,37
   3| 73,37| 26,63|  2825||  0,00| 11,34| 15,95
Comment 11 Alex 2016-01-28 09:46:06 UTC
(In reply to Alex from comment #10)
> AMD A8-5557M (Richland). APU turbo core boost still is not working.
> 
> With radeon.dpm=1
> 
>   boost state support:
>     Supported: yes
>     Active: no
>     Boost States: 3
>     Total States: 8
>     Pstate-Pb0: 3100MHz (boost state)
>     Pstate-Pb1: 2800MHz (boost state)
>     Pstate-Pb2: 2400MHz (boost state)
>     Pstate-P0:  2100MHz
>     Pstate-P1:  1900MHz
>     Pstate-P2:  1700MHz
>     Pstate-P3:  1400MHz
>     Pstate-P4:  900MHz
> 
> 
>     |Mperf               || Idle_Stats
> CPU | C0   | Cx   | Freq || POLL | C1   | C2
>    0| 20,65| 79,35|  2082||  0,00| 16,43| 66,12
>    1| 42,31| 57,69|  2091||  0,00|  1,22| 57,65
>    2| 72,17| 27,83|  2093||  0,00|  1,44| 26,81
>    3| 16,95| 83,05|  2090||  0,00|  3,68| 82,30
> 
> 
> With radeon.dpm=0
> 
>   boost state support:
>     Supported: yes
>     Active: yes
> 
> 
>    |Mperf               || Idle_Stats
> CPU | C0   | Cx   | Freq || POLL | C1   | C2
>    0| 51,88| 48,12|  2731||  0,00|  6,83| 42,66
>    1| 38,85| 61,15|  2742||  0,00|  0,40| 61,93
>    2| 42,05| 57,95|  2821||  0,00| 32,44| 27,37
>    3| 73,37| 26,63|  2825||  0,00| 11,34| 15,95

Tested on kernel 4.4
Comment 12 Alex Deucher 2016-01-28 16:38:57 UTC
Setting radeon.bapm=1 will enable it.
Comment 13 Alex 2016-01-28 21:30:17 UTC
(In reply to Alex Deucher from comment #12)
> Setting radeon.bapm=1 will enable it.

It works! Thank You.
Comment 14 mirh 2020-12-03 17:42:25 UTC
OP has a Temash/Kabini APU, that afaict has bapm enabled by default since 3.16. 

Can this be closed?