x86: add debug of invalid per_cpu map accesses
authorIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:23 +0000 (13:33 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:23 +0000 (13:33 +0100)
dont crash survivable situations.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/topology.h

index f1e12329078ee67e88a3b2ee3dfa7a96840e2e02..9a8228a177c7a093842bb2e2e2810985e8582016 100644 (file)
@@ -66,14 +66,15 @@ static inline int early_cpu_to_node(int cpu)
 
 static inline int cpu_to_node(int cpu)
 {
-#ifdef CONFIG_DEBUG_PER_CPU_MAPS
-       if(x86_cpu_to_node_map_early_ptr) {
+#ifdef CONFIG_DEBUG_PER_CPU_MAPS
+       if (x86_cpu_to_node_map_early_ptr) {
                printk("KERN_NOTICE cpu_to_node(%d): usage too early!\n",
                        (int)cpu);
-               BUG();
+               dump_stack();
+               return ((int *)x86_cpu_to_node_map_early_ptr)[cpu];
        }
 #endif
-       if(per_cpu_offset(cpu))
+       if (per_cpu_offset(cpu))
                return per_cpu(x86_cpu_to_node_map, cpu);
        else
                return NUMA_NO_NODE;