diff options
author | Chuck Ebbert <cebbert@redhat.com> | 2008-09-29 18:29:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-13 04:22:50 -0400 |
commit | 14adf855baefad5ac3b545be23a64e6b61d6b74a (patch) | |
tree | a905fcad7c788f1ca62e9ee292e39825992dbf62 | |
parent | 69d45dd1c3bb512a9f5f9c464ac625eb707669ec (diff) |
x86: move prefill_possible_map calling early, fix, V2
Commit 4a701737 ("x86: move prefill_possible_map calling early, fix")
is the wrong fix: prefill_possible_map() needs to be available
even when CONFIG_HOTPLUG_CPU is not set. A followon patch will do that.
Fix this correctly by making prefill_possible_map() available even when
CONFIG_HOTPLUG_CPU is not set. The function is needed so that
the number of possible CPUs can be determined.
Tested on uniprocessor machine with CPU hotplug disabled.
From boot log:
Before: NR_CPUS: 512, nr_cpu_ids: 512, nr_node_ids 1
After: NR_CPUS: 512, nr_cpu_ids: 1, nr_node_ids 1
Signed-off-by: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/smpboot.c | 62 | ||||
-rw-r--r-- | include/asm-x86/smp.h | 8 |
2 files changed, 34 insertions, 36 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index a778e221ccfb..23913785c262 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1261,39 +1261,8 @@ void __init native_smp_cpus_done(unsigned int max_cpus) | |||
1261 | check_nmi_watchdog(); | 1261 | check_nmi_watchdog(); |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | #ifdef CONFIG_HOTPLUG_CPU | ||
1265 | |||
1266 | static void remove_siblinginfo(int cpu) | ||
1267 | { | ||
1268 | int sibling; | ||
1269 | struct cpuinfo_x86 *c = &cpu_data(cpu); | ||
1270 | |||
1271 | for_each_cpu_mask_nr(sibling, per_cpu(cpu_core_map, cpu)) { | ||
1272 | cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); | ||
1273 | /*/ | ||
1274 | * last thread sibling in this cpu core going down | ||
1275 | */ | ||
1276 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) | ||
1277 | cpu_data(sibling).booted_cores--; | ||
1278 | } | ||
1279 | |||
1280 | for_each_cpu_mask_nr(sibling, per_cpu(cpu_sibling_map, cpu)) | ||
1281 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); | ||
1282 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); | ||
1283 | cpus_clear(per_cpu(cpu_core_map, cpu)); | ||
1284 | c->phys_proc_id = 0; | ||
1285 | c->cpu_core_id = 0; | ||
1286 | cpu_clear(cpu, cpu_sibling_setup_map); | ||
1287 | } | ||
1288 | |||
1289 | static int additional_cpus __initdata = -1; | 1264 | static int additional_cpus __initdata = -1; |
1290 | 1265 | ||
1291 | static __init int setup_additional_cpus(char *s) | ||
1292 | { | ||
1293 | return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL; | ||
1294 | } | ||
1295 | early_param("additional_cpus", setup_additional_cpus); | ||
1296 | |||
1297 | /* | 1266 | /* |
1298 | * cpu_possible_map should be static, it cannot change as cpu's | 1267 | * cpu_possible_map should be static, it cannot change as cpu's |
1299 | * are onlined, or offlined. The reason is per-cpu data-structures | 1268 | * are onlined, or offlined. The reason is per-cpu data-structures |
@@ -1340,6 +1309,37 @@ __init void prefill_possible_map(void) | |||
1340 | nr_cpu_ids = possible; | 1309 | nr_cpu_ids = possible; |
1341 | } | 1310 | } |
1342 | 1311 | ||
1312 | #ifdef CONFIG_HOTPLUG_CPU | ||
1313 | |||
1314 | static void remove_siblinginfo(int cpu) | ||
1315 | { | ||
1316 | int sibling; | ||
1317 | struct cpuinfo_x86 *c = &cpu_data(cpu); | ||
1318 | |||
1319 | for_each_cpu_mask_nr(sibling, per_cpu(cpu_core_map, cpu)) { | ||
1320 | cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); | ||
1321 | /*/ | ||
1322 | * last thread sibling in this cpu core going down | ||
1323 | */ | ||
1324 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) | ||
1325 | cpu_data(sibling).booted_cores--; | ||
1326 | } | ||
1327 | |||
1328 | for_each_cpu_mask_nr(sibling, per_cpu(cpu_sibling_map, cpu)) | ||
1329 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); | ||
1330 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); | ||
1331 | cpus_clear(per_cpu(cpu_core_map, cpu)); | ||
1332 | c->phys_proc_id = 0; | ||
1333 | c->cpu_core_id = 0; | ||
1334 | cpu_clear(cpu, cpu_sibling_setup_map); | ||
1335 | } | ||
1336 | |||
1337 | static __init int setup_additional_cpus(char *s) | ||
1338 | { | ||
1339 | return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL; | ||
1340 | } | ||
1341 | early_param("additional_cpus", setup_additional_cpus); | ||
1342 | |||
1343 | static void __ref remove_cpu_from_maps(int cpu) | 1343 | static void __ref remove_cpu_from_maps(int cpu) |
1344 | { | 1344 | { |
1345 | cpu_clear(cpu, cpu_online_map); | 1345 | cpu_clear(cpu, cpu_online_map); |
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h index 6df2615f9138..a6afc29f2dd9 100644 --- a/include/asm-x86/smp.h +++ b/include/asm-x86/smp.h | |||
@@ -141,6 +141,8 @@ void play_dead_common(void); | |||
141 | void native_send_call_func_ipi(cpumask_t mask); | 141 | void native_send_call_func_ipi(cpumask_t mask); |
142 | void native_send_call_func_single_ipi(int cpu); | 142 | void native_send_call_func_single_ipi(int cpu); |
143 | 143 | ||
144 | extern void prefill_possible_map(void); | ||
145 | |||
144 | void smp_store_cpu_info(int id); | 146 | void smp_store_cpu_info(int id); |
145 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | 147 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
146 | 148 | ||
@@ -149,15 +151,11 @@ static inline int num_booting_cpus(void) | |||
149 | { | 151 | { |
150 | return cpus_weight(cpu_callout_map); | 152 | return cpus_weight(cpu_callout_map); |
151 | } | 153 | } |
152 | #endif /* CONFIG_SMP */ | ||
153 | |||
154 | #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_CPU) | ||
155 | extern void prefill_possible_map(void); | ||
156 | #else | 154 | #else |
157 | static inline void prefill_possible_map(void) | 155 | static inline void prefill_possible_map(void) |
158 | { | 156 | { |
159 | } | 157 | } |
160 | #endif | 158 | #endif /* CONFIG_SMP */ |
161 | 159 | ||
162 | extern unsigned disabled_cpus __cpuinitdata; | 160 | extern unsigned disabled_cpus __cpuinitdata; |
163 | 161 | ||