ia64/xen-unstable

changeset 19151:66020c204f14

x86: misc adjustments to acpi-cpufreq

Avoid the call to check_freq() by default, since that function may
spin up to 1ms on certain systems without indicating any kind of severe
failure. This matches similar behavior in Linux.

Avoid doing a cross processor call in get_cur_val() if the current CPU
has its bit set in the mask passed in. Also use the local variable
'cpu' consistently, allowing to remove another local variable.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 03 18:13:55 2009 +0000 (2009-02-03)
parents 93d2193450c4
children c3b5e36248c9
files xen/arch/x86/acpi/cpufreq/cpufreq.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Tue Feb 03 18:13:22 2009 +0000
     1.2 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Tue Feb 03 18:13:55 2009 +0000
     1.3 @@ -58,6 +58,9 @@ static struct acpi_cpufreq_data *drv_dat
     1.4  
     1.5  static struct cpufreq_driver acpi_cpufreq_driver;
     1.6  
     1.7 +static unsigned int __read_mostly acpi_pstate_strict;
     1.8 +integer_param("acpi_pstate_strict", acpi_pstate_strict);
     1.9 +
    1.10  static int check_est_cpu(unsigned int cpuid)
    1.11  {
    1.12      struct cpuinfo_x86 *cpu = &cpu_data[cpuid];
    1.13 @@ -193,28 +196,27 @@ static void drv_write(struct drv_cmd *cm
    1.14  
    1.15  static u32 get_cur_val(cpumask_t mask)
    1.16  {
    1.17 -    struct cpufreq_policy *policy;
    1.18      struct processor_performance *perf;
    1.19      struct drv_cmd cmd;
    1.20 -    unsigned int cpu;
    1.21 +    unsigned int cpu = smp_processor_id();
    1.22  
    1.23      if (unlikely(cpus_empty(mask)))
    1.24          return 0;
    1.25  
    1.26 -    cpu = first_cpu(mask);
    1.27 -    policy = cpufreq_cpu_policy[cpu];
    1.28 +    if (!cpu_isset(cpu, mask))
    1.29 +        cpu = first_cpu(mask);
    1.30  
    1.31 -    if (!policy)
    1.32 +    if (cpu >= NR_CPUS || !drv_data[cpu])
    1.33          return 0;    
    1.34  
    1.35 -    switch (drv_data[policy->cpu]->cpu_feature) {
    1.36 +    switch (drv_data[cpu]->cpu_feature) {
    1.37      case SYSTEM_INTEL_MSR_CAPABLE:
    1.38          cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
    1.39          cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
    1.40          break;
    1.41      case SYSTEM_IO_CAPABLE:
    1.42          cmd.type = SYSTEM_IO_CAPABLE;
    1.43 -        perf = drv_data[first_cpu(mask)]->acpi_data;
    1.44 +        perf = drv_data[cpu]->acpi_data;
    1.45          cmd.addr.io.port = perf->control_register.address;
    1.46          cmd.addr.io.bit_width = perf->control_register.bit_width;
    1.47          break;
    1.48 @@ -393,7 +395,7 @@ static int acpi_cpufreq_target(struct cp
    1.49  
    1.50      drv_write(&cmd);
    1.51  
    1.52 -    if (!check_freqs(cmd.mask, freqs.new, data)) {
    1.53 +    if (acpi_pstate_strict && !check_freqs(cmd.mask, freqs.new, data)) {
    1.54          printk(KERN_WARNING "Fail transfer to new freq %d\n", freqs.new);
    1.55          return -EAGAIN;
    1.56      }