scaling_cur_freq is broken with acpi-cpufreq driver and ondemand governor
Hi,
As of linux-2.6.20-rc2 using acpi-cpufreq and ondemand on my Pentium M (Asus V6VA laptop) seems broken. /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq contains most of the time 1, sometimes the actual frequency or (rarely) some random value.
The problem seems to come from http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7650b281b091f39f5e97f13b45ab3813b1526b65
The attached patch fixes the problem for me, but it was obtained from random mutilations of the aforementioned patch. For instance, I don't understand how cmd.val is used, the freqs.old = extract_freq(cmd.val, data); I introduced seems to use an uninitialized value from reading the code. But it seems to be also the case in cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;
Thanks.
Signature · 1 line
Guillaume
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +2 -2
@@ -400,6 +400,8 @@ static int acpi_cpufreq_target(struct cp online_policy_cpus = policy->cpus;#endif + freqs.old =extract_freq (cmd.val, data); + freqs.new = data->freq_table[next_state].frequency; next_perf_state = data->freq_table[next_state].index;if (perf->state == next_perf_state) {if (unlikely (data->resume)) {
@@ -439,8 +441,6 @@ static int acpi_cpufreq_target(struct cpelse cpu_set (policy->cpu, cmd.mask); - freqs.old = data->freq_table[perf->state].frequency; - freqs.new = data->freq_table[next_perf_state].frequency;for_each_cpu_mask (i, cmd.mask) { freqs.cpu = i;cpufreq_notify_transition (&freqs,CPUFREQ_PRECHANGE );