diff options
author | Mike Travis <travis@sgi.com> | 2008-03-25 18:06:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:34 -0400 |
commit | b447a468fcd130aa8951672b6115c673c274e888 (patch) | |
tree | 3824624df1191cb1e6abbf9f9dbeca3f9d8c17f8 | |
parent | a24eae88ad3767d0a4a940a10e4a9cec849b7778 (diff) |
x86: clean up non-smp usage of cpu maps
Cleanup references to the early cpu maps for the non-SMP configuration
and remove some functions called for SMP configurations only.
Cc: Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/setup.c | 28 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 4 | ||||
-rw-r--r-- | include/asm-x86/smp.h | 5 | ||||
-rw-r--r-- | include/asm-x86/topology.h | 15 |
4 files changed, 30 insertions, 22 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 1179aa06cdbf..dc7940955b7a 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <asm/setup.h> | 10 | #include <asm/setup.h> |
11 | #include <asm/topology.h> | 11 | #include <asm/topology.h> |
12 | 12 | ||
13 | #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA | 13 | #if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_SMP) |
14 | /* | 14 | /* |
15 | * Copy data used in early init routines from the initial arrays to the | 15 | * Copy data used in early init routines from the initial arrays to the |
16 | * per cpu data areas. These arrays then become expendable and the | 16 | * per cpu data areas. These arrays then become expendable and the |
@@ -21,22 +21,13 @@ static void __init setup_per_cpu_maps(void) | |||
21 | int cpu; | 21 | int cpu; |
22 | 22 | ||
23 | for_each_possible_cpu(cpu) { | 23 | for_each_possible_cpu(cpu) { |
24 | #ifdef CONFIG_SMP | 24 | per_cpu(x86_cpu_to_apicid, cpu) = x86_cpu_to_apicid_init[cpu]; |
25 | if (per_cpu_offset(cpu)) { | 25 | per_cpu(x86_bios_cpu_apicid, cpu) = |
26 | #endif | ||
27 | per_cpu(x86_cpu_to_apicid, cpu) = | ||
28 | x86_cpu_to_apicid_init[cpu]; | ||
29 | per_cpu(x86_bios_cpu_apicid, cpu) = | ||
30 | x86_bios_cpu_apicid_init[cpu]; | 26 | x86_bios_cpu_apicid_init[cpu]; |
31 | #ifdef CONFIG_NUMA | 27 | #ifdef CONFIG_NUMA |
32 | per_cpu(x86_cpu_to_node_map, cpu) = | 28 | per_cpu(x86_cpu_to_node_map, cpu) = |
33 | x86_cpu_to_node_map_init[cpu]; | 29 | x86_cpu_to_node_map_init[cpu]; |
34 | #endif | 30 | #endif |
35 | #ifdef CONFIG_SMP | ||
36 | } else | ||
37 | printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n", | ||
38 | cpu); | ||
39 | #endif | ||
40 | } | 31 | } |
41 | 32 | ||
42 | /* indicate the early static arrays will soon be gone */ | 33 | /* indicate the early static arrays will soon be gone */ |
@@ -72,17 +63,20 @@ void __init setup_per_cpu_areas(void) | |||
72 | 63 | ||
73 | /* Copy section for each CPU (we discard the original) */ | 64 | /* Copy section for each CPU (we discard the original) */ |
74 | size = PERCPU_ENOUGH_ROOM; | 65 | size = PERCPU_ENOUGH_ROOM; |
75 | |||
76 | printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", | 66 | printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", |
77 | size); | 67 | size); |
78 | for_each_cpu_mask(i, cpu_possible_map) { | 68 | |
69 | for_each_possible_cpu(i) { | ||
79 | char *ptr; | 70 | char *ptr; |
80 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 71 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
81 | ptr = alloc_bootmem_pages(size); | 72 | ptr = alloc_bootmem_pages(size); |
82 | #else | 73 | #else |
83 | int node = early_cpu_to_node(i); | 74 | int node = early_cpu_to_node(i); |
84 | if (!node_online(node) || !NODE_DATA(node)) | 75 | if (!node_online(node) || !NODE_DATA(node)) { |
85 | ptr = alloc_bootmem_pages(size); | 76 | ptr = alloc_bootmem_pages(size); |
77 | printk(KERN_INFO | ||
78 | "cpu %d has no node or node-local memory\n", i); | ||
79 | } | ||
86 | else | 80 | else |
87 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); | 81 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); |
88 | #endif | 82 | #endif |
@@ -96,7 +90,7 @@ void __init setup_per_cpu_areas(void) | |||
96 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 90 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); |
97 | } | 91 | } |
98 | 92 | ||
99 | /* setup percpu data maps early */ | 93 | /* Setup percpu data maps */ |
100 | setup_per_cpu_maps(); | 94 | setup_per_cpu_maps(); |
101 | } | 95 | } |
102 | 96 | ||
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 18267a02e67a..2ea56f48f29b 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -31,13 +31,15 @@ bootmem_data_t plat_node_bdata[MAX_NUMNODES]; | |||
31 | 31 | ||
32 | struct memnode memnode; | 32 | struct memnode memnode; |
33 | 33 | ||
34 | #ifdef CONFIG_SMP | ||
34 | int x86_cpu_to_node_map_init[NR_CPUS] = { | 35 | int x86_cpu_to_node_map_init[NR_CPUS] = { |
35 | [0 ... NR_CPUS-1] = NUMA_NO_NODE | 36 | [0 ... NR_CPUS-1] = NUMA_NO_NODE |
36 | }; | 37 | }; |
37 | void *x86_cpu_to_node_map_early_ptr; | 38 | void *x86_cpu_to_node_map_early_ptr; |
39 | EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr); | ||
40 | #endif | ||
38 | DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE; | 41 | DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE; |
39 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map); | 42 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map); |
40 | EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr); | ||
41 | 43 | ||
42 | s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { | 44 | s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { |
43 | [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE | 45 | [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE |
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h index 654724c58f5b..d973c11688ce 100644 --- a/include/asm-x86/smp.h +++ b/include/asm-x86/smp.h | |||
@@ -29,10 +29,15 @@ extern int smp_num_siblings; | |||
29 | extern unsigned int num_processors; | 29 | extern unsigned int num_processors; |
30 | extern cpumask_t cpu_initialized; | 30 | extern cpumask_t cpu_initialized; |
31 | 31 | ||
32 | #ifdef CONFIG_SMP | ||
32 | extern u16 x86_cpu_to_apicid_init[]; | 33 | extern u16 x86_cpu_to_apicid_init[]; |
33 | extern u16 x86_bios_cpu_apicid_init[]; | 34 | extern u16 x86_bios_cpu_apicid_init[]; |
34 | extern void *x86_cpu_to_apicid_early_ptr; | 35 | extern void *x86_cpu_to_apicid_early_ptr; |
35 | extern void *x86_bios_cpu_apicid_early_ptr; | 36 | extern void *x86_bios_cpu_apicid_early_ptr; |
37 | #else | ||
38 | #define x86_cpu_to_apicid_early_ptr NULL | ||
39 | #define x86_bios_cpu_apicid_early_ptr NULL | ||
40 | #endif | ||
36 | 41 | ||
37 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 42 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
38 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 43 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h index 8d1a1f3d21b4..81a29eb08ac4 100644 --- a/include/asm-x86/topology.h +++ b/include/asm-x86/topology.h | |||
@@ -38,8 +38,13 @@ extern int cpu_to_node_map[]; | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | DECLARE_PER_CPU(int, x86_cpu_to_node_map); | 40 | DECLARE_PER_CPU(int, x86_cpu_to_node_map); |
41 | |||
42 | #ifdef CONFIG_SMP | ||
41 | extern int x86_cpu_to_node_map_init[]; | 43 | extern int x86_cpu_to_node_map_init[]; |
42 | extern void *x86_cpu_to_node_map_early_ptr; | 44 | extern void *x86_cpu_to_node_map_early_ptr; |
45 | #else | ||
46 | #define x86_cpu_to_node_map_early_ptr NULL | ||
47 | #endif | ||
43 | 48 | ||
44 | extern cpumask_t node_to_cpumask_map[]; | 49 | extern cpumask_t node_to_cpumask_map[]; |
45 | 50 | ||
@@ -54,6 +59,8 @@ static inline int cpu_to_node(int cpu) | |||
54 | } | 59 | } |
55 | 60 | ||
56 | #else /* CONFIG_X86_64 */ | 61 | #else /* CONFIG_X86_64 */ |
62 | |||
63 | #ifdef CONFIG_SMP | ||
57 | static inline int early_cpu_to_node(int cpu) | 64 | static inline int early_cpu_to_node(int cpu) |
58 | { | 65 | { |
59 | int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; | 66 | int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; |
@@ -65,6 +72,9 @@ static inline int early_cpu_to_node(int cpu) | |||
65 | else | 72 | else |
66 | return NUMA_NO_NODE; | 73 | return NUMA_NO_NODE; |
67 | } | 74 | } |
75 | #else | ||
76 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) | ||
77 | #endif | ||
68 | 78 | ||
69 | static inline int cpu_to_node(int cpu) | 79 | static inline int cpu_to_node(int cpu) |
70 | { | 80 | { |
@@ -76,10 +86,7 @@ static inline int cpu_to_node(int cpu) | |||
76 | return ((int *)x86_cpu_to_node_map_early_ptr)[cpu]; | 86 | return ((int *)x86_cpu_to_node_map_early_ptr)[cpu]; |
77 | } | 87 | } |
78 | #endif | 88 | #endif |
79 | if (per_cpu_offset(cpu)) | 89 | return per_cpu(x86_cpu_to_node_map, cpu); |
80 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
81 | else | ||
82 | return NUMA_NO_NODE; | ||
83 | } | 90 | } |
84 | #endif /* CONFIG_X86_64 */ | 91 | #endif /* CONFIG_X86_64 */ |
85 | 92 | ||