diff options
author | Mattia Dongili <malattia@linux.it> | 2006-07-05 23:12:20 +0200 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-07-31 18:37:05 -0400 |
commit | 9c9a43ed2734081124407c779b36a4761c41139b (patch) | |
tree | b32e4d83e840c46f8ef760bda594d7a02e1c41c9 /Documentation/cpu-freq | |
parent | 49b1e3ea19b1c95c2f012b8331ffb3b169e4c042 (diff) | |
download | lwn-9c9a43ed2734081124407c779b36a4761c41139b.tar.gz lwn-9c9a43ed2734081124407c779b36a4761c41139b.zip |
[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>
--
Diffstat (limited to 'Documentation/cpu-freq')
-rw-r--r-- | Documentation/cpu-freq/user-guide.txt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt index 7fedc00c3d30..555c8cf3650a 100644 --- a/Documentation/cpu-freq/user-guide.txt +++ b/Documentation/cpu-freq/user-guide.txt @@ -153,10 +153,13 @@ scaling_governor, and by "echoing" the name of another that some governors won't load - they only work on some specific architectures or processors. -scaling_min_freq and +scaling_min_freq and scaling_max_freq show the current "policy limits" (in kHz). By echoing new values into these files, you can change these limits. + NOTE: when setting a policy you need to + first set scaling_max_freq, then + scaling_min_freq. If you have selected the "userspace" governor which allows you to |