From: "Jan Beulich" Subject: [PATCH] x86: also fix powernow's dom_mask Date: Tue, 16 Sep 2008 15:18:52 +0100 Message-ID: <48CFDC6C.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 Index: 2008-09-01/xen/arch/x86/acpi/cpufreq/powernow.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D 0; unsigned int dom, max_dom =3D 0; - cpumask_t *pt, dom_mask; - - cpus_clear(dom_mask); + cpumask_t *pt; + unsigned long *dom_mask; =20 for_each_online_cpu(i) { struct cpuinfo_x86 *c =3D &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 =3D processor_pminfo[i].perf.domain_info.domain; } max_dom++; =20 + dom_mask =3D xmalloc_array(unsigned long, BITS_TO_LONGS(max_dom)); + if (!dom_mask) + return -ENOMEM; + bitmap_zero(dom_mask, max_dom); + pt =3D xmalloc_array(cpumask_t, max_dom); if (!pt) return -ENOMEM; memset(pt, 0, max_dom * sizeof(cpumask_t)); =20 /* 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]); + } =20 for_each_online_cpu(i) processor_pminfo[i].perf.shared_cpu_map =3D=20 @@ -289,8 +294,8 @@ int powernow_cpufreq_init(void) } =20 /* setup ondemand cpufreq */ - for (dom=3D0; dom