@GFdeb12
So I was trying to create a systemd service to disable turbo and then another one to enable, but then I thought why just not create a service that locks the clock speed to 3.1 GHz, as I do it now with cpupower?
AI recommends that I should start it after sysinit.target, as the msr kernel module needs to be loaded. But I am having a problem launching it, and it probably is some dumb syntax error or something.
My current bash script that I run to set the frequency to 3.1 GHz (if you are wondering, I keep the power saver governor active so that the system doesn't crash when it gets after loading the governor. Of course the problem here is that everything is delicate before the governer is loaded). -
#!/bin/bash
sudo cpupower frequency-set -u 3.1GHz && sudo cpupower frequency-set -d 3.1GHz
One thing to note that the user space governor is not loadable on my system, so I just do it like this above.
My systemd service in /etc/systemd/system/ -
[Unit]
Description=Sets CPU frequency to 3.1GHz.
After=local-fs.target sysinit.target
Wants=local-fs.target sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/bin/cpupower frequency-set -u 3.1GHz; /usr/bin/cpupower frequency-set -d 3.1GHz
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
The error I get from systemctl status and journalctl -
Jun 22 18:22:14 Ubuntu systemd[1]: Starting 3100MHz.service - Sets CPU frequency to 3.1GHz....
Jun 22 18:22:14 Ubuntu cpupower[1060]: invalid or unknown argument
Jun 22 18:22:14 Ubuntu systemd[1]: 3100MHz.service: Main process exited, code=exited, status=234/n/a
Jun 22 18:22:14 Ubuntu systemd[1]: 3100MHz.service: Failed with result 'exit-code'.
Jun 22 18:22:14 Ubuntu systemd[1]: Failed to start 3100MHz.service - Sets CPU frequency to 3.1GHz..
What is wrong? Invalid argument means it is a dumb syntax mistake probably.
Also, just when I was writing this post, another thought came to my mind. Instead of creating a systemd service, what if I modify the current power governor directly? I tried to find how to but couldn't. AI also suggested using crontab as an alternative to a systemd service, but I doubt that I would be able to run at as early as possible.