[PATCH] x86: move prefill_possible_map calling early

Previous thread: [PATCH] SD card fix by Marek Vasut on Wednesday, July 2, 2008 - 6:44 pm. (1 message)

Next thread: [git pull] PCI fixes for 2.6.26 by Jesse Barnes on Wednesday, July 2, 2008 - 7:20 pm. (1 message)
From: Yinghai Lu
Date: Wednesday, July 2, 2008 - 6:54 pm

call it right after we done with MADT/mptable handling, instead of doing that
in setup_per_cpu_areas later...
so for_possible_cpu could be used early.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/setup.c        |    1 +
 arch/x86/kernel/setup_percpu.c |   10 ----------
 arch/x86/kernel/smpboot.c      |    8 ++++++++
 include/asm-x86/smp.h          |    4 ++++
 4 files changed, 13 insertions(+), 10 deletions(-)

Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -788,6 +788,7 @@ void __init setup_arch(char **cmdline_p)
 		get_smp_config();
 #endif
 
+	prefill_possible_map();
 #ifdef CONFIG_X86_64
 	init_cpu_to_node();
 #endif
Index: linux-2.6/arch/x86/kernel/setup_percpu.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_percpu.c
+++ linux-2.6/arch/x86/kernel/setup_percpu.c
@@ -162,16 +162,6 @@ void __init setup_per_cpu_areas(void)
 	char *ptr;
 	int cpu;
 
-	/* no processor from mptable or madt */
-	if (!num_processors)
-		num_processors = 1;
-
-#ifdef CONFIG_HOTPLUG_CPU
-	prefill_possible_map();
-#else
-	nr_cpu_ids = num_processors;
-#endif
-
 	/* Setup cpu_pda map */
 	setup_cpu_pda_map();
 
Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot.c
+++ linux-2.6/arch/x86/kernel/smpboot.c
@@ -1278,12 +1278,20 @@ __init void prefill_possible_map(void)
 	int i;
 	int possible;
 
+	/* no processor from mptable or madt */
+	if (!num_processors)
+		num_processors = 1;
+
+#ifdef CONFIG_HOTPLUG_CPU
 	if (additional_cpus == -1) {
 		if (disabled_cpus > 0)
 			additional_cpus = disabled_cpus;
 		else
 			additional_cpus = 0;
 	}
+#else
+	additional_cpus = 0;
+#endif
 	possible = num_processors + additional_cpus;
 	if ...
From: Ingo Molnar
Date: Thursday, July 3, 2008 - 6:54 am

applied to tip/x86/unify-setup - thanks Yinghai,

	Ingo
--

From: Ingo Molnar
Date: Thursday, July 3, 2008 - 7:03 am

FYI, this one needed the small fixlet below. (prefill_possible_map() is 
dependent on both CONFIG_SMP and CONFIG_HOTPLUG_CPU - not just 
CONFIG_SMP)

	Ingo

-------------->
commit bb42b7bdee9decad536c1e747e2ce2f3daebb76f
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 3 15:57:47 2008 +0200

    x86: move prefill_possible_map calling early, fix
    
    fix:
    
    arch/x86/kernel/built-in.o: In function `setup_arch':
    : undefined reference to `prefill_possible_map'
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
index bf6b5ee..c2784b3 100644
--- a/include/asm-x86/smp.h
+++ b/include/asm-x86/smp.h
@@ -114,8 +114,6 @@ void native_send_call_func_single_ipi(int cpu);
 extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
 
-extern void prefill_possible_map(void);
-
 void smp_store_cpu_info(int id);
 #define cpu_physical_id(cpu)	per_cpu(x86_cpu_to_apicid, cpu)
 
@@ -124,11 +122,15 @@ static inline int num_booting_cpus(void)
 {
 	return cpus_weight(cpu_callout_map);
 }
+#endif /* CONFIG_SMP */
+
+#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_CPU)
+extern void prefill_possible_map(void);
 #else
 static inline void prefill_possible_map(void)
 {
 }
-#endif /* CONFIG_SMP */
+#endif
 
 extern unsigned disabled_cpus __cpuinitdata;
 
--

Previous thread: [PATCH] SD card fix by Marek Vasut on Wednesday, July 2, 2008 - 6:44 pm. (1 message)

Next thread: [git pull] PCI fixes for 2.6.26 by Jesse Barnes on Wednesday, July 2, 2008 - 7:20 pm. (1 message)