summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-08-20 10:29:07 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-08-20 10:29:07 -0700
commite3e0c299196a8dac91d2bd8e8dbb748d3a7b0f24 (patch)
tree0577e0becd29659da6ee798ea6e2b1d11e51053c /include
parent10d3766014d576e6f7be990d12133db3e844ac69 (diff)
[PATCH] Fix CPU boot problem
From: Dave Hansen <haveblue@us.ibm.com> Hmmm. This is looking like fallout from the massive wli-bomb. Here's the loop that controls the cpu booting, before and after cpumask_t: - for (bit = 0; kicked < NR_CPUS && bit < BITS_PER_LONG; bit++) + for (bit = 0; kicked < NR_CPUS && bit < MAX_APICS; bit++) apicid = cpu_present_to_apicid(bit); "kicked" only gets incremented for CPUs that were successfully booted, so it doesn't help terminate the loop much. MAX_APICS is 256 on summit, which is *MUCH* bigger than BITS_PER_LONG. cpu_2_logical_apicid[NR_CPUS] which is referenced from cpu_present_to_apicid() is getting referenced up to MAX_APICs, which is bigger than NR_CPUS. Overflow. Bang. garbage != BAD_APICID :)
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apic.h2
-rw-r--r--include/asm-i386/mach-es7000/mach_apic.h2
-rw-r--r--include/asm-i386/mach-numaq/mach_apic.h2
-rw-r--r--include/asm-i386/mach-summit/mach_apic.h2
4 files changed, 8 insertions, 0 deletions
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h
index a63520b95a36..c21ed08175d5 100644
--- a/include/asm-i386/mach-bigsmp/mach_apic.h
+++ b/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -98,6 +98,8 @@ extern u8 cpu_2_logical_apicid[];
/* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu)
{
+ if (cpu >= NR_CPUS)
+ return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
}
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h
index f83d03b0458f..aa7fd107c1c9 100644
--- a/include/asm-i386/mach-es7000/mach_apic.h
+++ b/include/asm-i386/mach-es7000/mach_apic.h
@@ -123,6 +123,8 @@ extern u8 cpu_2_logical_apicid[];
/* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu)
{
+ if (cpu >= NR_CPUS)
+ return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
}
diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h
index ceca92723c0e..2f9f19237460 100644
--- a/include/asm-i386/mach-numaq/mach_apic.h
+++ b/include/asm-i386/mach-numaq/mach_apic.h
@@ -60,6 +60,8 @@ static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
extern u8 cpu_2_logical_apicid[];
static inline int cpu_to_logical_apicid(int cpu)
{
+ if (cpu >= NR_CPUS)
+ return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
}
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h
index 2247c7adca3d..f79d5df55e1a 100644
--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -80,6 +80,8 @@ static inline int apicid_to_node(int logical_apicid)
extern u8 cpu_2_logical_apicid[];
static inline int cpu_to_logical_apicid(int cpu)
{
+ if (cpu >= NR_CPUS)
+ return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
}