0

So I'd like to be able to use my laptop however I want while it's discharging. Problem is, my Acer Aspire 5 has two AMD GPUs: AMD R7 M440, which is my integrated gpu and RX540, the dedicated gpu. When my laptop is plugged in, CPU frequency goes all the way up to 2.7Ghz and I'm able to play my Steam games, no problem. But if it isn't plugged in, CPU frequency won't go beyond 1.8Ghz (for ondemand) and 1.4Ghz (for powersave); performance does not work while laptop is running on battery, which is weird because my processor is an AMD A12 APU. I know this could be a symptom of intel's Pstate but I don't know whether AMD has an equivalent to that. Please let me know if it does, so I can disable it. I'd like my laptop to have the same performance while discharging as it does when it's plugged into the outlet. For what I can tell, either something is preventing ACPI governors from changing the cpu frequency or this could be a new kernel feature that I'm not aware of. And if you're wondering what my UEFI/BIOS settings are, they don't even exist on this laptop. This is what CPUFreq-info outputs: https://pastebin.com/FeApPeDC CPU Power-frequency output: https://pastebin.com/Wuy7fnwa CPUFreq drivers: https://pastebin.com/FSAGjg4t

Questions: A) How can I edit a governor's minimum and maximum frequency? I tried to nano /sys/devices/system/cpu/cpu0/cpufreq/"scaling_min_frequency" but it won't let me edit as root.

B) What is really keeping my CPU Frequency from going all the way up to 2.7Ghz even when my laptop is on battery for an AMD CPU?

C) Can I set a governor arguments as a parameter for a launcher? The idea behind this is that whenever a game is launched, the application would set the governor itself, so I could have this as a Steam game launcher parameter:

DRI_PRIME=1 %command% cpupower frequency-set -f 2700000 (That would be the equivalent to right-clicking a game icon and choosing to launch it with dGPU and all settings maxed out)

Please let me know if you need an output from a command, I'll be happy to provide it. Thanks.

0

Question A:

One way to set /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_frequency, which is now actually /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq is to look at the available frequencies, and pick one. Example:

doug@s17:~$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
800000
doug@s17:~$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
2400000 2133000 1867000 1600000 800000
doug@s17:~$ echo 1867000 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
1867000
doug@s17:~$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
1867000
doug@s17:~$

However you really need to do that for all CPUs and you need to use an available frequency for your system, as the example was for mine.
Note also, that you seem to be using the userspace governor. The above was for the ondemand governor.

Now, if for whatever reason, the maximum CPU frequency has already been limited to below what you are trying to set, then the above will fail with an Invalid argument message. In that case you will need to restore the maximum frequency first. Example:

doug@s17:~$ echo 1600000 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
1600000
doug@s17:~$ echo 1867000 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
1867000
tee: /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq: Invalid argument
doug@s17:~$ echo 2400000 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
2400000
doug@s17:~$ echo 1867000 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
1867000

As a side note: The easiest way to achieve your objective might be to just switch to the performance governor. For example run the following as sudo:

doug@s15:~/temp$ cat set_cpu_performance
#! /bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Similarly for ondemand:

doug@s15:~/temp$ cat set_cpu_ondemand
#! /bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "ondemand" > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Question B:

I'm not sure. Do you have tlp running? Maybe it is doing it. It might also be your BIOS. It is not any of the normal governors in the acpi-cpufreq CPU frequency scaling driver. However, you need to examine the userspace governor that you seem to be using, as it might be limiting things.

Question C:

I don't know.

Other notes:

I know this could be a symptom of intel's Pstate

It is not.

I don't know whether AMD has an equivalent to that [intel_pstate driver]. Please let me know if it does

From your posts, you are using the generic acpi-cpufreq driver.

  • Sorry, my first version of an answer was a complete mess. I edited it. – Doug Smythies Nov 6 '18 at 5:09
  • I tried to do:rodolfo@rodolfo-Aspire-A515-41G:~$ echo 1867000 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq But the system answers with: tee: /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq: Invalid argument What's missing? – Rodolfo Ferreira Nov 6 '18 at 10:29
  • well, from your posts, you seem to be using the userspace governor, change to ondemand. Then you need to use an available frequency for your system, not mine. I'll edit my answer to include an example. – Doug Smythies Nov 6 '18 at 15:38
  • That's what I did. First I chose ondemand as my governor. Then, I tried to follow your instructions, which resulted the same. – Rodolfo Ferreira Nov 6 '18 at 16:18
  • Is 1867000 an available frequency on your system? Oh and check what the maximum currently is, because you can not exceed it. i.e. it might need to be set first. – Doug Smythies Nov 6 '18 at 16:29
0

Before moving on and start reading, have in mind that all I've wanted to do was just to make my laptop perform at 100% for games (That applies to the system altogether), and for that I wanted to use the 'performance' governor.

So after failed attempts, I finally came to the conclusion I was going nowhere if I kept on using very old tips and hints. I asked for help in groups, teams (from googlemail, which refused all my emails claiming I was sending them a virus) and Hexchat (really, I know the community from #linuxmint wants to help, but they have NO CLUE what they're talking about). So I investigated much further on my own and, after countless hours, several documentations and much frustration, I connected a few dots and this is my solution: the linux kernel does a horrible job at scaling up the cpu frequency when my laptop's running on battery. It won't do what it's supposed to do. Let me show you:

Tools used: CPU Frequency Scaling Monitor [Mate panel applet] CPUFrequtils, libcpufreq0 Remember, these are AMD A12's frequency steps: 1.4Ghz, 1.8Ghz, 2.3Ghz and 2.7Ghz

We already know ondemand and powersave downclock the processor. But if I want to game on Linux and laptop is discharging, 'performance' should max out everything in order to run heavy duty apps or games. Otherwise, there's no reason for it to exist. But all it does is sit on 1.8Ghz, no more or less. Pathetic. At this point I was certain the tools I was using won't do any different, so I was focusing on BIOS restrictions. That could be it. This is what I came up with as a workaround:

sudo nano /sys/module/processor/parameters/ignore_ppc

That basically ignores BIOS restrictions and lets the kernel scale cpu frequency higher than 1.8Ghz. I changed it from 0 (default) to 1. After choosing 'performance' from CPU Frequency panel applet, it came up. But I wasn't convinced. So I did

xrandr --setprovideroffloadsink 0x44 0x79

In order for Xrandr to offload graphics task to my dGPU. And then:

DRI_PRIME=1 glmark2

Check this out:

//tested with 'performance' governor, running on battery, after setting ignore_ppc to 1 rodolfo@rodolfo-Aspire-A515-41G:~$ DRI_PRIME=1 glmark2 ======================================================= glmark2 2014.03+git20150611.fa71af2d ======================================================= OpenGL Information GL_VENDOR: X.Org GL_RENDERER: Radeon 500 Series (POLARIS12 / DRM 3.23.0 / 4.15.0-38-generic, LLVM 6.0.0) GL_VERSION: 3.0 Mesa 18.0.5 ======================================================= [build] use-vbo=false: FPS: 447 FrameTime: 2.237 ms [build] use-vbo=true: FPS: 504 FrameTime: 1.984 ms [texture] texture-filter=nearest: FPS: 477 FrameTime: 2.096 ms [texture] texture-filter=linear: FPS: 480 FrameTime: 2.083 ms [texture] texture-filter=mipmap: FPS: 487 FrameTime: 2.053 ms [shading] shading=gouraud: FPS: 498 FrameTime: 2.008 ms [shading] shading=blinn-phong-inf: FPS: 495 FrameTime: 2.020 ms [shading] shading=phong: FPS: 493 FrameTime: 2.028 ms [shading] shading=cel: FPS: 485 FrameTime: 2.062 ms [bump] bump-render=high-poly: FPS: 465 FrameTime: 2.151 ms [bump] bump-render=normals: FPS: 502 FrameTime: 1.992 ms [bump] bump-render=height: FPS: 501 FrameTime: 1.996 ms [effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 464 FrameTime: 2.155 ms [effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 354 FrameTime: 2.825 ms [pulsar] light=false:quads=5:texture=false: FPS: 491 FrameTime: 2.037 ms [desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 346 FrameTime: 2.890 ms [desktop] effect=shadow:windows=4: FPS: 453 FrameTime: 2.208 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 224 FrameTime: 4.464 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 251 FrameTime: 3.984 ms [buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 301 FrameTime: 3.322 ms [ideas] speed=duration: FPS: 484 FrameTime: 2.066 ms [jellyfish] : FPS: 449 FrameTime: 2.227 ms [terrain] : FPS: 120 FrameTime: 8.333 ms [shadow] : FPS: 472 FrameTime: 2.119 ms [refract] : FPS: 247 FrameTime: 4.049 ms [conditionals] fragment-steps=0:vertex-steps=0: FPS: 491 FrameTime: 2.037 ms [conditionals] fragment-steps=5:vertex-steps=0: FPS: 482 FrameTime: 2.075 ms [conditionals] fragment-steps=0:vertex-steps=5: FPS: 475 FrameTime: 2.105 ms [function] fragment-complexity=low:fragment-steps=5: FPS: 473 FrameTime: 2.114 ms [function] fragment-complexity=medium:fragment-steps=5: FPS: 480 FrameTime: 2.083 ms [loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 482 FrameTime: 2.075 ms [loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 479 FrameTime: 2.088 ms [loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 483 FrameTime: 2.070 ms ======================================================= glmark2 Score: 434

Now, lets compare it to the next result:

//tested with 'performance' governor, running on battery, no changes to ignore_ppc rodolfo@rodolfo-Aspire-A515-41G:~$ DRI_PRIME=1 glmark2 ======================================================= glmark2 2014.03+git20150611.fa71af2d ======================================================= OpenGL Information GL_VENDOR: X.Org GL_RENDERER: Radeon 500 Series (POLARIS12 / DRM 3.23.0 / 4.15.0-38-generic, LLVM 6.0.0) GL_VERSION: 3.0 Mesa 18.0.5 ======================================================= [build] use-vbo=false: FPS: 443 FrameTime: 2.257 ms [build] use-vbo=true: FPS: 492 FrameTime: 2.033 ms [texture] texture-filter=nearest: FPS: 482 FrameTime: 2.075 ms [texture] texture-filter=linear: FPS: 484 FrameTime: 2.066 ms [texture] texture-filter=mipmap: FPS: 482 FrameTime: 2.075 ms [shading] shading=gouraud: FPS: 487 FrameTime: 2.053 ms [shading] shading=blinn-phong-inf: FPS: 489 FrameTime: 2.045 ms [shading] shading=phong: FPS: 482 FrameTime: 2.075 ms [shading] shading=cel: FPS: 483 FrameTime: 2.070 ms [bump] bump-render=high-poly: FPS: 455 FrameTime: 2.198 ms [bump] bump-render=normals: FPS: 495 FrameTime: 2.020 ms [bump] bump-render=height: FPS: 494 FrameTime: 2.024 ms [effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 460 FrameTime: 2.174 ms [effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 354 FrameTime: 2.825 ms [pulsar] light=false:quads=5:texture=false: FPS: 485 FrameTime: 2.062 ms [desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 346 FrameTime: 2.890 ms [desktop] effect=shadow:windows=4: FPS: 455 FrameTime: 2.198 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 212 FrameTime: 4.717 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 247 FrameTime: 4.049 ms [buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 298 FrameTime: 3.356 ms [ideas] speed=duration: FPS: 485 FrameTime: 2.062 ms [jellyfish] : FPS: 447 FrameTime: 2.237 ms [terrain] : FPS: 119 FrameTime: 8.403 ms [shadow] : FPS: 474 FrameTime: 2.110 ms [refract] : FPS: 247 FrameTime: 4.049 ms [conditionals] fragment-steps=0:vertex-steps=0: FPS: 489 FrameTime: 2.045 ms [conditionals] fragment-steps=5:vertex-steps=0: FPS: 480 FrameTime: 2.083 ms [conditionals] fragment-steps=0:vertex-steps=5: FPS: 487 FrameTime: 2.053 ms [function] fragment-complexity=low:fragment-steps=5: FPS: 482 FrameTime: 2.075 ms [function] fragment-complexity=medium:fragment-steps=5: FPS: 366 FrameTime: 2.732 ms [loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 477 FrameTime: 2.096 ms [loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 478 FrameTime: 2.092 ms [loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 482 FrameTime: 2.075 ms ======================================================= glmark2 Score: 428

In a nutshell, all that extra headache for a mere 6 points in performance difference. Even if it was worth it, it's ridiculous, to say the least, how much of a nightmare Linux Mint 19 puts you through just because you want your laptop to perform like it should when it's discharging. Do you think your distro does any different? I bet it doesn't. Now, it's very easy to go out and tell your friends and the internet "Oh Linux is better than Windows", but it really isn't. This ISSUE with laptops has been there for YEARS! I saw it myself: topics from 2013, 2012, 2010, all the way back to 2007! Many distros have come and gone and they don't touch this because they just don't want to fix it. AND EVEN IF THEY DID, it's absurd: how come they would like more people to use Linux distros if there are no GUI to deal with system files and attributes? You know Linux distros have a long way to go when you compare it to your cellphone: You can game on your cellphone until the battery dies. It won't force you to deal with cpupower, cpufrequency, cpufreq, whatever. Nor will Windows, which is why I still have to dual-boot on this machine if I want to game. On Windows, you're just a few clicks away. 'There, I want MAX Performance when it's on battery'. Done. It gets the job done.

"Oh but why are you complaining about Linux, haven't you got what you were expecting?" No! My laptop CRUSHES those results when it's charging! In other words, after all this time, all I got was a false solution. It just tells you that you've scaled up the cpu frequency, not the system overall performance. This is what I'm talking about:

//Laptop being charged, 'performance' governor, no changes to ignore_ppc rodolfo@rodolfo-Aspire-A515-41G:~$ DRI_PRIME=1 glmark2 ======================================================= glmark2 2014.03+git20150611.fa71af2d ======================================================= OpenGL Information GL_VENDOR: X.Org GL_RENDERER: Radeon 500 Series (POLARIS12 / DRM 3.23.0 / 4.15.0-38-generic, LLVM 6.0.0) GL_VERSION: 3.0 Mesa 18.0.5 ======================================================= [build] use-vbo=false: FPS: 595 FrameTime: 1.681 ms [build] use-vbo=true: FPS: 668 FrameTime: 1.497 ms [texture] texture-filter=nearest: FPS: 649 FrameTime: 1.541 ms [texture] texture-filter=linear: FPS: 651 FrameTime: 1.536 ms [texture] texture-filter=mipmap: FPS: 649 FrameTime: 1.541 ms [shading] shading=gouraud: FPS: 665 FrameTime: 1.504 ms [shading] shading=blinn-phong-inf: FPS: 665 FrameTime: 1.504 ms [shading] shading=phong: FPS: 666 FrameTime: 1.502 ms [shading] shading=cel: FPS: 666 FrameTime: 1.502 ms [bump] bump-render=high-poly: FPS: 672 FrameTime: 1.488 ms [bump] bump-render=normals: FPS: 672 FrameTime: 1.488 ms [bump] bump-render=height: FPS: 666 FrameTime: 1.502 ms [effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 661 FrameTime: 1.513 ms [effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 651 FrameTime: 1.536 ms [pulsar] light=false:quads=5:texture=false: FPS: 637 FrameTime: 1.570 ms [desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 617 FrameTime: 1.621 ms [desktop] effect=shadow:windows=4: FPS: 634 FrameTime: 1.577 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 239 FrameTime: 4.184 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 265 FrameTime: 3.774 ms [buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 294 FrameTime: 3.401 ms [ideas] speed=duration: FPS: 587 FrameTime: 1.704 ms [jellyfish] : FPS: 613 FrameTime: 1.631 ms [terrain] : FPS: 411 FrameTime: 2.433 ms [shadow] : FPS: 661 FrameTime: 1.513 ms [refract] : FPS: 552 FrameTime: 1.812 ms [conditionals] fragment-steps=0:vertex-steps=0: FPS: 646 FrameTime: 1.548 ms [conditionals] fragment-steps=5:vertex-steps=0: FPS: 633 FrameTime: 1.580 ms [conditionals] fragment-steps=0:vertex-steps=5: FPS: 644 FrameTime: 1.553 ms [function] fragment-complexity=low:fragment-steps=5: FPS: 627 FrameTime: 1.595 ms [function] fragment-complexity=medium:fragment-steps=5: FPS: 629 FrameTime: 1.590 ms [loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 635 FrameTime: 1.575 ms [loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 629 FrameTime: 1.590 ms [loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 627 FrameTime: 1.595 ms ======================================================= glmark2 Score: 599

In conclusion, I do NOT recommend using Linux on your laptop if you want to game on it. It's a frustration-guaranteed experience. And that's not me talking out of my frustration, that's the truth. Maybe come back in 2037 and see if they will have developed a GUI to deal with cpupower, cpufreq, overall system performance, etc. But I highly doubt that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.