diff options
author | travis@sgi.com <travis@sgi.com> | 2008-01-30 07:33:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:22 -0500 |
commit | c49a4955ea504c82f6b690491639bba5b8c1dc47 (patch) | |
tree | badef899e3e3376c1af68b942b7f6c8ff9a36df5 | |
parent | 602a54a8cab2759fceb20b3e0c2a27c4eac005df (diff) |
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>
-rw-r--r-- | arch/x86/Kconfig.debug | 12 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 3 | ||||
-rw-r--r-- | include/asm-x86/topology.h | 7 |
3 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 88420af98140..0a82b889d76e 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -47,6 +47,18 @@ config DEBUG_PAGEALLOC | |||
47 | This results in a large slowdown, but helps to find certain types | 47 | This results in a large slowdown, but helps to find certain types |
48 | of memory corruptions. | 48 | of memory corruptions. |
49 | 49 | ||
50 | config DEBUG_PER_CPU_MAPS | ||
51 | bool "Debug access to per_cpu maps" | ||
52 | depends on DEBUG_KERNEL | ||
53 | depends on X86_64_SMP | ||
54 | default n | ||
55 | help | ||
56 | Say Y to verify that the per_cpu map being accessed has | ||
57 | been setup. Adds a fair amount of code to kernel memory | ||
58 | and decreases performance. | ||
59 | |||
60 | Say N if unsure. | ||
61 | |||
50 | config DEBUG_RODATA | 62 | config DEBUG_RODATA |
51 | bool "Write protect kernel read-only data structures" | 63 | bool "Write protect kernel read-only data structures" |
52 | depends on DEBUG_KERNEL | 64 | depends on DEBUG_KERNEL |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 5d24dc1ec237..e157cb274b25 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -37,6 +37,9 @@ u16 x86_cpu_to_node_map_init[NR_CPUS] = { | |||
37 | void *x86_cpu_to_node_map_early_ptr; | 37 | void *x86_cpu_to_node_map_early_ptr; |
38 | DEFINE_PER_CPU(u16, x86_cpu_to_node_map) = NUMA_NO_NODE; | 38 | DEFINE_PER_CPU(u16, x86_cpu_to_node_map) = NUMA_NO_NODE; |
39 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map); | 39 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map); |
40 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
41 | EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr); | ||
42 | #endif | ||
40 | 43 | ||
41 | u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { | 44 | u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { |
42 | [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE | 45 | [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE |
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h index 040374f030cf..f1e12329078e 100644 --- a/include/asm-x86/topology.h +++ b/include/asm-x86/topology.h | |||
@@ -66,6 +66,13 @@ static inline int early_cpu_to_node(int cpu) | |||
66 | 66 | ||
67 | static inline int cpu_to_node(int cpu) | 67 | static inline int cpu_to_node(int cpu) |
68 | { | 68 | { |
69 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
70 | if(x86_cpu_to_node_map_early_ptr) { | ||
71 | printk("KERN_NOTICE cpu_to_node(%d): usage too early!\n", | ||
72 | (int)cpu); | ||
73 | BUG(); | ||
74 | } | ||
75 | #endif | ||
69 | if(per_cpu_offset(cpu)) | 76 | if(per_cpu_offset(cpu)) |
70 | return per_cpu(x86_cpu_to_node_map, cpu); | 77 | return per_cpu(x86_cpu_to_node_map, cpu); |
71 | else | 78 | else |