x86: add debug of invalid per_cpu map accesses

Provide a means to trap usages of per_cpu map variables before
they are setup.  Define CONFIG_DEBUG_PER_CPU_MAPS to activate.

Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
travis@sgi.com
2008-01-30 13:33:22 +01:00
committed by Ingo Molnar
parent 602a54a8ca
commit c49a4955ea
3 changed files with 22 additions and 0 deletions

View File

@ -66,6 +66,13 @@ 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) {
printk("KERN_NOTICE cpu_to_node(%d): usage too early!\n",
(int)cpu);
BUG();
}
#endif
if(per_cpu_offset(cpu))
return per_cpu(x86_cpu_to_node_map, cpu);
else