]> git.hungrycats.org Git - linux/commitdiff
intel_pstate: Set CPU number before accessing MSRs
authorVincent Minet <vincent@vincent-minet.net>
Fri, 4 Jul 2014 23:51:33 +0000 (01:51 +0200)
committerJiri Slaby <jslaby@suse.cz>
Fri, 18 Jul 2014 13:51:24 +0000 (15:51 +0200)
commit 179e8471673ce0249cd4ecda796008f7757e5bad upstream.

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 <vincent@vincent-minet.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/cpufreq/intel_pstate.c

index d5dc567efd9682374298b7448f9531dd5b0ae3d6..f033fadb58e6b535573ac7cc5654290798a0a8cd 100644 (file)
@@ -550,6 +550,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 
        cpu = all_cpu_data[cpunum];
 
+       cpu->cpu = cpunum;
        intel_pstate_get_cpu_pstates(cpu);
        if (!cpu->pstate.current_pstate) {
                all_cpu_data[cpunum] = NULL;
@@ -557,7 +558,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
                return -ENODATA;
        }
 
-       cpu->cpu = cpunum;
        cpu->pstate_policy =
                (struct pstate_adjust_policy *)id->driver_data;
        init_timer_deferrable(&cpu->timer);