Jump to content

cpufrequtils not correctly loaded on boot


kolsi

Recommended Posts

Hello,

I have Rock Pi S V13 and Armbian 23.8.1 Bookworm with Linux 6.1.50-current-rockchip64.

 

When I change CPU settings (min frequency, max frequency, scaling governor) using armbian-config, the change works correctly as expected. However, these settings are lost on reboot. When I check the status of cpufrequtils service, it seems that it does not load correctly as it is not able to find the requested governor:

 

Quote

~$ systemctl status cpufrequtils.service

● cpufrequtils.service - LSB: set CPUFreq kernel parameters
     Loaded: loaded (/etc/init.d/cpufrequtils; generated)
     Active: active (exited) since Tue 2023-09-26 15:03:11 CEST; 18h ago
       Docs: man:systemd-sysv-generator(8)
    Process: 691 ExecStart=/etc/init.d/cpufrequtils start (code=exited, status=0/SUCCESS)
        CPU: 122ms

zář 26 15:03:10 labircam systemd[1]: Starting cpufrequtils.service - LSB: set CPUFreq kernel parameters...
zář 26 15:03:10 labircam cpufrequtils[691]: CPUFreq Utilities: Setting ondemand CPUFreq governor...disabled, governor not available...done.
zář 26 15:03:11 labircam systemd[1]: Started cpufrequtils.service - LSB: set CPUFreq kernel parameters.

 

But if I start it manually later, it seems to load all my settings correctly:

 

Quote

~$ sudo systemctl restart cpufrequtils

~$ systemctl status cpufrequtils.service

● cpufrequtils.service - LSB: set CPUFreq kernel parameters
     Loaded: loaded (/etc/init.d/cpufrequtils; generated)
     Active: active (exited) since Wed 2023-09-27 09:04:44 CEST; 9s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1968 ExecStart=/etc/init.d/cpufrequtils start (code=exited, status=0/SUCCESS)
        CPU: 123ms

zář 27 09:04:44 labircam systemd[1]: Starting cpufrequtils.service - LSB: set CPUFreq kernel parameters...
zář 27 09:04:44 labircam cpufrequtils[1968]: CPUFreq Utilities: Setting ondemand CPUFreq governor...CPU0...CPU1...CPU2...CPU3...done.
zář 27 09:04:44 labircam systemd[1]: Started cpufrequtils.service - LSB: set CPUFreq kernel parameters.

 

Any ideas to fix the problem except manually reloading it later?

 

armbianmonitor: https://paste.armbian.com/owolufawif

Link to comment
Share on other sites

So the reason for this problem is when "loadcpufreq" services loads CPU modules, it takes some time to load them. "cpufrequtils" is loaded right after and data in /sys/devices/system/cpu/cpu0/cpufreq don't have to exist yet. When I put "sleep 3" at the beginning of the /etc/init.d/cpufrequtils then the CPU settings are loaded correctly.

Link to comment
Share on other sites

I don't see this load to early issue on any of my boards, perhaps it is specific to your board. 
Please note that cpufrequtils is deprecated and has a number of issues with various boards that are unlikely to be addressed.
(the other issue with cpufrequtils not being enabled by default for all boards has been addressed).

Link to comment
Share on other sites

I don't know but I fixed this issue by waiting for governor in /etc/init.d/cpufrequtils

 

check_governor_avail() {
        info="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
        for i in $(seq 1 10); do
                if [ -f $info ]; then
                        break
                fi
                sleep 1
        done

        if [ -f $info ] && grep -q "\<$GOVERNOR\>" $info ; then
                return 0;
        fi
        return 1;
}

 

Link to comment
Share on other sites

I'm not sure whether it is the correct solution, rather a workaround, especially when you don't have this problem.

Maybe the waiting should happen in "loadcpufreq", because it also checks for the governor existence before its end and reports that "none" CPU module was loaded.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines