vagnum08 / cpupower-gui

cpupower-gui is a graphical program that is used to change the scaling frequency limits of the cpu, similar to cpupower.
GNU General Public License v3.0
476 stars 31 forks source link

cpupower-gui performance profile is not persistent. #117

Open panorain opened 8 months ago

panorain commented 8 months ago

Hi, when I set cpupower-gui to use Performance setting at boot and apply. A reboot reverts back to Scedutil governor. I am able to manually set cpupower-gui to use performance settings again. Why is Performance setting or a custom profile not persistent? Is the problem related to a permission issue perhaps?

/home/pj/.config
 drwx------ 1 pj pj   86 Jan 25 10:38 cpupower_gui

~/.config/cpupower_gui> ls -lah total 8.0K drwx------ 1 pj pj 86 Jan 25 10:38 . drwx------ 1 pj pj 3.6K Mar 10 01:44 .. -rw-r--r-- 1 pj pj 140 Mar 10 01:39 00-cpg.conf -rw-r--r-- 1 pj pj 114 Jan 25 10:38 cpg-Lenovo-M57p-Profile1.profile

To Reproduce Steps to reproduce the behaviour:

  1. Set cpupower-gui to use performance setting at boot and apply.
  2. Powercycle/Restart - Machine
  3. Notice cpupower-gui has reverted to using the Schedutil governer option

Expected behaviour I expected cpupower-gui to allow for persistent performance setting once machine is powercycled.

Setup (please complete the following information):

Additional context Thank you for the nice program.

ECO1AI commented 6 months ago

check that cpupower-gui systemd service is working : systemctl status cpupower-gui

do you have tlp installed ? some programs set intel p-state to passive after cpupower applys the profile. which overwrites governor to scedutil.

panorain commented 6 months ago

Thank you for responding, Between the time I wrote my initial message and hearing from you this > https://github.com/vagnum08/cpupower-gui#system-configuration-and-user-profiles < did not work for me. Please do feel free to discuss this if you have further questions as to why. I can display the current configuration file contents on the machine if desired.

tlp is not installed on this machine. This is a desktop machine. How can I find out more about which program could be setting the intel p-state to passive?

-

:~> systemctl status cpupower-gui ○ cpupower-gui.service - Apply cpupower-gui config at boot Loaded: loaded (/usr/lib/systemd/system/cpupower-gui.service; enabled; preset: disabled) Active: inactive (dead) since Mon 2024-05-27 20:38:27 CDT; 8h ago Docs: https://github.com/vagnum08/cpupower-gui man:cpupower-gui(1) Process: 1144 ExecStart=/usr/bin/cpupower-gui config (code=exited, status=0/SUCCESS) Main PID: 1144 (code=exited, status=0/SUCCESS) CPU: 222ms

May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Minimum Frequency: 2000.0 MHz, Maximum Frequency: 2667.0 MHz May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Governor: Schedutil, Online: True May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Setting CPU: 2 May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Minimum Frequency: 2000.0 MHz, Maximum Frequency: 2667.0 MHz May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Governor: Schedutil, Online: True May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Setting CPU: 3 May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Minimum Frequency: 2000.0 MHz, Maximum Frequency: 2667.0 MHz May 27 20:38:27 Thinkcentre-M57p cpupower-gui[1144]: Governor: Schedutil, Online: True May 27 20:38:27 Thinkcentre-M57p systemd[1]: cpupower-gui.service: Deactivated successfully. May 27 20:38:27 Thinkcentre-M57p systemd[1]: Finished Apply cpupower-gui config at boot.

-

I created a systemd service with a script and able to set persistent ondemand governor mode this way now (I think). I'm using ondemand not performance governor for now.

  1. Create service file in directory /etc/systemd/system named > cpupower-ondemand-governor.service
  2. File permissions are > -rw-r--r-- 1 root root 316 Apr 20 23:23 cpupower-ondemand-governor.service
  3. Service file contents > /etc/systemd/system > cat cpupower-ondemand-governor.service [Unit] Description=Enable cpupower-ondemand-governor on this machine After=multi-user.target

    graphical.target - multi-user.target

[Service] Type=oneshot RemainAfterExit=true StandardOutput=tty ExecStart=/usr/local/sbin/cpupower-ondemand-governor.sh

[Install] WantedBy=multi-user.target WantedBy=graphical.target

  1. Create script file in directory /usr/local/sbin named > cpupower-ondemand-governor.sh
  2. File permissions are > -rwxr-xr-x 1 root root 206 Apr 20 23:20 cpupower-ondemand-governor.sh
  3. Script file contents are > /usr/local/sbin > cat cpupower-ondemand-governor.sh

    !/bin/bash

    cpupower frequency-set --governor ondemand echo "the script works" >> /tmp/cpupower-ondemand-governor.txt logger -t cpupower-ondemand-governor.sh -p local1.info "Enabling ondemand-cpu-governor"

    /etc/systemd/system> cpupower frequency-info analyzing CPU 2: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 2 CPUs which need to have their frequency coordinated by software: 2 maximum transition latency: 10.0 us hardware limits: 2.00 GHz - 2.67 GHz available frequency steps: 2.67 GHz, 2.00 GHz available cpufreq governors: ondemand performance schedutil current policy: frequency should be within 2.00 GHz and 2.67 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency: Unable to call hardware current CPU frequency: 2.41 GHz (asserted by call to kernel) boost state support: Supported: no Active: no

-

What are your thoughts about this? Why does passing systemctl status cpupower-gui display the schedutil governor still being used? When I open the cpupower-gui application from the KDE6 menu the Ondemand governor is being selected by default now. cpupower-gui-Ondemand-governor-being-used-as-default-0

-Best wishes

ECO1AI commented 5 months ago
Active: inactive (dead) since Mon 2024-05-27 20:38:27 CDT; 8h ago

you have an issue here

the service should be always active.

 set persistent ondemand governor

it should never be persistent, this way there might be two apps opposing each other trying to change governor.

the issue is that on boot an app changes CPU governor from active (performance or power-save) to passive (where the default is Scedutil .

to revert this try : echo "active" | sudo tee /sys/devices/system/cpu/intel_pstate/status confirm to me if this worked with you.

panorain commented 5 months ago

Hi, I believe what you say is to disable/remove the service I created. It is like a bad patch.

There is no intel_pstate directory on this machine : :~> echo "active" | sudo tee /sys/devices/system/cpu/intel_pstate/status [sudo] password for root: tee: /sys/devices/system/cpu/intel_pstate/status: No such file or directory active

:/sys/devices/system/cpu> ls -lah total 0 drwxr-xr-x 13 root root 0 Jun 2 23:09 . drwxr-xr-x 10 root root 0 Jun 2 23:09 .. drwxr-xr-x 8 root root 0 Jun 2 23:09 cpu0 drwxr-xr-x 8 root root 0 Jun 3 09:57 cpu1 drwxr-xr-x 8 root root 0 Jun 3 10:09 cpu2 drwxr-xr-x 8 root root 0 Jun 3 10:09 cpu3 drwxr-xr-x 7 root root 0 Jun 2 23:43 cpufreq drwxr-xr-x 2 root root 0 Jun 3 10:09 cpuidle -r-------- 1 root root 4.0K Jun 3 10:09 crash_hotplug drwxr-xr-x 2 root root 0 Jun 3 10:09 hotplug -r--r--r-- 1 root root 4.0K Jun 3 10:09 isolated -r--r--r-- 1 root root 4.0K Jun 2 23:43 kernel_max drwxr-xr-x 2 root root 0 Jun 3 10:09 microcode -r--r--r-- 1 root root 4.0K Jun 3 10:09 modalias -r--r--r-- 1 root root 4.0K Jun 3 10:09 nohz_full -r--r--r-- 1 root root 4.0K Jun 3 10:09 offline -r--r--r-- 1 root root 4.0K Jun 2 23:30 online -r--r--r-- 1 root root 4.0K Jun 2 23:19 possible drwxr-xr-x 2 root root 0 Jun 3 10:09 power -r--r--r-- 1 root root 4.0K Jun 2 23:10 present drwxr-xr-x 2 root root 0 Jun 3 10:09 smt -rw-r--r-- 1 root root 4.0K Jun 3 10:09 uevent drwxr-xr-x 2 root root 0 Jun 3 10:09 vulnerabilities

This does not appear to work.

Thanks

ECO1AI commented 5 months ago

Hi, I believe what you say is to disable/remove the service I created. It is like a bad patch.

my bad too, there must have been some misunderstanding.

what is your cpu?

panorain commented 5 months ago

CPU is, > :~> inxi -Fxz

CPU: Info: quad core model: Intel Core2 Quad Q8400 bits: 64 type: MCP arch: Penryn rev: A cache: L1: 256 KiB L2: 4 MiB Speed (MHz): avg: 2213 high: 2521 min/max: 2000/2667 cores: 1: 2521 2: 2344 3: 1995 4: 1994 bogomips: 21290 Flags: ht lm nx pae sse sse2 sse3 sse4_1 ssse3 vmx

BG2CNT commented 2 months ago

for me cpupower-gui also isn't persistent, i tried on linux mint 22 xfce and on manjaro linux

SkyLLerGithub commented 1 week ago

can you try:

systemctl --user enable cpupower-gui-user

(Without sudo)

panorain commented 1 week ago

@SkyLLerGithub systemctl --user enable cpupower-gui-user

Does not persist across boots here. Going back to using governor service script file.

panorain commented 1 week ago

@SkyLLerGithub That doesn't persist across boots either. Going back to using the systemd governor service file that I set up for now.

SkyLLerGithub commented 1 week ago

@SkyLLerGithub systemctl --user enable cpupower-gui-user

Does not persist across boots here. Going back to using governor service script file.

Can you send output of systemctl status cpupower-gui after using the above command

panorain commented 1 week ago

systemctl status cpupower-gui ○ cpupower-gui.service - Apply cpupower-gui config at boot Loaded: loaded (/usr/lib/systemd/system/cpupower-gui.service; enabled; preset: disabled) Active: inactive (dead) since Tue 2024-11-19 03:16:33 CST; 5min ago Invocation: 956f4681f1384aeb80731ced28c732ce Docs: https://github.com/vagnum08/cpupower-gui man:cpupower-gui(1) Process: 1126 ExecStart=/usr/bin/cpupower-gui config (code=exited, status=0/SUCCESS) Main PID: 1126 (code=exited, status=0/SUCCESS) CPU: 271ms

Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Minimum Frequency: 2000.0 MHz, Maximum Frequency: 2667.0 MHz Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Governor: Schedutil, Online: True Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Setting CPU: 2 Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Minimum Frequency: 2000.0 MHz, Maximum Frequency: 2667.0 MHz Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Governor: Schedutil, Online: True Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Setting CPU: 3 Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Minimum Frequency: 2000.0 MHz, Maximum Frequency: 2667.0 MHz Nov 19 03:16:33 Thinkcentre-M57p cpupower-gui[1126]: Governor: Schedutil, Online: True Nov 19 03:16:33 Thinkcentre-M57p systemd[1]: cpupower-gui.service: Deactivated successfully. Nov 19 03:16:33 Thinkcentre-M57p systemd[1]: Finished Apply cpupower-gui config at boot.