RyzenAdj icon indicating copy to clipboard operation
RyzenAdj copied to clipboard

Throttling keeps happening on Ryzen5 5500U (Lucienne)

Open hikagura99 opened this issue 1 year ago • 12 comments

Hi, I'm on a HP 255 G8 laptop with an AMD R5 5500U (Lucienne) APU, running on Arch Linux, BIOS version F25 (can't seem to be able to update it on Linux, even though from the various release notes nothing has been done on this aspect). As you might already know, this APU has a nominal frequency of 2.1GHz, a boost freq of 4.06GHz and an iGPU of 1.8GHz of power, with a TDP ranging from 10 to 25W. On my device it seems that, even those are the official specs, there's no way for me to make it run on stable 25W. I tried, I think, every trick and combinations on the book, both via your script and via Smokeless_UMAF (e.g. turning off STAPM, changing CPPC values, changing POR configuration to 54W, changing the various PPTs, etc.). It doesn't matter what I do, it runs for a while at 25W, and then it throttles to 10W, and it won't go back to 25W until it acknwoledges it's on low load. I think it's also important to note that it's not a thermal issue: the CPU hardly gets near 70 degrees in this state, and i set 90°C as its limit. Plus looking on other tools (such as lact) when throttling happnes it clearly states it's an issue of FPPT and SPPT most of the time, some other times it states something on the line of "APU_C_CURRENT" if I remember correctly. When the undervolting happens, the values also change on the ryzenadj prompt, then it returns as previously set when workload is reduced. I don't know if it's useful, but my AC adapter is the official HP one, of 45W, and a stronger 90W one is on its way.

These are the maximum values I'm able to set via the script, note that right now STAPM is turned off on the BIOS, and right now CPPC is set to have a maximum and minimum frequency of 3.2GHz (0xC9) on heavy load, since I read it's its safe overclocking limit, and an EPP of 0. The global C states as well are turned off as of now.

Image

Let me know if there's anything I could add, that's all for now. Thank you.

hikagura99 avatar Feb 14 '25 08:02 hikagura99

Helloo, I have the same model same exact apu, I have f26 version, if i reca correctly it has a bug with sleep state S3 so it causes crash after suspend awake. Anyway I was looking for ways to control the fan or the power for the exact same reason, avoiding that annoying throttling, for what i've looked there is no control over fan, I have to try out notebook fan control for Linux . The command sudo pwmconfig doesn't find any pwm, I tried to look for pwm and found pwm1_enable which is set to 2, it should mean auto mode, it is not writable on my opensuse tumbleweed, even with sudo permission. I'd ove to know more about tricks for this model to have more control on it.

AliothCancer avatar Feb 16 '25 21:02 AliothCancer

@AliothCancer i found a solution. A quite bodgey at one, but at least it kinda works: I fixed it by writing a bash scripts that checks every 5 seconds whether values have changed or not, and resets them, and then I added it to systemd as a daemon. Here's the code:

#!/bin/bash

# Target values in mW (milliwatts)
TARGET_FAST=25000
TARGET_SLOW=25000
 
    
while true; do
    OUTPUT=$(ryzenadj --info)
    
    # Extract PPT FAST LIMIT (e.g., "25.000" W = 25000 mW)
    CURRENT_FAST=$(echo "$OUTPUT" | grep -i 'PPT LIMIT FAST' | awk -F '|' '{print $3}' | xargs | tr -d '.')
    
    # Extract PPT SLOW LIMIT (e.g., "20.000" W = 20000 mW)
    CURRENT_SLOW=$(echo "$OUTPUT" | grep -i 'PPT LIMIT SLOW' | awk -F '|' '{print $3}' | xargs | tr -d '.')

    # Reset fast limit if it drops to 15000 mW (15.000 W)
    if [[ "$CURRENT_FAST" -ne $"TARGET_FAST" ]]; then
        ryzenadj --fast-limit="$TARGET_FAST"
    fi

    # Reset slow limit if it drops to 15000 mW (15.000 W)
    if [[ "$CURRENT_SLOW" -ne "TARGET_SLOW" ]]; then
        ryzenadj --slow-limit="$TARGET_SLOW"
    fi

    sleep 5
done

And here's the daemon (note that i named the script ppt-monitor.sh, if you call it something else change that line):


[Unit]
Description=PPT Limit Monitor Service
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/local/bin/ppt-monitor.sh
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Then changed the various VRM values to the maximum permitted by the MoBo, which in my case are 33000, 15000, 96000 and 20000 respectively.

I also tinkered some values in the bios via the aforementioned Smokeless_UMAF, which I can't you tell exactly what are they atm but if you want them I can give them to you.

To top it off I am running the kernel with processor.ignore_ppc=1 amdgpu.ignore_ppc=1 amdgpu.ppfeaturemask=0xffffffff as kernel parameters, which I found them to help a little, even if not drastically.

Sometimes when it exceeds VRM it still throttles to 2.1GHz but it can be avoided by being careful, and after sometime it returns to the normal regime. At least it has a somewhat of a stable performance.

hikagura99 avatar Feb 18 '25 16:02 hikagura99

@hikagura99 Thank you really much for your work, it really appreciated! Then I noticed, tracking battery health, that with great power consumption the battery really suffer, the health lowers down, I keep the battery health around 85-86% of total health, maybe with cpupower we can also force a frequency. I'll try to use your script :).

AliothCancer avatar Feb 18 '25 21:02 AliothCancer

@AliothCancer for that, i just switched to a more powerful ac adaptor. the official one had 45w of consumption, i picked a 90w one. now the battery doesn't drain anymore when plugged

hikagura99 avatar Feb 19 '25 10:02 hikagura99

@hikagura99 Are you sure that having a more powerful charger make the power come directly from the AC? cuz even under stress my laptop can charge, it's 45W max, battery on 80% charge would suck about 20W (not so sure but quite, im remembering) then apu 25W, it's already 45W, then the screen, but it is about less then 5W, that would come from the battery, so I don't think this would explain the very rapid health degrading, like from 86% to 82%, it's 4% health lost for 1/2 hour of heavy activity.

Moving on, I also wrote some code, I wanted to monitor the power with ryzenadj, then I added other code to control fast and slow limit like in your script :).

It just parses the output of ryzenAdj -i, then if limit changes it resets the params to the provided target values.

About monitoring, I put a bool variable "write_to_csv" to decide if the program write down some value with a formatted datetime every second (nearly), and then maybe make some plots with that csv. It writes down a csv file at repo_root/datas/power_data.csv . If you want to write new data you can just delete the file that comes with the repo and at first program execution it will be asked if you want to create a new file.

Thinking on adding temperature in future.

Here the repo if interested: https://github.com/AliothCancer/ryzen_adj_5500u

AliothCancer avatar Feb 22 '25 21:02 AliothCancer

suffering something similar, could you give me this?

I also tinkered some values in the bios via the aforementioned Smokeless_UMAF, which I can't you tell exactly what are they atm but if you want them I can give them to you.

heav33n avatar May 06 '25 01:05 heav33n

suffering something similar, could you give me this? https://github.com/DavidS95/Smokeless_UMAF

hikagura99 avatar Jul 06 '25 08:07 hikagura99

suffering something similar, could you give me this? https://github.com/DavidS95/Smokeless_UMAF

i meant the values

heav33n avatar Jul 06 '25 20:07 heav33n

I think something that could also make some difference is the amd_pstate kernel boot option, I cannot show data, unfortunately I can just say the amd_pstate=passive seems to be less prone to throttling.

you can see this link for other parameter's option

AliothCancer avatar Jul 18 '25 06:07 AliothCancer

You possibly have STT (system temperature tracking) enabled.

arabcian avatar Aug 17 '25 12:08 arabcian

You possibly have STT (system temperature tracking) enabled.

yeah, sadly dell doesnt have any way to disable it in amd chipsets, I tried to use UMAF, the changes persisted but they were not reflected in the BIOS utility (H2OUVE), we also tried Srep with no luck whatsoever.

heav33n avatar Aug 17 '25 16:08 heav33n

You possibly have STT (system temperature tracking) enabled.

yeah, sadly dell doesnt have any way to disable it in amd chipsets, I tried to use UMAF, the changes persisted but they were not reflected in the BIOS utility (H2OUVE), we also tried Srep with no luck whatsoever.

You could check if AmdVariableProtection is enabled or not in your bios. If it isnt enabled never update your bios and research about setup_var. Ive not much time explain it right now but to get the idea check what setup_var does.

arabcian avatar Aug 31 '25 10:08 arabcian