[systemd-devel] Disabling cpufreq/boost at boot time sometimes fails

killermoehre at gmx.net killermoehre at gmx.net
Wed Jul 13 15:12:34 UTC 2022


> This must explain why my modprobe.d (of acpi_cpufreq) seems to always work but not why tmpfiles.d or a .service unit :

Actually, your modprobe.d is much too late, if I understand correctly. The used power manager module/options are set during the kernel start and can’t be changed later. Only the governor used by the module could be changed, not the module itself.

> As a matter of fact, I assume that since the /sys files seem to be created "at initialisation" or more precisely for the boost file, at driver, is exposed by the kernel module, this should be done long before systemd-tmpfiles-setup.service or my custom service are run ?

The actual structure _exposed_ via sysfs is created during kernel start and module load. /sys only allows you simple access to it. With systemd, /sys is considered an API filesystem, so it’s always mounted and available (AFAIK it’s so early that’s done by PID1 itself before starting anything else). But on systems without you don’t necessary have a /sys mount point. The structure would still be in the kernel, though.

> The only reason I can think of for those 2 latter setup to fail is that driver has not been loaded yet, hence the /sys/devices/system/cpu/cpufreq/boost file not existing yet, but I find this weird.


The driver absolutely loaded, as stated earlier. What I find interesting is the error message you get with
> /sys/devices/system/cpu/cpufreq/boost: Permission denied

Did it failed because the file didn’t exists? Maybe the path you used is wrong?

>> Question I have is: why do you want to disable boosting?
> 
> One reason is because of rack density/input pdu power ratio.
> Another might be performance consistency (at least for benching)

In this case I think your best bet is to disable the most option in the BIOS/UEFI. At least https://docs.kernel.org/admin-guide/pm/cpufreq.html#rationale-for-boost-control-knob is speaking of that.
If you don’t have such option in the BIOS/UEFI settings, you could try some udev rule reacting to the /sys entry. Something like

`/etc/udev/rules.d/20-disable-cpu-boost.rules`
```
KERNEL=="cpu", ATTR{cpufreq/boost}=="1", ATTR{cpufreq/boost}:="0"
```

Totally untested, btw.

BR
Silvio


More information about the systemd-devel mailing list