diff options
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r-- | arch/x86/kernel/smpboot.c | 69 |
1 files changed, 2 insertions, 67 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 16ce42613991..e9efdfd51c8d 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -72,10 +72,6 @@ | |||
72 | #include <asm/smpboot_hooks.h> | 72 | #include <asm/smpboot_hooks.h> |
73 | #include <asm/i8259.h> | 73 | #include <asm/i8259.h> |
74 | 74 | ||
75 | #ifdef CONFIG_X86_32 | ||
76 | u8 apicid_2_node[MAX_APICID]; | ||
77 | #endif | ||
78 | |||
79 | /* State of each CPU */ | 75 | /* State of each CPU */ |
80 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | 76 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; |
81 | 77 | ||
@@ -139,62 +135,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info); | |||
139 | 135 | ||
140 | atomic_t init_deasserted; | 136 | atomic_t init_deasserted; |
141 | 137 | ||
142 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) | ||
143 | /* which node each logical CPU is on */ | ||
144 | int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; | ||
145 | EXPORT_SYMBOL(cpu_to_node_map); | ||
146 | |||
147 | /* set up a mapping between cpu and node. */ | ||
148 | static void map_cpu_to_node(int cpu, int node) | ||
149 | { | ||
150 | printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node); | ||
151 | cpumask_set_cpu(cpu, node_to_cpumask_map[node]); | ||
152 | cpu_to_node_map[cpu] = node; | ||
153 | } | ||
154 | |||
155 | /* undo a mapping between cpu and node. */ | ||
156 | static void unmap_cpu_to_node(int cpu) | ||
157 | { | ||
158 | int node; | ||
159 | |||
160 | printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu); | ||
161 | for (node = 0; node < MAX_NUMNODES; node++) | ||
162 | cpumask_clear_cpu(cpu, node_to_cpumask_map[node]); | ||
163 | cpu_to_node_map[cpu] = 0; | ||
164 | } | ||
165 | #else /* !(CONFIG_NUMA && CONFIG_X86_32) */ | ||
166 | #define map_cpu_to_node(cpu, node) ({}) | ||
167 | #define unmap_cpu_to_node(cpu) ({}) | ||
168 | #endif | ||
169 | |||
170 | #ifdef CONFIG_X86_32 | ||
171 | static int boot_cpu_logical_apicid; | ||
172 | |||
173 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = | ||
174 | { [0 ... NR_CPUS-1] = BAD_APICID }; | ||
175 | |||
176 | static void map_cpu_to_logical_apicid(void) | ||
177 | { | ||
178 | int cpu = smp_processor_id(); | ||
179 | int apicid = logical_smp_processor_id(); | ||
180 | int node = apic->apicid_to_node(apicid); | ||
181 | |||
182 | if (!node_online(node)) | ||
183 | node = first_online_node; | ||
184 | |||
185 | cpu_2_logical_apicid[cpu] = apicid; | ||
186 | map_cpu_to_node(cpu, node); | ||
187 | } | ||
188 | |||
189 | void numa_remove_cpu(int cpu) | ||
190 | { | ||
191 | cpu_2_logical_apicid[cpu] = BAD_APICID; | ||
192 | unmap_cpu_to_node(cpu); | ||
193 | } | ||
194 | #else | ||
195 | #define map_cpu_to_logical_apicid() do {} while (0) | ||
196 | #endif | ||
197 | |||
198 | /* | 138 | /* |
199 | * Report back to the Boot Processor. | 139 | * Report back to the Boot Processor. |
200 | * Running on AP. | 140 | * Running on AP. |
@@ -262,7 +202,6 @@ static void __cpuinit smp_callin(void) | |||
262 | apic->smp_callin_clear_local_apic(); | 202 | apic->smp_callin_clear_local_apic(); |
263 | setup_local_APIC(); | 203 | setup_local_APIC(); |
264 | end_local_APIC_setup(); | 204 | end_local_APIC_setup(); |
265 | map_cpu_to_logical_apicid(); | ||
266 | 205 | ||
267 | /* | 206 | /* |
268 | * Need to setup vector mappings before we enable interrupts. | 207 | * Need to setup vector mappings before we enable interrupts. |
@@ -397,6 +336,7 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
397 | 336 | ||
398 | if (cpu_has(c, X86_FEATURE_TOPOEXT)) { | 337 | if (cpu_has(c, X86_FEATURE_TOPOEXT)) { |
399 | if (c->phys_proc_id == o->phys_proc_id && | 338 | if (c->phys_proc_id == o->phys_proc_id && |
339 | per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i) && | ||
400 | c->compute_unit_id == o->compute_unit_id) | 340 | c->compute_unit_id == o->compute_unit_id) |
401 | link_thread_siblings(cpu, i); | 341 | link_thread_siblings(cpu, i); |
402 | } else if (c->phys_proc_id == o->phys_proc_id && | 342 | } else if (c->phys_proc_id == o->phys_proc_id && |
@@ -951,7 +891,6 @@ static __init void disable_smp(void) | |||
951 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | 891 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); |
952 | else | 892 | else |
953 | physid_set_mask_of_physid(0, &phys_cpu_present_map); | 893 | physid_set_mask_of_physid(0, &phys_cpu_present_map); |
954 | map_cpu_to_logical_apicid(); | ||
955 | cpumask_set_cpu(0, cpu_sibling_mask(0)); | 894 | cpumask_set_cpu(0, cpu_sibling_mask(0)); |
956 | cpumask_set_cpu(0, cpu_core_mask(0)); | 895 | cpumask_set_cpu(0, cpu_core_mask(0)); |
957 | } | 896 | } |
@@ -1087,9 +1026,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1087 | smp_store_cpu_info(0); /* Final full version of the data */ | 1026 | smp_store_cpu_info(0); /* Final full version of the data */ |
1088 | cpumask_copy(cpu_callin_mask, cpumask_of(0)); | 1027 | cpumask_copy(cpu_callin_mask, cpumask_of(0)); |
1089 | mb(); | 1028 | mb(); |
1090 | #ifdef CONFIG_X86_32 | 1029 | |
1091 | boot_cpu_logical_apicid = logical_smp_processor_id(); | ||
1092 | #endif | ||
1093 | current_thread_info()->cpu = 0; /* needed? */ | 1030 | current_thread_info()->cpu = 0; /* needed? */ |
1094 | for_each_possible_cpu(i) { | 1031 | for_each_possible_cpu(i) { |
1095 | zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL); | 1032 | zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL); |
@@ -1130,8 +1067,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1130 | 1067 | ||
1131 | bsp_end_local_APIC_setup(); | 1068 | bsp_end_local_APIC_setup(); |
1132 | 1069 | ||
1133 | map_cpu_to_logical_apicid(); | ||
1134 | |||
1135 | if (apic->setup_portio_remap) | 1070 | if (apic->setup_portio_remap) |
1136 | apic->setup_portio_remap(); | 1071 | apic->setup_portio_remap(); |
1137 | 1072 | ||