cpu_core_map is currently an array defined using NR_CPUS. This means that
we overallocate since we will rarely really use the maximum number of configured cpus. This may become a problem when we need to increase the NR_CPUs on x86_64 for our new product line.
If we put the cpu_core_map into the per cpu area then it will be allocated
for each processor as it comes online.
However, this means that the core map cannot be accessed until the per cpu area has been allocated. Xen does a weird thing here looping over all processors and zeroing the masks that are not yet allocated and that will be zeroed when they are allocated. I commented the code out. Maybe there is another purpose? Jeremy?
@@ -1107,11 +1107,11 @@ static void __init smp_boot_cpus(unsigne
*/
for (cpu = 0; cpu < NR_CPUS; cpu++) {
cpus_clear(cpu_sibling_map[cpu]);
- cpus_clear(cpu_core_map[cpu]);
+ cpus_clear(per_cpu(cpu_core_map, cpu));
}
cpu_set(0, cpu_sibling_map[0]);
- cpu_set(0, cpu_core_map[0]);
+ cpu_set(0, per_cpu(cpu_core_map, 0));
===================================================================
--- linux-2.6.22-rc6-mm1.orig/arch/i386/xen/smp.c 2007-07-12 23:32:37.000000000 -0700
+++ linux-2.6.22-rc6-mm1/arch/i386/xen/smp.c 2007-07-12 23:52:08.000000000 -0700
@@ -150,7 +150,12 @@ void __init xen_smp_prepare_boot_cpu(voi
for (cpu = 0; cpu < NR_CPUS; cpu++) {
cpus_clear(cpu_sibling_map[cpu]);
- cpus_clear(cpu_core_map[cpu]);
+ /*
+ * cpu_core_map lives in a per cpu area that is cleared
+ * when the per cpu array is allocated.
+ *
+ * cpus_clear(per_cpu(cpu_core_map, cpu));
+ */
}
}
@@ -160,7 +165,11 @@ void __init xen_smp_prepare_cpus(unsigne
for (cpu = 0; cpu < NR_CPUS; cpu++) {
cpus_clear(cpu_sibling_map[cpu]);
- cpus_clear(cpu_core_map[cpu]);
+ /*
+ * cpu_core_ map will be zeroed when the per cpu area is allocated.
+ *
+ * cpus_clear(per_cpu(cpu_core_map, cpu));
+ */
}
smp_store_cpu_info(0);