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:
parent
602a54a8ca
commit
c49a4955ea
@ -47,6 +47,18 @@ config DEBUG_PAGEALLOC
|
|||||||
This results in a large slowdown, but helps to find certain types
|
This results in a large slowdown, but helps to find certain types
|
||||||
of memory corruptions.
|
of memory corruptions.
|
||||||
|
|
||||||
|
config DEBUG_PER_CPU_MAPS
|
||||||
|
bool "Debug access to per_cpu maps"
|
||||||
|
depends on DEBUG_KERNEL
|
||||||
|
depends on X86_64_SMP
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Say Y to verify that the per_cpu map being accessed has
|
||||||
|
been setup. Adds a fair amount of code to kernel memory
|
||||||
|
and decreases performance.
|
||||||
|
|
||||||
|
Say N if unsure.
|
||||||
|
|
||||||
config DEBUG_RODATA
|
config DEBUG_RODATA
|
||||||
bool "Write protect kernel read-only data structures"
|
bool "Write protect kernel read-only data structures"
|
||||||
depends on DEBUG_KERNEL
|
depends on DEBUG_KERNEL
|
||||||
|
@ -37,6 +37,9 @@ u16 x86_cpu_to_node_map_init[NR_CPUS] = {
|
|||||||
void *x86_cpu_to_node_map_early_ptr;
|
void *x86_cpu_to_node_map_early_ptr;
|
||||||
DEFINE_PER_CPU(u16, x86_cpu_to_node_map) = NUMA_NO_NODE;
|
DEFINE_PER_CPU(u16, x86_cpu_to_node_map) = NUMA_NO_NODE;
|
||||||
EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map);
|
EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map);
|
||||||
|
#ifdef CONFIG_DEBUG_PER_CPU_MAPS
|
||||||
|
EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
|
u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
|
||||||
[0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
|
[0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
|
||||||
|
@ -66,6 +66,13 @@ static inline int early_cpu_to_node(int cpu)
|
|||||||
|
|
||||||
static inline int 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))
|
if(per_cpu_offset(cpu))
|
||||||
return per_cpu(x86_cpu_to_node_map, cpu);
|
return per_cpu(x86_cpu_to_node_map, cpu);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user