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.c75
1 files changed, 43 insertions, 32 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 91055d7fc1b..45531e3ba19 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -88,7 +88,7 @@ static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
88#define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x)) 88#define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
89#define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p)) 89#define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
90#else 90#else
91struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; 91static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
92#define get_idle_for_cpu(x) (idle_thread_array[(x)]) 92#define get_idle_for_cpu(x) (idle_thread_array[(x)])
93#define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p)) 93#define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p))
94#endif 94#endif
@@ -129,7 +129,7 @@ static int boot_cpu_logical_apicid;
129static cpumask_t cpu_sibling_setup_map; 129static cpumask_t cpu_sibling_setup_map;
130 130
131/* Set if we find a B stepping CPU */ 131/* Set if we find a B stepping CPU */
132int __cpuinitdata smp_b_stepping; 132static int __cpuinitdata smp_b_stepping;
133 133
134#if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) 134#if defined(CONFIG_NUMA) && defined(CONFIG_X86_32)
135 135
@@ -756,6 +756,14 @@ static void __cpuinit do_fork_idle(struct work_struct *work)
756} 756}
757 757
758#ifdef CONFIG_X86_64 758#ifdef CONFIG_X86_64
759
760/* __ref because it's safe to call free_bootmem when after_bootmem == 0. */
761static void __ref free_bootmem_pda(struct x8664_pda *oldpda)
762{
763 if (!after_bootmem)
764 free_bootmem((unsigned long)oldpda, sizeof(*oldpda));
765}
766
759/* 767/*
760 * Allocate node local memory for the AP pda. 768 * Allocate node local memory for the AP pda.
761 * 769 *
@@ -784,8 +792,7 @@ int __cpuinit get_local_pda(int cpu)
784 792
785 if (oldpda) { 793 if (oldpda) {
786 memcpy(newpda, oldpda, size); 794 memcpy(newpda, oldpda, size);
787 if (!after_bootmem) 795 free_bootmem_pda(oldpda);
788 free_bootmem((unsigned long)oldpda, size);
789 } 796 }
790 797
791 newpda->in_bootmem = 0; 798 newpda->in_bootmem = 0;
@@ -994,17 +1001,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
994 flush_tlb_all(); 1001 flush_tlb_all();
995 low_mappings = 1; 1002 low_mappings = 1;
996 1003
997#ifdef CONFIG_X86_PC
998 if (def_to_bigsmp && apicid > 8) {
999 printk(KERN_WARNING
1000 "More than 8 CPUs detected - skipping them.\n"
1001 "Use CONFIG_X86_GENERICARCH and CONFIG_X86_BIGSMP.\n");
1002 err = -1;
1003 } else
1004 err = do_boot_cpu(apicid, cpu);
1005#else
1006 err = do_boot_cpu(apicid, cpu); 1004 err = do_boot_cpu(apicid, cpu);
1007#endif
1008 1005
1009 zap_low_mappings(); 1006 zap_low_mappings();
1010 low_mappings = 0; 1007 low_mappings = 0;
@@ -1058,6 +1055,34 @@ static __init void disable_smp(void)
1058static int __init smp_sanity_check(unsigned max_cpus) 1055static int __init smp_sanity_check(unsigned max_cpus)
1059{ 1056{
1060 preempt_disable(); 1057 preempt_disable();
1058
1059#if defined(CONFIG_X86_PC) && defined(CONFIG_X86_32)
1060 if (def_to_bigsmp && nr_cpu_ids > 8) {
1061 unsigned int cpu;
1062 unsigned nr;
1063
1064 printk(KERN_WARNING
1065 "More than 8 CPUs detected - skipping them.\n"
1066 "Use CONFIG_X86_GENERICARCH and CONFIG_X86_BIGSMP.\n");
1067
1068 nr = 0;
1069 for_each_present_cpu(cpu) {
1070 if (nr >= 8)
1071 cpu_clear(cpu, cpu_present_map);
1072 nr++;
1073 }
1074
1075 nr = 0;
1076 for_each_possible_cpu(cpu) {
1077 if (nr >= 8)
1078 cpu_clear(cpu, cpu_possible_map);
1079 nr++;
1080 }
1081
1082 nr_cpu_ids = 8;
1083 }
1084#endif
1085
1061 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { 1086 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
1062 printk(KERN_WARNING "weird, boot CPU (#%d) not listed" 1087 printk(KERN_WARNING "weird, boot CPU (#%d) not listed"
1063 "by the BIOS.\n", hard_smp_processor_id()); 1088 "by the BIOS.\n", hard_smp_processor_id());
@@ -1196,6 +1221,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1196 printk(KERN_INFO "CPU%d: ", 0); 1221 printk(KERN_INFO "CPU%d: ", 0);
1197 print_cpu_info(&cpu_data(0)); 1222 print_cpu_info(&cpu_data(0));
1198 setup_boot_clock(); 1223 setup_boot_clock();
1224
1225 if (is_uv_system())
1226 uv_system_init();
1199out: 1227out:
1200 preempt_enable(); 1228 preempt_enable();
1201} 1229}
@@ -1285,16 +1313,13 @@ __init void prefill_possible_map(void)
1285 if (!num_processors) 1313 if (!num_processors)
1286 num_processors = 1; 1314 num_processors = 1;
1287 1315
1288#ifdef CONFIG_HOTPLUG_CPU
1289 if (additional_cpus == -1) { 1316 if (additional_cpus == -1) {
1290 if (disabled_cpus > 0) 1317 if (disabled_cpus > 0)
1291 additional_cpus = disabled_cpus; 1318 additional_cpus = disabled_cpus;
1292 else 1319 else
1293 additional_cpus = 0; 1320 additional_cpus = 0;
1294 } 1321 }
1295#else 1322
1296 additional_cpus = 0;
1297#endif
1298 possible = num_processors + additional_cpus; 1323 possible = num_processors + additional_cpus;
1299 if (possible > NR_CPUS) 1324 if (possible > NR_CPUS)
1300 possible = NR_CPUS; 1325 possible = NR_CPUS;
@@ -1386,17 +1411,3 @@ void __cpu_die(unsigned int cpu)
1386 BUG(); 1411 BUG();
1387} 1412}
1388#endif 1413#endif
1389
1390/*
1391 * If the BIOS enumerates physical processors before logical,
1392 * maxcpus=N at enumeration-time can be used to disable HT.
1393 */
1394static int __init parse_maxcpus(char *arg)
1395{
1396 extern unsigned int maxcpus;
1397
1398 if (arg)
1399 maxcpus = simple_strtoul(arg, NULL, 0);
1400 return 0;
1401}
1402early_param("maxcpus", parse_maxcpus);