
From: Andi Kleen <ak@suse.de>

Check if node exists during CMP setup and fall back to other node if needed. 
This avoids a crash when the NUMA node discovery fails (e.g.  due to node
interleaving in the BIOS or numa=off) 

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/x86_64/kernel/setup.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN arch/x86_64/kernel/setup.c~x86_64-fix-cmp-with-interleaving arch/x86_64/kernel/setup.c
--- 25/arch/x86_64/kernel/setup.c~x86_64-fix-cmp-with-interleaving	2005-01-16 00:38:08.345560968 -0800
+++ 25-akpm/arch/x86_64/kernel/setup.c	2005-01-16 00:38:08.349560360 -0800
@@ -727,6 +727,8 @@ static int __init init_amd(struct cpuinf
 		cpu = c->x86_apicid;
 		if (acpi_numa <= 0 && c->x86_num_cores > 1) {
 			cpu_to_node[cpu] = cpu >> hweight32(c->x86_num_cores - 1);
+			if (!node_online(cpu_to_node[cpu]))
+				cpu_to_node[cpu] = first_node(node_online_map);
 		}
 		printk(KERN_INFO "CPU %d(%d) -> Node %d\n",
 				cpu, c->x86_num_cores, cpu_to_node[cpu]);
_
