diff options
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r-- | arch/x86/kernel/smpboot.c | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f8500c96944..6bd4d9b7387 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -102,14 +102,8 @@ EXPORT_SYMBOL(smp_num_siblings); | |||
102 | /* Last level cache ID of each logical CPU */ | 102 | /* Last level cache ID of each logical CPU */ |
103 | DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID; | 103 | DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID; |
104 | 104 | ||
105 | /* bitmap of online cpus */ | ||
106 | cpumask_t cpu_online_map __read_mostly; | ||
107 | EXPORT_SYMBOL(cpu_online_map); | ||
108 | |||
109 | cpumask_t cpu_callin_map; | 105 | cpumask_t cpu_callin_map; |
110 | cpumask_t cpu_callout_map; | 106 | cpumask_t cpu_callout_map; |
111 | cpumask_t cpu_possible_map; | ||
112 | EXPORT_SYMBOL(cpu_possible_map); | ||
113 | 107 | ||
114 | /* representing HT siblings of each logical CPU */ | 108 | /* representing HT siblings of each logical CPU */ |
115 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); | 109 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); |
@@ -502,7 +496,7 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
502 | } | 496 | } |
503 | 497 | ||
504 | /* maps the cpu to the sched domain representing multi-core */ | 498 | /* maps the cpu to the sched domain representing multi-core */ |
505 | cpumask_t cpu_coregroup_map(int cpu) | 499 | const struct cpumask *cpu_coregroup_mask(int cpu) |
506 | { | 500 | { |
507 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 501 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
508 | /* | 502 | /* |
@@ -510,9 +504,14 @@ cpumask_t cpu_coregroup_map(int cpu) | |||
510 | * And for power savings, we return cpu_core_map | 504 | * And for power savings, we return cpu_core_map |
511 | */ | 505 | */ |
512 | if (sched_mc_power_savings || sched_smt_power_savings) | 506 | if (sched_mc_power_savings || sched_smt_power_savings) |
513 | return per_cpu(cpu_core_map, cpu); | 507 | return &per_cpu(cpu_core_map, cpu); |
514 | else | 508 | else |
515 | return c->llc_shared_map; | 509 | return &c->llc_shared_map; |
510 | } | ||
511 | |||
512 | cpumask_t cpu_coregroup_map(int cpu) | ||
513 | { | ||
514 | return *cpu_coregroup_mask(cpu); | ||
516 | } | 515 | } |
517 | 516 | ||
518 | static void impress_friends(void) | 517 | static void impress_friends(void) |
@@ -1155,7 +1154,7 @@ static void __init smp_cpu_index_default(void) | |||
1155 | for_each_possible_cpu(i) { | 1154 | for_each_possible_cpu(i) { |
1156 | c = &cpu_data(i); | 1155 | c = &cpu_data(i); |
1157 | /* mark all to hotplug */ | 1156 | /* mark all to hotplug */ |
1158 | c->cpu_index = NR_CPUS; | 1157 | c->cpu_index = nr_cpu_ids; |
1159 | } | 1158 | } |
1160 | } | 1159 | } |
1161 | 1160 | ||
@@ -1260,6 +1259,15 @@ void __init native_smp_cpus_done(unsigned int max_cpus) | |||
1260 | check_nmi_watchdog(); | 1259 | check_nmi_watchdog(); |
1261 | } | 1260 | } |
1262 | 1261 | ||
1262 | static int __initdata setup_possible_cpus = -1; | ||
1263 | static int __init _setup_possible_cpus(char *str) | ||
1264 | { | ||
1265 | get_option(&str, &setup_possible_cpus); | ||
1266 | return 0; | ||
1267 | } | ||
1268 | early_param("possible_cpus", _setup_possible_cpus); | ||
1269 | |||
1270 | |||
1263 | /* | 1271 | /* |
1264 | * cpu_possible_map should be static, it cannot change as cpu's | 1272 | * cpu_possible_map should be static, it cannot change as cpu's |
1265 | * are onlined, or offlined. The reason is per-cpu data-structures | 1273 | * are onlined, or offlined. The reason is per-cpu data-structures |
@@ -1272,7 +1280,7 @@ void __init native_smp_cpus_done(unsigned int max_cpus) | |||
1272 | * | 1280 | * |
1273 | * Three ways to find out the number of additional hotplug CPUs: | 1281 | * Three ways to find out the number of additional hotplug CPUs: |
1274 | * - If the BIOS specified disabled CPUs in ACPI/mptables use that. | 1282 | * - If the BIOS specified disabled CPUs in ACPI/mptables use that. |
1275 | * - The user can overwrite it with additional_cpus=NUM | 1283 | * - The user can overwrite it with possible_cpus=NUM |
1276 | * - Otherwise don't reserve additional CPUs. | 1284 | * - Otherwise don't reserve additional CPUs. |
1277 | * We do this because additional CPUs waste a lot of memory. | 1285 | * We do this because additional CPUs waste a lot of memory. |
1278 | * -AK | 1286 | * -AK |
@@ -1285,9 +1293,19 @@ __init void prefill_possible_map(void) | |||
1285 | if (!num_processors) | 1293 | if (!num_processors) |
1286 | num_processors = 1; | 1294 | num_processors = 1; |
1287 | 1295 | ||
1288 | possible = num_processors + disabled_cpus; | 1296 | if (setup_possible_cpus == -1) |
1289 | if (possible > NR_CPUS) | 1297 | possible = num_processors + disabled_cpus; |
1290 | possible = NR_CPUS; | 1298 | else |
1299 | possible = setup_possible_cpus; | ||
1300 | |||
1301 | total_cpus = max_t(int, possible, num_processors + disabled_cpus); | ||
1302 | |||
1303 | if (possible > CONFIG_NR_CPUS) { | ||
1304 | printk(KERN_WARNING | ||
1305 | "%d Processors exceeds NR_CPUS limit of %d\n", | ||
1306 | possible, CONFIG_NR_CPUS); | ||
1307 | possible = CONFIG_NR_CPUS; | ||
1308 | } | ||
1291 | 1309 | ||
1292 | printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n", | 1310 | printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n", |
1293 | possible, max_t(int, possible - num_processors, 0)); | 1311 | possible, max_t(int, possible - num_processors, 0)); |
@@ -1352,7 +1370,7 @@ void cpu_disable_common(void) | |||
1352 | lock_vector_lock(); | 1370 | lock_vector_lock(); |
1353 | remove_cpu_from_maps(cpu); | 1371 | remove_cpu_from_maps(cpu); |
1354 | unlock_vector_lock(); | 1372 | unlock_vector_lock(); |
1355 | fixup_irqs(cpu_online_map); | 1373 | fixup_irqs(); |
1356 | } | 1374 | } |
1357 | 1375 | ||
1358 | int native_cpu_disable(void) | 1376 | int native_cpu_disable(void) |