ia64/xen-unstable

changeset 18508:15efb62ecf09

x86: also fix powernow's dom_mask

Just like for the Intel/ACPI cpufreq code, powernow's dom_mask also
must not be confined to the number of CPUs in the system.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Sep 16 15:54:17 2008 +0100 (2008-09-16)
parents d7be37824fe0
children 9ab9dadf4876
files xen/arch/x86/acpi/cpufreq/powernow.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpufreq/powernow.c	Tue Sep 16 13:53:47 2008 +0100
     1.2 +++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Tue Sep 16 15:54:17 2008 +0100
     1.3 @@ -241,9 +241,8 @@ int powernow_cpufreq_init(void)
     1.4  {
     1.5      unsigned int i, ret = 0;
     1.6      unsigned int dom, max_dom = 0;
     1.7 -    cpumask_t *pt, dom_mask;
     1.8 -
     1.9 -    cpus_clear(dom_mask);
    1.10 +    cpumask_t *pt;
    1.11 +    unsigned long *dom_mask;
    1.12  
    1.13      for_each_online_cpu(i) {
    1.14          struct cpuinfo_x86 *c = &cpu_data[i];
    1.15 @@ -258,20 +257,26 @@ int powernow_cpufreq_init(void)
    1.16  	}
    1.17          if (ret)
    1.18              return ret;
    1.19 -        cpu_set(processor_pminfo[i].perf.domain_info.domain, dom_mask);
    1.20          if (max_dom < processor_pminfo[i].perf.domain_info.domain)
    1.21              max_dom = processor_pminfo[i].perf.domain_info.domain;
    1.22      }
    1.23      max_dom++;
    1.24  
    1.25 +    dom_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(max_dom));
    1.26 +    if (!dom_mask)
    1.27 +        return -ENOMEM;
    1.28 +    bitmap_zero(dom_mask, max_dom);
    1.29 +
    1.30      pt = xmalloc_array(cpumask_t, max_dom);
    1.31      if (!pt)
    1.32          return -ENOMEM;
    1.33      memset(pt, 0, max_dom * sizeof(cpumask_t));
    1.34  
    1.35      /* get cpumask of each psd domain */
    1.36 -    for_each_online_cpu(i)
    1.37 +    for_each_online_cpu(i) {
    1.38 +        __set_bit(processor_pminfo[i].perf.domain_info.domain, dom_mask);
    1.39          cpu_set(i, pt[processor_pminfo[i].perf.domain_info.domain]);
    1.40 +    }
    1.41  
    1.42      for_each_online_cpu(i)
    1.43          processor_pminfo[i].perf.shared_cpu_map = 
    1.44 @@ -289,8 +294,8 @@ int powernow_cpufreq_init(void)
    1.45      }
    1.46  
    1.47      /* setup ondemand cpufreq */
    1.48 -    for (dom=0; dom<max_dom; dom++) {
    1.49 -        if (!cpu_isset(dom, dom_mask))
    1.50 +    for (dom = 0; dom < max_dom; dom++) {
    1.51 +        if (!test_bit(dom, dom_mask))
    1.52              continue;
    1.53          i = first_cpu(pt[dom]);
    1.54          ret = cpufreq_governor_dbs(cpufreq_cpu_policy[i], CPUFREQ_GOV_START);
    1.55 @@ -300,6 +305,7 @@ int powernow_cpufreq_init(void)
    1.56  
    1.57  cpufreq_init_out:
    1.58      xfree(pt);
    1.59 +    xfree(dom_mask);
    1.60     
    1.61      return ret;
    1.62  }