Bug 207667

Summary: power_dpm_force_performance_level set to "low" reduces CPU performance (Vega 8 / Ryzen 2200G)
Product: Drivers Reporter: alekshs
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: RESOLVED INVALID    
Severity: low    
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.6.8 Subsystem:
Regression: No Bisected commit-id:

Description alekshs 2020-05-09 20:48:35 UTC
I've been on a power saving quest lately, trying various different things. One of the things that I don't particularly need in my Ryzen 2200G is GPU performance. So it made sense to reduce the 400 MHz clock to lower levels to gain in power efficiency.

I echoed "low" to power_dpm_force_performance_level and indeed my power consumption dropped while the frequency went down from 400MHz to 200MHz. I now see Vsoc went from 1.01v to 0.91v and Isoc went from 3.5A to 1.75A.

What I did not expect was that I would see performance issues in terms of CPU tasks.

CPU tasks like SHA256 hashing are unaffected.
CPU tasks that involve RAM, like lrzip, cinebench 15 (under wine), etc, show a considerable drop in performance. CB15 cpu score loses >10% while an lrzip file compression went from 14 to 21 seconds. I also did a geekbench 5 comparison (more of that in the end - with links).

I measured cache and memory bandwidth, it seems to be the same whether I have power_dpm_force_performance_level set to low or auto, so downclocking the integrated graphics of the ryzen didn't impact memory speeds. Maybe it's an interactivity thing / irq thing or something that makes tasks wait? Or maybe it's a power delay issue as the SOC has to increase watts on demand? I don't know - someone has to find out.

I think it's abnormal behavior for the IGP clock to cause CPU applications to slow down - especially by more than 50% in some cases:

I've run 2 geekbench 5.0 benchmarks, with the only difference being "low" and "auto" on the power_dpm_force_performance_level:

Low: https://browser.geekbench.com/v5/cpu/2096508
Auto: https://browser.geekbench.com/v5/cpu/2096537

If you scroll down you see some tasks are very heavily affected while others aren't.

For example multithreaded raytracing is at 4900 in both instances. But multithreaded speech recognition is 900 vs 1800, while AES is 2100 vs 4500. Huge differences.
Comment 1 alekshs 2020-05-14 05:47:48 UTC
I think I discovered what's the issue by playing with a utility called RyzenAdj.

With RyzenAdj when setting the igp freq to 200 from 400 it doesn't do much for power consumption. It's when I play with the CPU-GPU speed parameter (fabric speed?) that power consumption goes down significantly. 

So apparently power_dpm_force_performance_level to low sets both MHz and fabric speed lower. The first wouldn't make sense to affect CPU performance, the second is known to affect it - so after thinking about it more, I don't think it's a bug.