diff options
author | Andi Kleen <ak@suse.de> | 2005-07-29 00:15:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-29 00:45:58 -0400 |
commit | 61b1b2d0239da82c0bed8adaa1d070c6551d4afd (patch) | |
tree | 121b652c8b6915d17beb622086e362a9e9c1733e /arch/x86_64/kernel/smpboot.c | |
parent | 5b943fbfaf0dbdd3cd9ff2dda100f0b8c47a7d8c (diff) |
[PATCH] x86_64: Move cpu_present/possible_map parsing earlier
Various code needs this information now before the actual SMP bootup. Instead
of computing it on the fly while booting the other CPUs set it up now while
initial MPtable/MADT parsing.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/smpboot.c')
-rw-r--r-- | arch/x86_64/kernel/smpboot.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index e773a794ec45..db27e1844ed2 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -113,24 +113,6 @@ struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; | |||
113 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) | 113 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * cpu_possible_map should be static, it cannot change as cpu's | ||
117 | * are onlined, or offlined. The reason is per-cpu data-structures | ||
118 | * are allocated by some modules at init time, and dont expect to | ||
119 | * do this dynamically on cpu arrival/departure. | ||
120 | * cpu_present_map on the other hand can change dynamically. | ||
121 | * In case when cpu_hotplug is not compiled, then we resort to current | ||
122 | * behaviour, which is cpu_possible == cpu_present. | ||
123 | * If cpu-hotplug is supported, then we need to preallocate for all | ||
124 | * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. | ||
125 | * - Ashok Raj | ||
126 | */ | ||
127 | #ifdef CONFIG_HOTPLUG_CPU | ||
128 | #define fixup_cpu_possible_map(x) cpu_set((x), cpu_possible_map) | ||
129 | #else | ||
130 | #define fixup_cpu_possible_map(x) | ||
131 | #endif | ||
132 | |||
133 | /* | ||
134 | * Currently trivial. Write the real->protected mode | 116 | * Currently trivial. Write the real->protected mode |
135 | * bootstrap into the page concerned. The caller | 117 | * bootstrap into the page concerned. The caller |
136 | * has made sure it's suitably aligned. | 118 | * has made sure it's suitably aligned. |
@@ -924,6 +906,27 @@ static __init void enforce_max_cpus(unsigned max_cpus) | |||
924 | } | 906 | } |
925 | } | 907 | } |
926 | 908 | ||
909 | #ifdef CONFIG_HOTPLUG_CPU | ||
910 | /* | ||
911 | * cpu_possible_map should be static, it cannot change as cpu's | ||
912 | * are onlined, or offlined. The reason is per-cpu data-structures | ||
913 | * are allocated by some modules at init time, and dont expect to | ||
914 | * do this dynamically on cpu arrival/departure. | ||
915 | * cpu_present_map on the other hand can change dynamically. | ||
916 | * In case when cpu_hotplug is not compiled, then we resort to current | ||
917 | * behaviour, which is cpu_possible == cpu_present. | ||
918 | * If cpu-hotplug is supported, then we need to preallocate for all | ||
919 | * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. | ||
920 | * - Ashok Raj | ||
921 | */ | ||
922 | static void prefill_possible_map(void) | ||
923 | { | ||
924 | int i; | ||
925 | for (i = 0; i < NR_CPUS; i++) | ||
926 | cpu_set(i, cpu_possible_map); | ||
927 | } | ||
928 | #endif | ||
929 | |||
927 | /* | 930 | /* |
928 | * Various sanity checks. | 931 | * Various sanity checks. |
929 | */ | 932 | */ |
@@ -987,25 +990,15 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
987 | */ | 990 | */ |
988 | void __init smp_prepare_cpus(unsigned int max_cpus) | 991 | void __init smp_prepare_cpus(unsigned int max_cpus) |
989 | { | 992 | { |
990 | int i; | ||
991 | |||
992 | nmi_watchdog_default(); | 993 | nmi_watchdog_default(); |
993 | current_cpu_data = boot_cpu_data; | 994 | current_cpu_data = boot_cpu_data; |
994 | current_thread_info()->cpu = 0; /* needed? */ | 995 | current_thread_info()->cpu = 0; /* needed? */ |
995 | 996 | ||
996 | enforce_max_cpus(max_cpus); | 997 | enforce_max_cpus(max_cpus); |
997 | 998 | ||
998 | /* | 999 | #ifdef CONFIG_HOTPLUG_CPU |
999 | * Fill in cpu_present_mask | 1000 | prefill_possible_map(); |
1000 | */ | 1001 | #endif |
1001 | for (i = 0; i < NR_CPUS; i++) { | ||
1002 | int apicid = cpu_present_to_apicid(i); | ||
1003 | if (physid_isset(apicid, phys_cpu_present_map)) { | ||
1004 | cpu_set(i, cpu_present_map); | ||
1005 | cpu_set(i, cpu_possible_map); | ||
1006 | } | ||
1007 | fixup_cpu_possible_map(i); | ||
1008 | } | ||
1009 | 1002 | ||
1010 | if (smp_sanity_check(max_cpus) < 0) { | 1003 | if (smp_sanity_check(max_cpus) < 0) { |
1011 | printk(KERN_INFO "SMP disabled\n"); | 1004 | printk(KERN_INFO "SMP disabled\n"); |