New: AMD Zen 2 broken power management after sleep
https://bugzilla.kernel.org/show_bug.cgi?id=219858
Bug ID: 219858
Summary: AMD Zen 2 broken power management after sleep
Product: Power Management
Version: 2.5
Hardware: AMD
OS: Linux
Status: NEW
Severity: high
Priority: P3
Component: cpufreq
Assignee: [email protected]
Reporter: [email protected]
Regression: No
I have a ThinkPad E14 Gen 3 (Ryzen 7 5700U, Zen 2) running Fedora 41 with the 6.13.5-200.fc41.x86_64 kernel. After sleep (s2idle), the device will no longer respect hints or sysfs nodes (not sure these are the right terms). At first I thought this could be related to a recent BIOS/firmware upgrade, but it wasn't a new occurance (tho, I hadn't taken any time to understand and diagnose the issue).
As an example, sometimes I'll set the profile to Power Saver (regardless if it's tuned-ppd or power-profiles-daemon), or manually set the value of /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference to power and /sys/devices/system/cpu/cpu*/cpufreq/boost to 0, and it'll boost seemingly arbitrarily even if CPU load is low. To keep track of a few stats, quickly wrote the following script:
```bash
#!/bin/bash
# Battery
batteryPath="/sys/class/power_supply/BAT0"
batteryStatus=$(cat "$batteryPath/status")
# Fan
currentLevel=$(cat /proc/acpi/ibm/fan | grep "level:" | awk '{print $2}')
fanSpeed=$(sensors | grep 'fan1:' | tail -c 10 | tr -d ' ' | sed 's/RPM//')
# CPU
cpuTemp=$(sensors | grep 'CPU:' | tail -c 10 | tr -d ' ' | sed 's/°C//')
cpuFreq=$(awk -F ': ' '/cpu MHz/ {print int($2)}' /proc/cpuinfo | sort -nr |
head -n 1)
# Power consumption
consumption=$(expr $(cat "$batteryPath/power_now") / 100000)
units=$(expr $consumption / 10)
decimal=$(expr $consumption % 10)
consumption=$units.$decimal
echo "Battery: $consumption W ($batteryStatus)"
echo "Fan Speed: $fanSpeed RPM ($currentLevel)"
echo "Temperature: $cpuTemp°C ($cpuFreq MHz)"
```With this script, I can verify that the max frequency (between all threads) before suspending is typically around 1.4GHz for the task at hand and, after suspending, is glued to 4.3GHz almost permanently for the same task (near idle). I've also taken the time, in multiple different scenarios, to see how many threads were hitting those clock speeds, and it always seemed to be 2 to 4, with every other thread between 2 and 3GHz (although usually the latter, keeping in mind the base clock is 1.8GHz). This, as you'd imagine, causes a ton of unnecessary heat and energy consumption (might not manifest itself as much for lighter tasks, but can be problematic if the load is higher).
One side note is that sometimes I'd wake the laptop up and have only the first core with boost set to 0 and the rest with boost set to 1 (/sys/devices/system/cpu/cpu*/cpufreq/boost). Not sure it's relevant, but it was something I noticed.
It happens on all scaling drivers (amd_pstate=active, amd_pstate=passive, amd_pstate=guided, and amd_pstate=disable) and seems to happen exclusively on kernels 6.13 and up (6.11 doesn't display this behaviour at all, and my testing with 6.12 isn't yet very conclusive), so it's reproducible. It's not exclusive to Fedora, but may be specific to my laptop model and/or my CPU.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #1 from Diogo Carvalho ([email protected]) --- I can also confirm this is still broken on kernel 6.14.0-0.rc6.20250312gt0fed89a9.350.vanilla.fc41.x86_64 (from
https://fedoraproject.org/wiki/Kernel_Vanilla_Repositories). Here's a video showcasing the behaviour in question:
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #2 from Diogo Carvalho ([email protected]) --- Couldn't find any kernel newer than 6.12.15 that I can easily run on my Fedora installation, so I've switched to 6.12.15-200.fc41.x86_64
(https://koji.fedoraproject.org/koji/buildinfo?buildID=2661636) and added a versionlock for now. Can confirm the behaviour hasn't presented itself, meaning it's solely affecting 6.13 and newer.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
Diogo Carvalho ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected] Regression|No |Yes
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #3 from Mario Limonciello (AMD) ([email protected]) --- On 6.14-rc can you please run this script before suspend and after suspend and share the text reports it generates?
https://web.git.kernel.org/pub/scm/linux/kernel/git/superm1/amd-debug-tools.git/tree/amd_pstate.py
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #4 from Mario Limonciello (AMD) ([email protected]) --- Also; if possible can you please see if you can reproduce it on this branch?
https://web.git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/log/?h=linux-next
This is the code that is going into 6.15-rc1. If it's fixed there, I might be able to identify a commit to backport to 6.14.y.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #5 from Diogo Carvalho ([email protected]) --- Before:
```
2025-03-21 16:08:24,596 INFO: 🐧 Kernel: 6.14.0-0.rc6.49.fc42.x86_64
2025-03-21 16:08:24,596 INFO: 'status': active
2025-03-21 16:08:24,597 INFO: 'prefcore': disabled
2025-03-21 16:08:24,637 INFO: 💻 CPU: AMD Ryzen 7 5700U with Radeon
Graphics
2025-03-21 16:08:24,643 INFO: 🔋 Per-CPU sysfs files
+---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------+
| CPU # | CPU Min Freq | CPU Nonlinear Freq | CPU Max Freq | Scaling
Min Freq | Scaling Max Freq | Energy Performance Preference | Prefcore |
Boost |
|---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------|
| 0 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 1 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 2 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 3 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 4 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 5 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 6 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 7 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 8 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 9 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 10 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 11 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 12 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 13 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 14 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 15 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
+---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------+
2025-03-21 16:08:24,654 WARNING: 🚦 MSR checks unavailable
```After:
```
2025-03-21 16:09:31,138 INFO: 🐧 Kernel: 6.14.0-0.rc6.49.fc42.x86_64
2025-03-21 16:09:31,138 INFO: 'status': active
2025-03-21 16:09:31,138 INFO: 'prefcore': disabled
2025-03-21 16:09:31,155 INFO: 💻 CPU: AMD Ryzen 7 5700U with Radeon
Graphics
2025-03-21 16:09:31,157 INFO: 🔋 Per-CPU sysfs files
+---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------+
| CPU # | CPU Min Freq | CPU Nonlinear Freq | CPU Max Freq | Scaling
Min Freq | Scaling Max Freq | Energy Performance Preference | Prefcore |
Boost |
|---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------|
| 0 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 1 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 2 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 3 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 4 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 5 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 6 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 7 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 8 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 9 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 10 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 11 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 12 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 13 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 14 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
| 15 | 400000 | 1114000 | 4373000 |
1114000 | 1801000 | power | 255 |
1 |
+---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------+
2025-03-21 16:09:31,162 WARNING: 🚦 MSR checks unavailable
```After (setting power saving mode again):
```
2025-03-21 16:08:51,541 INFO: 🐧 Kernel: 6.14.0-0.rc6.49.fc42.x86_64
2025-03-21 16:08:51,542 INFO: 'status': active
2025-03-21 16:08:51,542 INFO: 'prefcore': disabled
2025-03-21 16:08:51,557 INFO: 💻 CPU: AMD Ryzen 7 5700U with Radeon
Graphics
2025-03-21 16:08:51,559 INFO: 🔋 Per-CPU sysfs files
+---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------+
| CPU # | CPU Min Freq | CPU Nonlinear Freq | CPU Max Freq | Scaling
Min Freq | Scaling Max Freq | Energy Performance Preference | Prefcore |
Boost |
|---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------|
| 0 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 1 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 2 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 3 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 4 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 5 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 6 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 7 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 8 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 9 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 10 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 11 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 12 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 13 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 14 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
| 15 | 400000 | 1114000 | 1801000 |
1114000 | 1801000 | power | 255 |
0 |
+---------+----------------+----------------------+----------------+--------------------+--------------------+---------------------------------+------------+---------+
2025-03-21 16:08:51,563 WARNING: 🚦 MSR checks unavailable
```I can confirm that it still boosts over the supposed max frequency, regardless.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #6 from Mario Limonciello (AMD) ([email protected]) --- Got it; this is a non-MSR system.
Try this patch
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
--- Comment #7 from Diogo Carvalho ([email protected]) --- not sure that was the best way to send the report, sorry!
Regarding the kernel, I'll try to compile and test it later today. If not, probably only on Monday
The issue doesn't seem to be regarding any specific scaling driver, tho, as I said. It's something else, as it affects every scaling driver (including the generic acpi driver)
Thanks!
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.
[Bug 219858] AMD Zen 2 broken power management after sleep
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=219858
Mario Limonciello (AMD) ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|[email protected] |[email protected]--- Comment #8 from Mario Limonciello (AMD) ([email protected]) ---
Quoted 1 line
not sure that was the best way to send the report, sorry!
Yeah attachment would have been better. But no worry, hopefully it's the root cause I suspect and thus a duplicate of
https://bugzilla.kernel.org/show_bug.cgi?id=217931
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are the assignee for the bug.