[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] 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@xxxxxxxxxx>

Index: 2008-09-01/xen/arch/x86/acpi/cpufreq/powernow.c
===================================================================
--- 2008-09-01.orig/xen/arch/x86/acpi/cpufreq/powernow.c        2008-09-16 
15:55:06.000000000 +0200
+++ 2008-09-01/xen/arch/x86/acpi/cpufreq/powernow.c     2008-09-16 
15:55:23.000000000 +0200
@@ -241,9 +241,8 @@ int powernow_cpufreq_init(void)
 {
     unsigned int i, ret = 0;
     unsigned int dom, max_dom = 0;
-    cpumask_t *pt, dom_mask;
-
-    cpus_clear(dom_mask);
+    cpumask_t *pt;
+    unsigned long *dom_mask;
 
     for_each_online_cpu(i) {
         struct cpuinfo_x86 *c = &cpu_data[i];
@@ -258,20 +257,26 @@ int powernow_cpufreq_init(void)
        }
         if (ret)
             return ret;
-        cpu_set(processor_pminfo[i].perf.domain_info.domain, dom_mask);
         if (max_dom < processor_pminfo[i].perf.domain_info.domain)
             max_dom = processor_pminfo[i].perf.domain_info.domain;
     }
     max_dom++;
 
+    dom_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(max_dom));
+    if (!dom_mask)
+        return -ENOMEM;
+    bitmap_zero(dom_mask, max_dom);
+
     pt = xmalloc_array(cpumask_t, max_dom);
     if (!pt)
         return -ENOMEM;
     memset(pt, 0, max_dom * sizeof(cpumask_t));
 
     /* get cpumask of each psd domain */
-    for_each_online_cpu(i)
+    for_each_online_cpu(i) {
+        __set_bit(processor_pminfo[i].perf.domain_info.domain, dom_mask);
         cpu_set(i, pt[processor_pminfo[i].perf.domain_info.domain]);
+    }
 
     for_each_online_cpu(i)
         processor_pminfo[i].perf.shared_cpu_map = 
@@ -289,8 +294,8 @@ int powernow_cpufreq_init(void)
     }
 
     /* setup ondemand cpufreq */
-    for (dom=0; dom<max_dom; dom++) {
-        if (!cpu_isset(dom, dom_mask))
+    for (dom = 0; dom < max_dom; dom++) {
+        if (!test_bit(dom, dom_mask))
             continue;
         i = first_cpu(pt[dom]);
         ret = cpufreq_governor_dbs(&xen_px_policy[i], CPUFREQ_GOV_START);
@@ -300,6 +305,7 @@ int powernow_cpufreq_init(void)
 
 cpufreq_init_out:
     xfree(pt);
+    xfree(dom_mask);
    
     return ret;
 }




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.