WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86: also fix powernow's dom_mask

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: also fix powernow's dom_mask
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Tue, 16 Sep 2008 15:18:52 +0100
Delivery-date: Tue, 16 Sep 2008 07:18:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86: also fix powernow's dom_mask, Jan Beulich <=