kernel-hacking-2024-linux-s.../drivers/cpufreq
Mattia Dongili 9c9a43ed27 [CPUFREQ] return error when failing to set minfreq
I just stumbled on this bug/feature, this is how to reproduce it:

# echo 450000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
# echo 450000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# cpufreq-info -p
450000 450000 powersave
# echo 1800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq ; echo $?
0
# cpufreq-info -p
450000 450000 powersave

Here it is. The kernel refuses to set a min_freq higher than the
max_freq but it allows a max_freq lower than min_freq (lowering min_freq
also).

This behaviour is pretty straightforward (but undocumented) and it
doesn't return an error altough failing to accomplish the requested
action (set min_freq).
The problem (IMO) is basically that userspace is not allowed to set a
full policy atomically while the kernel always does that thus it must
enforce an ordering on operations.

The attached patch returns -EINVAL if trying to increase frequencies
starting from scaling_min_freq and documents the correct ordering of writes.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
Signed-off-by: Dave Jones <davej@redhat.com>

--
2006-07-31 18:37:05 -04:00
..
cpufreq.c [CPUFREQ] return error when failing to set minfreq 2006-07-31 18:37:05 -04:00
cpufreq_conservative.c [PATCH] Reorganize the cpufreq cpu hotplug locking to not be totally bizare 2006-07-26 07:21:40 -07:00
cpufreq_ondemand.c [PATCH] Reorganize the cpufreq cpu hotplug locking to not be totally bizare 2006-07-26 07:21:40 -07:00
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
cpufreq_userspace.c [PATCH] Reorganize the cpufreq cpu hotplug locking to not be totally bizare 2006-07-26 07:21:40 -07:00
freq_table.c [CPUFREQ] Remove more freq_table reinitialisations. 2006-05-30 18:09:31 -04:00
Kconfig
Makefile