提交 226dd019 编写于 作者: A Afzal Mohammed 提交者: Dave Jones

[CPUFREQ] cpufreq:userspace: fix cpu_cur_freq updation

CPU frequency is guranteed to be changed on notifier callback with
CPUFREQ_POSTCHANGE. Notifier callback with CPUFREQ_PRECHANGE does
not gurantee a change in frequency; after it, if cpufreq driver is
unable to change CPU to new frequency. This results in wrong
information being fed to user (if setting CPU frequency fails)
upon doing like,

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

Hence in userspace governer update cpu_cur_freq only if notifier
has been called with POSTCHANGE.
Signed-off-by: NAfzal Mohammed <afzal@ti.com>
Signed-off-by: NDave Jones <davej@redhat.com>
上级 21f2e3c8
...@@ -47,9 +47,11 @@ userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val, ...@@ -47,9 +47,11 @@ userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
if (!per_cpu(cpu_is_managed, freq->cpu)) if (!per_cpu(cpu_is_managed, freq->cpu))
return 0; return 0;
pr_debug("saving cpu_cur_freq of cpu %u to be %u kHz\n", if (val == CPUFREQ_POSTCHANGE) {
freq->cpu, freq->new); pr_debug("saving cpu_cur_freq of cpu %u to be %u kHz\n",
per_cpu(cpu_cur_freq, freq->cpu) = freq->new; freq->cpu, freq->new);
per_cpu(cpu_cur_freq, freq->cpu) = freq->new;
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册