diff options
author | Tejun Heo <tj@kernel.org> | 2011-01-23 08:37:41 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-01-28 08:54:10 -0500 |
commit | de2d9445f1627830ed2ebd00ee9d851986c940b5 (patch) | |
tree | f71c90737aefaca45d0e28b904c59660809ea0b3 /arch/x86/kernel/smpboot.c | |
parent | 645a79195f66eb68ef3ab2b21d9829ac3aa085a9 (diff) |
x86: Unify node_to_cpumask_map handling between 32 and 64bit
x86_32 has been managing node_to_cpumask_map explicitly from
map_cpu_to_node() and friends in a rather ugly way. With
previous changes, it's now possible to share the code with
64bit.
* When CONFIG_NUMA_EMU is disabled, numa_add/remove_cpu() are
implemented in numa.c and shared by 32 and 64bit. CONFIG_NUMA_EMU
versions still live in numa_64.c.
NUMA_EMU's dependency on 64bit is planned to be removed and the
above should go away together.
* identify_cpu() now calls numa_add_cpu() for 32bit too. This
makes the explicit mask management from map_cpu_to_node() unnecessary.
* The whole x86_32 specific map_cpu_to_node() chunk is no longer
necessary. Dropped.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Cc: eric.dumazet@gmail.com
Cc: yinghai@kernel.org
Cc: brgerst@gmail.com
Cc: gorcunov@gmail.com
Cc: shaohui.zheng@intel.com
Cc: rientjes@google.com
LKML-Reference: <1295789862-25482-16-git-send-email-tj@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: David Rientjes <rientjes@google.com>
Cc: Shaohui Zheng <shaohui.zheng@intel.com>
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r-- | arch/x86/kernel/smpboot.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2c203822424f..522b2173888a 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -132,49 +132,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info); | |||
132 | 132 | ||
133 | atomic_t init_deasserted; | 133 | atomic_t init_deasserted; |
134 | 134 | ||
135 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) | ||
136 | /* set up a mapping between cpu and node. */ | ||
137 | static void map_cpu_to_node(int cpu, int node) | ||
138 | { | ||
139 | printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node); | ||
140 | cpumask_set_cpu(cpu, node_to_cpumask_map[node]); | ||
141 | } | ||
142 | |||
143 | /* undo a mapping between cpu and node. */ | ||
144 | static void unmap_cpu_to_node(int cpu) | ||
145 | { | ||
146 | int node; | ||
147 | |||
148 | printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu); | ||
149 | for (node = 0; node < MAX_NUMNODES; node++) | ||
150 | cpumask_clear_cpu(cpu, node_to_cpumask_map[node]); | ||
151 | } | ||
152 | #else /* !(CONFIG_NUMA && CONFIG_X86_32) */ | ||
153 | #define map_cpu_to_node(cpu, node) ({}) | ||
154 | #define unmap_cpu_to_node(cpu) ({}) | ||
155 | #endif | ||
156 | |||
157 | #ifdef CONFIG_X86_32 | ||
158 | static void map_cpu_to_logical_apicid(void) | ||
159 | { | ||
160 | int cpu = smp_processor_id(); | ||
161 | int node; | ||
162 | |||
163 | node = numa_cpu_node(cpu); | ||
164 | if (!node_online(node)) | ||
165 | node = first_online_node; | ||
166 | |||
167 | map_cpu_to_node(cpu, node); | ||
168 | } | ||
169 | |||
170 | void numa_remove_cpu(int cpu) | ||
171 | { | ||
172 | unmap_cpu_to_node(cpu); | ||
173 | } | ||
174 | #else | ||
175 | #define map_cpu_to_logical_apicid() do {} while (0) | ||
176 | #endif | ||
177 | |||
178 | /* | 135 | /* |
179 | * Report back to the Boot Processor. | 136 | * Report back to the Boot Processor. |
180 | * Running on AP. | 137 | * Running on AP. |
@@ -242,7 +199,6 @@ static void __cpuinit smp_callin(void) | |||
242 | apic->smp_callin_clear_local_apic(); | 199 | apic->smp_callin_clear_local_apic(); |
243 | setup_local_APIC(); | 200 | setup_local_APIC(); |
244 | end_local_APIC_setup(); | 201 | end_local_APIC_setup(); |
245 | map_cpu_to_logical_apicid(); | ||
246 | 202 | ||
247 | /* | 203 | /* |
248 | * Need to setup vector mappings before we enable interrupts. | 204 | * Need to setup vector mappings before we enable interrupts. |
@@ -943,7 +899,6 @@ static __init void disable_smp(void) | |||
943 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | 899 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); |
944 | else | 900 | else |
945 | physid_set_mask_of_physid(0, &phys_cpu_present_map); | 901 | physid_set_mask_of_physid(0, &phys_cpu_present_map); |
946 | map_cpu_to_logical_apicid(); | ||
947 | cpumask_set_cpu(0, cpu_sibling_mask(0)); | 902 | cpumask_set_cpu(0, cpu_sibling_mask(0)); |
948 | cpumask_set_cpu(0, cpu_core_mask(0)); | 903 | cpumask_set_cpu(0, cpu_core_mask(0)); |
949 | } | 904 | } |
@@ -1120,8 +1075,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1120 | 1075 | ||
1121 | end_local_APIC_setup(); | 1076 | end_local_APIC_setup(); |
1122 | 1077 | ||
1123 | map_cpu_to_logical_apicid(); | ||
1124 | |||
1125 | if (apic->setup_portio_remap) | 1078 | if (apic->setup_portio_remap) |
1126 | apic->setup_portio_remap(); | 1079 | apic->setup_portio_remap(); |
1127 | 1080 | ||