
From: Andi Kleen <ak@muc.de>

genapic broke early safe_smp_processor_id(), especially when you got a
WARN_ON or oops early it would loops forever in show_trace.  The reason was
that the x86_cpu_to_apicid array wasn't correctly initialized.

This patch fixes this by just testing for this case.

Orginally from James Cleverdon
Acked-by: Andi Kleen <ak@muc.de> 

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/asm-x86_64/smp.h |    5 +++++
 1 files changed, 5 insertions(+)

diff -puN include/asm-x86_64/smp.h~x86_64-fix-safe_smp_processor_id-after-genapic include/asm-x86_64/smp.h
--- 25/include/asm-x86_64/smp.h~x86_64-fix-safe_smp_processor_id-after-genapic	2004-10-28 19:12:26.825952200 -0700
+++ 25-akpm/include/asm-x86_64/smp.h	2004-10-28 19:12:26.828951744 -0700
@@ -104,6 +104,11 @@ static inline int x86_apicid_to_cpu(u8 a
 		if (x86_cpu_to_apicid[i] == apicid)
 			return i;
 
+	/* No entries in x86_cpu_to_apicid?  Either no MPS|ACPI,
+	 * or called too early.  Either way, we must be CPU 0. */
+      	if (x86_cpu_to_apicid[0] == BAD_APICID)
+		return 0;
+
 	return -1;
 }
 
_
