You are not logged in.
I've been gaming on my laptop for a while now, and in that time I've learned that having it plugged into AC gives me a significant performance boost. I had always assumed that that was the case because I had laptop-mode-tools setting my cpu frequency governor to powersave when I was on battery and performance when I was plugged into AC. (the scaling driver I use is adm-pstate-epp) However, it can get really annoying for me to constantly have my laptop charging if I want to play more intensive games, not to mention harmful for the battery, so today I tried figuring out how to make it so that I get the same performance on battery.
I tried doing this by manually setting the cpu frequency governor to performance using cpupower. However, that didn't work. Both a call to 'cpupower frequency-info' and a direct reading of '/sys/bus/cpu/devices/cpu0/cpufreq/scaling_governor' confirmed that the governor was in fact set to 'performance', but the framerates were still significantly lower. I tried checking settings in steam, since that's how I play most of my games, but couldn't find anything relating to throttling in regards to charging state. Furthermore, after stopping laptop-mode-tools I noticed that my cpu governor still changed when I start charging my laptop and then stopped, and that the issue persisted when I tried manually setting it again.
As of now, I'm at a loss. Looking at btop didn't reveal anything too different between the two states, nor did the output of 'cpupower frequency-info'. so I cant tell what's causing the drastic performance decrease in the first place. If anyone here has experience with these things or has encountered this issue before, I'd love to hear your insights.
Last edited by Elizabeth (2025-03-17 21:37:39)
Offline
Is the CPU actually the limiting factor? Might also boost the GPU.
time echo "scale=5000; a(1)*4" | bc -l # don't post the calculation result, only the spent time is reelvant
Offline
Is the CPU actually the limiting factor? Might also boost the GPU.
time echo "scale=5000; a(1)*4" | bc -l # don't post the calculation result, only the spent time is reelvant
I ran the command with my laptop plugged in and out, these were the results:
Battery:
echo "scale=5000; a(1)*4" 0.00s user 0.00s system 56% cpu 0.002 total
bc -l 13.31s user 0.00s system 99% cpu 13.350 total
AC:
echo "scale=5000; a(1)*4" 0.00s user 0.00s system 43% cpu 0.002 total
bc -l 13.25s user 0.00s system 99% cpu 13.287 total
Offline
After reading the amdgpu article on archwiki I decided to monitor the activity via radeontop and this time I noticed a difference in two key results: "Memory Clock" and "Shader Clock"
(all results given with little to no load running on the gpu)
Battery:
0.4G / 1.33G Memory Clock 30.01%
0.2G / 1.80G Shader clock 11.11%
AC:
1.20G / 1.33G Memory Clock 90.02%
0.4G / 1.80G Shader clock 22.22%
Just looking at the values given over some time and it looks like they average to around 90% and ~28% on AC, and an exact 30.01% and 11.11% on battery, since they don't seem to change on battery at all, and I mean *at all*, even when I boot up an intensive game. It would seem that this is what's causing the drastic decrease in performance rather than my cpu speed, but I am not sure what could be causing these limits to change in the first place.
Last edited by Elizabeth (2025-04-12 22:54:57)
Offline
After some more tinkering I've determined that
1) I'm an idiot (I didn't properly disable laptop-mode-tools in my original post)
2) Laptop mode tools is what's changing my CPU governor and GPU settings, thought I can't determine which module is responsible for changing the GPU settings as of yet
Offline
I have found the module responsible, and how to manually control it,
The module in question is radeon-dpm.conf, and the archwiki ATI article subsection "Power Saving" goes over how to change it.
In practice it seems that laptop-mode-tools sets the power_dpm_force_performance_level to 'low' or 'auto' depending on whether the laptop is on battery or AC power. In practice I could manually change those settings, but I think it might be easier to just disable laptop-mode-tools via a bash script, when I plug my laptop in, and then unplug it, conserving the AC settings that it enforces.
The bash script I wrote for this is a simple one that just ensures you're not putting your laptop into a permanent "low performance" mode. (my first actual bash script so I'm unsure of its safety, even if it does work.)
#! /bin/bash
set -e
set -o pipefail
function error {
echo "Error: $1"
}
bat_path=/sys/class/power_supply/BAT0/status
laptop_mode_tools_config=/etc/laptop-mode/laptop-mode.conf
# Check that the paths exist
if [[ ! -e $bat_path ]]; then
error "File $bat_path does not exist."
exit 1
elif [[ ! -e $laptop_mode_tools_config ]]; then
error "File $laptop_mode_tools_concifg does not exist."
exit 1
fi
# Find the current status
bat_status=$(cat $bat_path)
tools_enabled=$(cat $laptop_mode_tools_config | grep "ENABLE_LAPTOP_MODE_TOOLS")
if [[ $tools_enabled == *"=1" ]]; then
mode=1
else
mode=0
fi
# We do not want to permanently stick our laptop into the low pefromance mode
if [[ $bat_status != "Charging" && $mode -eq 1 ]]; then
error "Battery has to be charging."
exit 1
fi
# Safety backup
sudo cp $laptop_mode_tools_config ${laptop_mode_tools_config}.backup
if [[ $mode -eq 1 ]]; then
sudo sed -i 's/ENABLE_LAPTOP_MODE_TOOLS=1/ENABLE_LAPTOP_MODE_TOOLS=0/' $laptop_mode_tools_config
else
sudo sed -i 's/ENABLE_LAPTOP_MODE_TOOLS=0/ENABLE_LAPTOP_MODE_TOOLS=1/' $laptop_mode_tools_config
fi
Last edited by Elizabeth (2025-03-16 16:00:10)
Offline
\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
On a formal note, please avoid bumping. Just edit your previous post if nobody has so far replied.
Offline