]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Fix CPU boot problem
authorAndrew Morton <akpm@osdl.org>
Wed, 20 Aug 2003 17:29:07 +0000 (10:29 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 20 Aug 2003 17:29:07 +0000 (10:29 -0700)
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 :)

include/asm-i386/mach-bigsmp/mach_apic.h
include/asm-i386/mach-es7000/mach_apic.h
include/asm-i386/mach-numaq/mach_apic.h
include/asm-i386/mach-summit/mach_apic.h

index a63520b95a36d3e7a09cef73fe7f519a535acdb8..c21ed08175d5c13e6e4952615cde98bb09419683 100644 (file)
@@ -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];
  }
 
index f83d03b0458f889a00c95c7e2081bf01d5adc5b3..aa7fd107c1c94b7bed67c3aa0b501c75def45459 100644 (file)
@@ -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];
 }
 
index ceca92723c0e6c7d740855ac9c0a25999d838570..2f9f19237460c87078d8d1b135cfc0a225b205b4 100644 (file)
@@ -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];
 }
 
index 2247c7adca3d3e7a50cf82a28c02ae723c5560c3..f79d5df55e1aebc5022793d6e846964f53a96f4a 100644 (file)
@@ -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];
 }