Skip to contentSkip to conversation

x86: move find_smp_config early

PATCH New Yinghai Lu 1 participant 3 messages Nov 22, 2009 – Nov 24, 2009

Subsystems (2)
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 x86: move find_smp_config early

move find_smp_config calling before bootmem initialized. use reserve_early instead of reserve_bootmem in it.

so could only call find_smp_config one time and remove unneeded reserve parameter

---
 arch/x86/include/asm/mpspec.h   |   11 ++--------
 arch/x86/include/asm/x86_init.h |    2 -
 arch/x86/kernel/apic/numaq_32.c |    5 ----
 arch/x86/kernel/mpparse.c       |   44 ++++++++++------------------------------
 arch/x86/kernel/setup.c         |   10 ++++-----
 arch/x86/kernel/visws_quirks.c  |    2 -
 arch/x86/mm/k8topology_64.c     |   12 ----------
 7 files changed, 22 insertions(+), 64 deletions(-)
arch/x86/include/asm/mpspec.h +3 -8
Index: linux-2.6/arch/x86/include/asm/mpspec.h
===================================================================
@@ -71,12 +71,7 @@ static inline void early_get_smp_config(
 
 static inline void find_smp_config(void)
 {
-	x86_init.mpparse.find_smp_config(1);
-}
-
-static inline void early_find_smp_config(void)
-{
-	x86_init.mpparse.find_smp_config(0);
+	x86_init.mpparse.find_smp_config();
 }
 
 #ifdef CONFIG_X86_MPPARSE
@@ -89,7 +84,7 @@ extern void default_mpc_oem_bus_info(str
 # else
 #  define default_mpc_oem_bus_info NULL
 # endif
-extern void default_find_smp_config(unsigned int reserve);
+extern void default_find_smp_config(void);
 extern void default_get_smp_config(unsigned int early);
 #else
 static inline void early_reserve_e820_mpc_new(void) { }
@@ -97,7 +92,7 @@ static inline void early_reserve_e820_mp
 #define default_mpc_apic_id NULL
 #define default_smp_read_mpc_oem NULL
 #define default_mpc_oem_bus_info NULL
-#define default_find_smp_config x86_init_uint_noop
+#define default_find_smp_config x86_init_noop
 #define default_get_smp_config x86_init_uint_noop
 #endif
 
arch/x86/include/asm/x86_init.h +1 -1
Index: linux-2.6/arch/x86/include/asm/x86_init.h
===================================================================
@@ -26,7 +26,7 @@ struct x86_init_mpparse {
 	void (*smp_read_mpc_oem)(struct mpc_table *mpc);
 	void (*mpc_oem_pci_bus)(struct mpc_bus *m);
 	void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name);
-	void (*find_smp_config)(unsigned int reserve);
+	void (*find_smp_config)(void);
 	void (*get_smp_config)(unsigned int early);
 };
 
arch/x86/kernel/apic/numaq_32.c +0 -5
Index: linux-2.6/arch/x86/kernel/apic/numaq_32.c
===================================================================
@@ -264,11 +264,6 @@ static void __init smp_read_mpc_oem(stru
 static __init void early_check_numaq(void)
 {
 	/*
-	 * Find possible boot-time SMP configuration:
-	 */
-	early_find_smp_config();
-
-	/*
 	 * get boot-time SMP configuration:
 	 */
 	if (smp_found_config)
arch/x86/kernel/mpparse.c +12 -32

83 lines not on this page · raw message

arch/x86/kernel/setup.c +5 -5
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
@@ -946,6 +946,11 @@ void __init setup_arch(char **cmdline_p)
 
 	early_acpi_boot_init();
 
+	/*
+	 * Find and reserve possible boot-time SMP configuration:
+	 */
+	find_smp_config();
+
 #ifdef CONFIG_ACPI_NUMA
 	/*
 	 * Parse SRAT to discover nodes.
@@ -960,11 +965,6 @@ void __init setup_arch(char **cmdline_p)
 
 	initmem_init(0, max_pfn, acpi, k8);
 
-	/*
-	 * Find and reserve possible boot-time SMP configuration:
-	 */
-	find_smp_config();
-
 	reserve_crashkernel();
 
 #ifdef CONFIG_X86_64
arch/x86/kernel/visws_quirks.c +1 -1
Index: linux-2.6/arch/x86/kernel/visws_quirks.c
===================================================================
@@ -197,7 +197,7 @@ static void __init MP_processor_info(str
 	apic_version[m->apicid] = ver;
 }
 
-static void __init visws_find_smp_config(unsigned int reserve)
+static void __init visws_find_smp_config(void)
 {
 	struct mpc_cpu *mp = phys_to_virt(CO_CPU_TAB_PHYS);
 	unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
arch/x86/mm/k8topology_64.c +0 -12
Index: linux-2.6/arch/x86/mm/k8topology_64.c
===================================================================
@@ -57,18 +57,6 @@ static __init void early_get_boot_cpu_id
 	 * need to get boot_cpu_id so can use that to create apicid_to_node
 	 * in k8_scan_nodes()
 	 */
-	/*
-	 * Find possible boot-time SMP configuration:
-	 */
-#ifdef CONFIG_X86_MPPARSE
-	early_find_smp_config();
-#endif
-#ifdef CONFIG_ACPI
-	/*
-	 * Read APIC information from ACPI tables.
-	 */
-	early_acpi_boot_init();
-#endif
 #ifdef CONFIG_X86_MPPARSE
 	/*
 	 * get boot-time SMP configuration:
author
#1 lore raw

PATCH 1/1 x86: move find_smp_config early -v2

move find_smp_config calling before bootmem initialized. use reserve_early instead of reserve_bootmem in it.

so could only call find_smp_config one time and remove unneeded reserve parameter

-v2: make it could be applied to tip after crash_kernel early patch

---
 arch/x86/include/asm/mpspec.h   |   11 ++--------
 arch/x86/include/asm/x86_init.h |    2 -
 arch/x86/kernel/apic/numaq_32.c |    5 ----
 arch/x86/kernel/mpparse.c       |   44 ++++++++++------------------------------
 arch/x86/kernel/setup.c         |   10 ++++-----
 arch/x86/kernel/visws_quirks.c  |    2 -
 arch/x86/mm/k8topology_64.c     |   12 ----------
 7 files changed, 22 insertions(+), 64 deletions(-)
arch/x86/include/asm/mpspec.h +3 -8
Index: linux-2.6/arch/x86/include/asm/mpspec.h
===================================================================
@@ -71,12 +71,7 @@ static inline void early_get_smp_config(
 
 static inline void find_smp_config(void)
 {
-	x86_init.mpparse.find_smp_config(1);
-}
-
-static inline void early_find_smp_config(void)
-{
-	x86_init.mpparse.find_smp_config(0);
+	x86_init.mpparse.find_smp_config();
 }
 
 #ifdef CONFIG_X86_MPPARSE
@@ -89,7 +84,7 @@ extern void default_mpc_oem_bus_info(str
 # else
 #  define default_mpc_oem_bus_info NULL
 # endif
-extern void default_find_smp_config(unsigned int reserve);
+extern void default_find_smp_config(void);
 extern void default_get_smp_config(unsigned int early);
 #else
 static inline void early_reserve_e820_mpc_new(void) { }
@@ -97,7 +92,7 @@ static inline void early_reserve_e820_mp
 #define default_mpc_apic_id NULL
 #define default_smp_read_mpc_oem NULL
 #define default_mpc_oem_bus_info NULL
-#define default_find_smp_config x86_init_uint_noop
+#define default_find_smp_config x86_init_noop
 #define default_get_smp_config x86_init_uint_noop
 #endif
 
arch/x86/include/asm/x86_init.h +1 -1
Index: linux-2.6/arch/x86/include/asm/x86_init.h
===================================================================
@@ -26,7 +26,7 @@ struct x86_init_mpparse {
 	void (*smp_read_mpc_oem)(struct mpc_table *mpc);
 	void (*mpc_oem_pci_bus)(struct mpc_bus *m);
 	void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name);
-	void (*find_smp_config)(unsigned int reserve);
+	void (*find_smp_config)(void);
 	void (*get_smp_config)(unsigned int early);
 };
 
arch/x86/kernel/apic/numaq_32.c +0 -5
Index: linux-2.6/arch/x86/kernel/apic/numaq_32.c
===================================================================
@@ -264,11 +264,6 @@ static void __init smp_read_mpc_oem(stru
 static __init void early_check_numaq(void)
 {
 	/*
-	 * Find possible boot-time SMP configuration:
-	 */
-	early_find_smp_config();
-
-	/*
 	 * get boot-time SMP configuration:
 	 */
 	if (smp_found_config)
arch/x86/kernel/mpparse.c +12 -32

83 lines not on this page · raw message

arch/x86/kernel/setup.c +5 -5
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
@@ -921,6 +921,11 @@ void __init setup_arch(char **cmdline_p)
 
 	early_acpi_boot_init();
 
+	/*
+	 * Find and reserve possible boot-time SMP configuration:
+	 */
+	find_smp_config();
+
 #ifdef CONFIG_ACPI_NUMA
 	/*
 	 * Parse SRAT to discover nodes.
@@ -935,11 +940,6 @@ void __init setup_arch(char **cmdline_p)
 
 	initmem_init(0, max_pfn, acpi, k8);
 
-	/*
-	 * Find and reserve possible boot-time SMP configuration:
-	 */
-	find_smp_config();
-
 #ifdef CONFIG_X86_64
 	/*
 	 * dma32_reserve_bootmem() allocates bootmem which may conflict
arch/x86/kernel/visws_quirks.c +1 -1
Index: linux-2.6/arch/x86/kernel/visws_quirks.c
===================================================================
@@ -197,7 +197,7 @@ static void __init MP_processor_info(str
 	apic_version[m->apicid] = ver;
 }
 
-static void __init visws_find_smp_config(unsigned int reserve)
+static void __init visws_find_smp_config(void)
 {
 	struct mpc_cpu *mp = phys_to_virt(CO_CPU_TAB_PHYS);
 	unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
arch/x86/mm/k8topology_64.c +0 -12
Index: linux-2.6/arch/x86/mm/k8topology_64.c
===================================================================
@@ -57,18 +57,6 @@ static __init void early_get_boot_cpu_id
 	 * need to get boot_cpu_id so can use that to create apicid_to_node
 	 * in k8_scan_nodes()
 	 */
-	/*
-	 * Find possible boot-time SMP configuration:
-	 */
-#ifdef CONFIG_X86_MPPARSE
-	early_find_smp_config();
-#endif
-#ifdef CONFIG_ACPI
-	/*
-	 * Read APIC information from ACPI tables.
-	 */
-	early_acpi_boot_init();
-#endif
 #ifdef CONFIG_X86_MPPARSE
 	/*
 	 * get boot-time SMP configuration:
#2 lore raw

[tip:x86/mm] x86: Move find_smp_config() earlier and avoid bootmem usage

Commit-ID:  b24c2a925a9837cccf54d50aeac22ba0cbc15455
Gitweb:     http://git.kernel.org/tip/b24c2a925a9837cccf54d50aeac22ba0cbc15455
Author:     Yinghai Lu <[email protected]>
AuthorDate: Tue, 24 Nov 2009 02:48:18 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 24 Nov 2009 12:10:51 +0100

x86: Move find_smp_config() earlier and avoid bootmem usage

Move the find_smp_config() call to before bootmem is initialized. Use reserve_early() instead of reserve_bootmem() in it.

This simplifies the code, we only need to call find_smp_config() once and can remove the now unneeded reserve parameter from x86_init_mpparse::find_smp_config.

We thus also reduce x86's dependency on bootmem allocations.

LKML-Reference: <[email protected]>

---
 arch/x86/include/asm/mpspec.h   |   11 ++-------
 arch/x86/include/asm/x86_init.h |    2 +-
 arch/x86/kernel/apic/numaq_32.c |    5 ----
 arch/x86/kernel/mpparse.c       |   44 ++++++++++----------------------------
 arch/x86/kernel/setup.c         |   10 ++++----
 arch/x86/kernel/visws_quirks.c  |    2 +-
 arch/x86/mm/k8topology_64.c     |   12 ----------
 7 files changed, 22 insertions(+), 64 deletions(-)
arch/x86/include/asm/mpspec.h +3 -8
index 79c9450..644cf1a 100644
@@ -71,12 +71,7 @@ static inline void early_get_smp_config(void)
 
 static inline void find_smp_config(void)
 {
-	x86_init.mpparse.find_smp_config(1);
-}
-
-static inline void early_find_smp_config(void)
-{
-	x86_init.mpparse.find_smp_config(0);
+	x86_init.mpparse.find_smp_config();
 }
 
 #ifdef CONFIG_X86_MPPARSE
@@ -89,7 +84,7 @@ extern void default_mpc_oem_bus_info(struct mpc_bus *m, char *str);
 # else
 #  define default_mpc_oem_bus_info NULL
 # endif
-extern void default_find_smp_config(unsigned int reserve);
+extern void default_find_smp_config(void);
 extern void default_get_smp_config(unsigned int early);
 #else
 static inline void early_reserve_e820_mpc_new(void) { }
@@ -97,7 +92,7 @@ static inline void early_reserve_e820_mpc_new(void) { }
 #define default_mpc_apic_id NULL
 #define default_smp_read_mpc_oem NULL
 #define default_mpc_oem_bus_info NULL
-#define default_find_smp_config x86_init_uint_noop
+#define default_find_smp_config x86_init_noop
 #define default_get_smp_config x86_init_uint_noop
 #endif
 
arch/x86/include/asm/x86_init.h +1 -1
index 024cf3c..97e5fb4 100644
@@ -26,7 +26,7 @@ struct x86_init_mpparse {
 	void (*smp_read_mpc_oem)(struct mpc_table *mpc);
 	void (*mpc_oem_pci_bus)(struct mpc_bus *m);
 	void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name);
-	void (*find_smp_config)(unsigned int reserve);
+	void (*find_smp_config)(void);
 	void (*get_smp_config)(unsigned int early);
 };
 
arch/x86/kernel/apic/numaq_32.c +0 -5
index efa00e2..9c0629c 100644
@@ -264,11 +264,6 @@ static void __init smp_read_mpc_oem(struct mpc_table *mpc)
 static __init void early_check_numaq(void)
 {
 	/*
-	 * Find possible boot-time SMP configuration:
-	 */
-	early_find_smp_config();
-
-	/*
 	 * get boot-time SMP configuration:
 	 */
 	if (smp_found_config)
arch/x86/kernel/mpparse.c +12 -32

83 lines not on this page · raw message

arch/x86/kernel/setup.c +5 -5
index e3eae59..cdb6a8a 100644
@@ -913,6 +913,11 @@ void __init setup_arch(char **cmdline_p)
 
 	early_acpi_boot_init();
 
+	/*
+	 * Find and reserve possible boot-time SMP configuration:
+	 */
+	find_smp_config();
+
 #ifdef CONFIG_ACPI_NUMA
 	/*
 	 * Parse SRAT to discover nodes.
@@ -927,11 +932,6 @@ void __init setup_arch(char **cmdline_p)
 
 	initmem_init(0, max_pfn, acpi, k8);
 
-	/*
-	 * Find and reserve possible boot-time SMP configuration:
-	 */
-	find_smp_config();
-
 #ifdef CONFIG_X86_64
 	/*
 	 * dma32_reserve_bootmem() allocates bootmem which may conflict
arch/x86/kernel/visws_quirks.c +1 -1
index f068553..1498efa 100644
@@ -197,7 +197,7 @@ static void __init MP_processor_info(struct mpc_cpu *m)
 	apic_version[m->apicid] = ver;
 }
 
-static void __init visws_find_smp_config(unsigned int reserve)
+static void __init visws_find_smp_config(void)
 {
 	struct mpc_cpu *mp = phys_to_virt(CO_CPU_TAB_PHYS);
 	unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
arch/x86/mm/k8topology_64.c +0 -12
index b9e2dbf..970ed57 100644
@@ -57,18 +57,6 @@ static __init void early_get_boot_cpu_id(void)
 	 * need to get boot_cpu_id so can use that to create apicid_to_node
 	 * in k8_scan_nodes()
 	 */
-	/*
-	 * Find possible boot-time SMP configuration:
-	 */
-#ifdef CONFIG_X86_MPPARSE
-	early_find_smp_config();
-#endif
-#ifdef CONFIG_ACPI
-	/*
-	 * Read APIC information from ACPI tables.
-	 */
-	early_acpi_boot_init();
-#endif
 #ifdef CONFIG_X86_MPPARSE
 	/*
 	 * get boot-time SMP configuration: