aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smpboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r--arch/x86/kernel/smpboot.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 09d0172a0059..16ce42613991 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -131,6 +131,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
131DEFINE_PER_CPU(cpumask_var_t, cpu_core_map); 131DEFINE_PER_CPU(cpumask_var_t, cpu_core_map);
132EXPORT_PER_CPU_SYMBOL(cpu_core_map); 132EXPORT_PER_CPU_SYMBOL(cpu_core_map);
133 133
134DEFINE_PER_CPU(cpumask_var_t, cpu_llc_shared_map);
135
134/* Per CPU bogomips and other parameters */ 136/* Per CPU bogomips and other parameters */
135DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); 137DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
136EXPORT_PER_CPU_SYMBOL(cpu_info); 138EXPORT_PER_CPU_SYMBOL(cpu_info);
@@ -356,23 +358,6 @@ notrace static void __cpuinit start_secondary(void *unused)
356 cpu_idle(); 358 cpu_idle();
357} 359}
358 360
359#ifdef CONFIG_CPUMASK_OFFSTACK
360/* In this case, llc_shared_map is a pointer to a cpumask. */
361static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
362 const struct cpuinfo_x86 *src)
363{
364 struct cpumask *llc = dst->llc_shared_map;
365 *dst = *src;
366 dst->llc_shared_map = llc;
367}
368#else
369static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
370 const struct cpuinfo_x86 *src)
371{
372 *dst = *src;
373}
374#endif /* CONFIG_CPUMASK_OFFSTACK */
375
376/* 361/*
377 * The bootstrap kernel entry code has set these up. Save them for 362 * The bootstrap kernel entry code has set these up. Save them for
378 * a given CPU 363 * a given CPU
@@ -382,7 +367,7 @@ void __cpuinit smp_store_cpu_info(int id)
382{ 367{
383 struct cpuinfo_x86 *c = &cpu_data(id); 368 struct cpuinfo_x86 *c = &cpu_data(id);
384 369
385 copy_cpuinfo_x86(c, &boot_cpu_data); 370 *c = boot_cpu_data;
386 c->cpu_index = id; 371 c->cpu_index = id;
387 if (id != 0) 372 if (id != 0)
388 identify_secondary_cpu(c); 373 identify_secondary_cpu(c);
@@ -390,15 +375,12 @@ void __cpuinit smp_store_cpu_info(int id)
390 375
391static void __cpuinit link_thread_siblings(int cpu1, int cpu2) 376static void __cpuinit link_thread_siblings(int cpu1, int cpu2)
392{ 377{
393 struct cpuinfo_x86 *c1 = &cpu_data(cpu1);
394 struct cpuinfo_x86 *c2 = &cpu_data(cpu2);
395
396 cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2)); 378 cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2));
397 cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1)); 379 cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1));
398 cpumask_set_cpu(cpu1, cpu_core_mask(cpu2)); 380 cpumask_set_cpu(cpu1, cpu_core_mask(cpu2));
399 cpumask_set_cpu(cpu2, cpu_core_mask(cpu1)); 381 cpumask_set_cpu(cpu2, cpu_core_mask(cpu1));
400 cpumask_set_cpu(cpu1, c2->llc_shared_map); 382 cpumask_set_cpu(cpu1, cpu_llc_shared_mask(cpu2));
401 cpumask_set_cpu(cpu2, c1->llc_shared_map); 383 cpumask_set_cpu(cpu2, cpu_llc_shared_mask(cpu1));
402} 384}
403 385
404 386
@@ -426,7 +408,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
426 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); 408 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
427 } 409 }
428 410
429 cpumask_set_cpu(cpu, c->llc_shared_map); 411 cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
430 412
431 if (__this_cpu_read(cpu_info.x86_max_cores) == 1) { 413 if (__this_cpu_read(cpu_info.x86_max_cores) == 1) {
432 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu)); 414 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
@@ -437,8 +419,8 @@ void __cpuinit set_cpu_sibling_map(int cpu)
437 for_each_cpu(i, cpu_sibling_setup_mask) { 419 for_each_cpu(i, cpu_sibling_setup_mask) {
438 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && 420 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
439 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { 421 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
440 cpumask_set_cpu(i, c->llc_shared_map); 422 cpumask_set_cpu(i, cpu_llc_shared_mask(cpu));
441 cpumask_set_cpu(cpu, cpu_data(i).llc_shared_map); 423 cpumask_set_cpu(cpu, cpu_llc_shared_mask(i));
442 } 424 }
443 if (c->phys_proc_id == cpu_data(i).phys_proc_id) { 425 if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
444 cpumask_set_cpu(i, cpu_core_mask(cpu)); 426 cpumask_set_cpu(i, cpu_core_mask(cpu));
@@ -477,7 +459,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
477 !(cpu_has(c, X86_FEATURE_AMD_DCM))) 459 !(cpu_has(c, X86_FEATURE_AMD_DCM)))
478 return cpu_core_mask(cpu); 460 return cpu_core_mask(cpu);
479 else 461 else
480 return c->llc_shared_map; 462 return cpu_llc_shared_mask(cpu);
481} 463}
482 464
483static void impress_friends(void) 465static void impress_friends(void)
@@ -1098,13 +1080,13 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1098 1080
1099 preempt_disable(); 1081 preempt_disable();
1100 smp_cpu_index_default(); 1082 smp_cpu_index_default();
1101 memcpy(__this_cpu_ptr(&cpu_info), &boot_cpu_data, sizeof(cpu_info)); 1083
1102 cpumask_copy(cpu_callin_mask, cpumask_of(0));
1103 mb();
1104 /* 1084 /*
1105 * Setup boot CPU information 1085 * Setup boot CPU information
1106 */ 1086 */
1107 smp_store_cpu_info(0); /* Final full version of the data */ 1087 smp_store_cpu_info(0); /* Final full version of the data */
1088 cpumask_copy(cpu_callin_mask, cpumask_of(0));
1089 mb();
1108#ifdef CONFIG_X86_32 1090#ifdef CONFIG_X86_32
1109 boot_cpu_logical_apicid = logical_smp_processor_id(); 1091 boot_cpu_logical_apicid = logical_smp_processor_id();
1110#endif 1092#endif
@@ -1112,7 +1094,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1112 for_each_possible_cpu(i) { 1094 for_each_possible_cpu(i) {
1113 zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL); 1095 zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
1114 zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL); 1096 zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
1115 zalloc_cpumask_var(&cpu_data(i).llc_shared_map, GFP_KERNEL); 1097 zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
1116 } 1098 }
1117 set_cpu_sibling_map(0); 1099 set_cpu_sibling_map(0);
1118 1100