aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smpboot.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-15 22:00:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-15 22:00:53 -0400
commit502f4d4f74219749a9758b9bbc27fb665b2e83ab (patch)
tree78076e71ea6e455354913005f04b53cff124553f /arch/x86/kernel/smpboot.c
parentda849abeb86ddaa093b0935fde595e8e4dd21ffc (diff)
parente5fea868e6c04343e501176a373d568c1c0094aa (diff)
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86: Fix and clean up generic_processor_info() x86: Don't copy per_cpu cpuinfo for BSP two times x86: Move llc_shared_map out of cpu_info
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 08776a953487..e2865df242bc 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -130,6 +130,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
130DEFINE_PER_CPU(cpumask_var_t, cpu_core_map); 130DEFINE_PER_CPU(cpumask_var_t, cpu_core_map);
131EXPORT_PER_CPU_SYMBOL(cpu_core_map); 131EXPORT_PER_CPU_SYMBOL(cpu_core_map);
132 132
133DEFINE_PER_CPU(cpumask_var_t, cpu_llc_shared_map);
134
133/* Per CPU bogomips and other parameters */ 135/* Per CPU bogomips and other parameters */
134DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); 136DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
135EXPORT_PER_CPU_SYMBOL(cpu_info); 137EXPORT_PER_CPU_SYMBOL(cpu_info);
@@ -355,23 +357,6 @@ notrace static void __cpuinit start_secondary(void *unused)
355 cpu_idle(); 357 cpu_idle();
356} 358}
357 359
358#ifdef CONFIG_CPUMASK_OFFSTACK
359/* In this case, llc_shared_map is a pointer to a cpumask. */
360static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
361 const struct cpuinfo_x86 *src)
362{
363 struct cpumask *llc = dst->llc_shared_map;
364 *dst = *src;
365 dst->llc_shared_map = llc;
366}
367#else
368static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
369 const struct cpuinfo_x86 *src)
370{
371 *dst = *src;
372}
373#endif /* CONFIG_CPUMASK_OFFSTACK */
374
375/* 360/*
376 * The bootstrap kernel entry code has set these up. Save them for 361 * The bootstrap kernel entry code has set these up. Save them for
377 * a given CPU 362 * a given CPU
@@ -381,7 +366,7 @@ void __cpuinit smp_store_cpu_info(int id)
381{ 366{
382 struct cpuinfo_x86 *c = &cpu_data(id); 367 struct cpuinfo_x86 *c = &cpu_data(id);
383 368
384 copy_cpuinfo_x86(c, &boot_cpu_data); 369 *c = boot_cpu_data;
385 c->cpu_index = id; 370 c->cpu_index = id;
386 if (id != 0) 371 if (id != 0)
387 identify_secondary_cpu(c); 372 identify_secondary_cpu(c);
@@ -389,15 +374,12 @@ void __cpuinit smp_store_cpu_info(int id)
389 374
390static void __cpuinit link_thread_siblings(int cpu1, int cpu2) 375static void __cpuinit link_thread_siblings(int cpu1, int cpu2)
391{ 376{
392 struct cpuinfo_x86 *c1 = &cpu_data(cpu1);
393 struct cpuinfo_x86 *c2 = &cpu_data(cpu2);
394
395 cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2)); 377 cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2));
396 cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1)); 378 cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1));
397 cpumask_set_cpu(cpu1, cpu_core_mask(cpu2)); 379 cpumask_set_cpu(cpu1, cpu_core_mask(cpu2));
398 cpumask_set_cpu(cpu2, cpu_core_mask(cpu1)); 380 cpumask_set_cpu(cpu2, cpu_core_mask(cpu1));
399 cpumask_set_cpu(cpu1, c2->llc_shared_map); 381 cpumask_set_cpu(cpu1, cpu_llc_shared_mask(cpu2));
400 cpumask_set_cpu(cpu2, c1->llc_shared_map); 382 cpumask_set_cpu(cpu2, cpu_llc_shared_mask(cpu1));
401} 383}
402 384
403 385
@@ -425,7 +407,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
425 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); 407 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
426 } 408 }
427 409
428 cpumask_set_cpu(cpu, c->llc_shared_map); 410 cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
429 411
430 if (__this_cpu_read(cpu_info.x86_max_cores) == 1) { 412 if (__this_cpu_read(cpu_info.x86_max_cores) == 1) {
431 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu)); 413 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
@@ -436,8 +418,8 @@ void __cpuinit set_cpu_sibling_map(int cpu)
436 for_each_cpu(i, cpu_sibling_setup_mask) { 418 for_each_cpu(i, cpu_sibling_setup_mask) {
437 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && 419 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
438 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { 420 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
439 cpumask_set_cpu(i, c->llc_shared_map); 421 cpumask_set_cpu(i, cpu_llc_shared_mask(cpu));
440 cpumask_set_cpu(cpu, cpu_data(i).llc_shared_map); 422 cpumask_set_cpu(cpu, cpu_llc_shared_mask(i));
441 } 423 }
442 if (c->phys_proc_id == cpu_data(i).phys_proc_id) { 424 if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
443 cpumask_set_cpu(i, cpu_core_mask(cpu)); 425 cpumask_set_cpu(i, cpu_core_mask(cpu));
@@ -476,7 +458,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
476 !(cpu_has(c, X86_FEATURE_AMD_DCM))) 458 !(cpu_has(c, X86_FEATURE_AMD_DCM)))
477 return cpu_core_mask(cpu); 459 return cpu_core_mask(cpu);
478 else 460 else
479 return c->llc_shared_map; 461 return cpu_llc_shared_mask(cpu);
480} 462}
481 463
482static void impress_friends(void) 464static void impress_friends(void)
@@ -1089,13 +1071,13 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1089 1071
1090 preempt_disable(); 1072 preempt_disable();
1091 smp_cpu_index_default(); 1073 smp_cpu_index_default();
1092 memcpy(__this_cpu_ptr(&cpu_info), &boot_cpu_data, sizeof(cpu_info)); 1074
1093 cpumask_copy(cpu_callin_mask, cpumask_of(0));
1094 mb();
1095 /* 1075 /*
1096 * Setup boot CPU information 1076 * Setup boot CPU information
1097 */ 1077 */
1098 smp_store_cpu_info(0); /* Final full version of the data */ 1078 smp_store_cpu_info(0); /* Final full version of the data */
1079 cpumask_copy(cpu_callin_mask, cpumask_of(0));
1080 mb();
1099#ifdef CONFIG_X86_32 1081#ifdef CONFIG_X86_32
1100 boot_cpu_logical_apicid = logical_smp_processor_id(); 1082 boot_cpu_logical_apicid = logical_smp_processor_id();
1101#endif 1083#endif
@@ -1103,7 +1085,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1103 for_each_possible_cpu(i) { 1085 for_each_possible_cpu(i) {
1104 zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL); 1086 zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
1105 zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL); 1087 zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
1106 zalloc_cpumask_var(&cpu_data(i).llc_shared_map, GFP_KERNEL); 1088 zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
1107 } 1089 }
1108 set_cpu_sibling_map(0); 1090 set_cpu_sibling_map(0);
1109 1091