intel_pstate: Set CPU number before accessing MSRs
authorVincent Minet <[email protected]>
Fri, 4 Jul 2014 23:51:33 +0000 (01:51 +0200)
committerRafael J. Wysocki <[email protected]>
Sun, 6 Jul 2014 23:24:24 +0000 (01:24 +0200)
Ensure that cpu->cpu is set before writing MSR_IA32_PERF_CTL during CPU
initialization. Otherwise only cpu0 has its P-state set and all other
cores are left with their values unchanged.

In most cases, this is not too serious because the P-states will be set
correctly when the timer function is run.  But when the default governor
is set to performance, the per-CPU current_pstate stays the same forever
and no attempts are made to write the MSRs again.

Signed-off-by: Vincent Minet <[email protected]>
Cc: All applicable <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
drivers/cpufreq/intel_pstate.c

index 127ead814619320ffbe80b9cba3ad263bb312efb..86631cb6f7dee9316774517f6b9d75243bda103b 100644 (file)
@@ -700,9 +700,8 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 
        cpu = all_cpu_data[cpunum];
 
-       intel_pstate_get_cpu_pstates(cpu);
-
        cpu->cpu = cpunum;
+       intel_pstate_get_cpu_pstates(cpu);
 
        init_timer_deferrable(&cpu->timer);
        cpu->timer.function = intel_pstate_timer_func;