Unable to change cpufreq governor
Hi Viresh,
The script used in LKP to change cpufreq governor triggered a lot of errors on different test boxes with your branch:
https://git.linaro.org/people/vireshk/linux cpufreq/governor-fixes
[root(a)localhost cpufreq]# pwd /sys/devices/system/cpu/cpu3/cpufreq [root(a)localhost cpufreq]# echo ondemand > scaling_governor
bash: echo: write error: Device or resource busy
This only occurs for acpi-cpufreq scaling driver.
After turned on the debug level:
[root(a)localhost ~]# echo 'module cpufreq +pft' > /sys/kernel/debug/dynamic_debug/control And added a little more debug statements:
drivers/cpufreq/cpufreq.c +5 -2
@@ -2009,7 +2009,7 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target);static int __cpufreq_governor (struct cpufreq_policy *policy,unsigned int event) { -int ret, state; +int ret, state, busy;/* Only must be defined when default governor is known to have latency restrictions, like e.g. conservative or ondemand.
@@ -2046,9 +2046,12 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,mutex_lock (&cpufreq_governor_lock); state =get_governor_state (policy); +pr_debug ("state=%u\n" , state);/* Check if operation is permitted or not */ -if (is_governor_busy (policy) + busy =is_governor_busy (policy); +pr_debug ("busy=%d\n" , busy); +if (busy || (state ==CPUFREQ_GOV_START && event !=CPUFREQ_GOV_LIMITS && event !=CPUFREQ_GOV_STOP ) || (state ==CPUFREQ_GOV_STOP && event !=CPUFREQ_GOV_START && event !=CPUFREQ_GOV_POLICY_EXIT ) || (state == CPUFREQ_GOV_POLICY_INIT && event != CPUFREQ_GOV_START && event != CPUFREQ_GOV_POLICY_EXIT)
the following output is printed with the above echo command:
[ 61.869713] [1263] cpufreq_set_policy: cpufreq: setting new policy for CPU 3: 1600000 - 3401000 kHz [ 61.869732] [1263] cpufreq_set_policy: cpufreq: new min and max freqs are 1600000 - 3401000 kHz [ 61.869734] [1263] cpufreq_set_policy: cpufreq: governor switch [ 61.869736] [1263] __cpufreq_governor: cpufreq: __cpufreq_governor for CPU 3, event 2 [ 61.869739] [1263] __cpufreq_governor: cpufreq: state=5 [ 61.869741] [1263] __cpufreq_governor: cpufreq: busy=0
Please let me know if you need more information, thanks.
-Aaron
Viresh Kumar
maintainerQuoted 5 lines · Aaron Lu
Hi Viresh,
The script used in LKP to change cpufreq governor triggered a lot of errors on different test boxes with your branch:
https://git.linaro.org/people/vireshk/linux cpufreq/governor-fixes
Oh, that was just an testing branch. Anyway will see if that is going to be pushed to mainline.