[PATCH] i386 boottime for_each_cpu broken

From: Zwane Mwaikambo
Date: Wed Aug 10 2005 - 23:54:41 EST


for_each_cpu walks through all processors in cpu_possible_map, which is
defined as cpu_callout_map on i386 and isn't initialised until all
processors have been booted. This breaks things which do for_each_cpu
iterations early during boot. So, define cpu_possible_map as a bitmap with
NR_CPUS bits populated. This was triggered by a patch i'm working on which
does alloc_percpu before bringing up secondary processors.

arch/i386/kernel/smpboot.c | 1 +
arch/i386/mach-voyager/voyager_smp.c | 1 +
include/asm-i386/smp.h | 2 +-
3 files changed, 3 insertions(+), 1 deletion(-)

Signed-off-by: Zwane Mwaikambo <zwane@xxxxxxxxxxxxxxxx>

Index: linux-2.6.13-rc5-mm1/arch/i386/kernel/smpboot.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.13-rc5-mm1/arch/i386/kernel/smpboot.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 smpboot.c
--- linux-2.6.13-rc5-mm1/arch/i386/kernel/smpboot.c 7 Aug 2005 21:38:03 -0000 1.1.1.1
+++ linux-2.6.13-rc5-mm1/arch/i386/kernel/smpboot.c 11 Aug 2005 04:26:06 -0000
@@ -87,6 +87,7 @@ EXPORT_SYMBOL(cpu_online_map);

cpumask_t cpu_callin_map;
cpumask_t cpu_callout_map;
+cpumask_t cpu_possible_map = CPU_MASK_ALL;
EXPORT_SYMBOL(cpu_callout_map);
static cpumask_t smp_commenced_mask;

Index: linux-2.6.13-rc5-mm1/arch/i386/mach-voyager/voyager_smp.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.13-rc5-mm1/arch/i386/mach-voyager/voyager_smp.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 voyager_smp.c
--- linux-2.6.13-rc5-mm1/arch/i386/mach-voyager/voyager_smp.c 7 Aug 2005 21:38:04 -0000 1.1.1.1
+++ linux-2.6.13-rc5-mm1/arch/i386/mach-voyager/voyager_smp.c 11 Aug 2005 04:26:29 -0000
@@ -241,6 +241,7 @@ static cpumask_t smp_commenced_mask = CP
/* This is for the new dynamic CPU boot code */
cpumask_t cpu_callin_map = CPU_MASK_NONE;
cpumask_t cpu_callout_map = CPU_MASK_NONE;
+cpumask_t cpu_possible_map = CPU_MASK_ALL;
EXPORT_SYMBOL(cpu_callout_map);

/* The per processor IRQ masks (these are usually kept in sync) */
Index: linux-2.6.13-rc5-mm1/include/asm-i386/smp.h
===================================================================
RCS file: /home/cvsroot/linux-2.6.13-rc5-mm1/include/asm-i386/smp.h,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 smp.h
--- linux-2.6.13-rc5-mm1/include/asm-i386/smp.h 7 Aug 2005 21:38:37 -0000 1.1.1.1
+++ linux-2.6.13-rc5-mm1/include/asm-i386/smp.h 11 Aug 2005 04:25:26 -0000
@@ -59,7 +59,7 @@ extern void cpu_uninit(void);

extern cpumask_t cpu_callout_map;
extern cpumask_t cpu_callin_map;
-#define cpu_possible_map cpu_callout_map
+extern cpumask_t cpu_possible_map;

/* We don't mark CPUs online until __cpu_up(), so we need another measure */
static inline int num_booting_cpus(void)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/