]> err.no Git - linux-2.6/commitdiff
[IA64] fix bug in sn/ia64 for sparse CPU numbering
authorhawkes@sgi.com <hawkes@sgi.com>
Fri, 18 Nov 2005 19:30:34 +0000 (11:30 -0800)
committerTony Luck <tony.luck@intel.com>
Mon, 21 Nov 2005 22:15:42 +0000 (14:15 -0800)
The kernel's use of the for_each_*cpu(i) macros has allowed for sparse CPU
numbering.  When I hacked the kernel to test sparse cpu_present_map[] and
cpu_possible_map[] cpumasks, I discovered one remaining spot, in
sn_hwperf_ioctl() during sn initialization, that needs to be fixed.

Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Dean Roe <roe@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/sn/kernel/sn2/sn_hwperf.c

index 6c6fbca3229c9625964c1801c8ba480d7ab5c492..19b54fbcd7eaf790c7136571b81f79e2ae1dc1a0 100644 (file)
@@ -743,13 +743,14 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg)
                if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
                        memset(p, 0, a.sz);
                        for (i = 0; i < nobj; i++) {
+                               int cpuobj_index = 0;
                                if (!SN_HWPERF_IS_NODE(objs + i))
                                        continue;
                                node = sn_hwperf_obj_to_cnode(objs + i);
                                for_each_online_cpu(j) {
                                        if (node != cpu_to_node(j))
                                                continue;
-                                       cpuobj = (struct sn_hwperf_object_info *) p + j;
+                                       cpuobj = (struct sn_hwperf_object_info *) p + cpuobj_index++;
                                        slice = 'a' + cpuid_to_slice(j);
                                        cdata = cpu_data(j);
                                        cpuobj->id = j;