x86: unify "numa=" command line option handling
PATCH RESEND 1/1 x86: unify "numa=" command line option handling
In order to be able to suppress the use of SRAT tables that 32-bit Linux can't deal with (in one case known to lead to a non-bootable system, unless disabling ACPI altogether), move the "numa=" option handling to common code.
--- arch/x86/include/asm/numa_32.h | 2 ++ arch/x86/include/asm/numa_64.h | 1 + arch/x86/mm/numa.c | 22 ++++++++++++++++++++++ arch/x86/mm/numa_64.c | 24 +++++------------------- arch/x86/mm/srat_32.c | 1 - 5 files changed, 30 insertions(+), 20 deletions(-)
arch/x86/include/asm/numa_32.h +2 -0
@@ -1,6 +1,8 @@#ifndef _ASM_X86_NUMA_32_H#define _ASM_X86_NUMA_32_H +extern int numa_off; +extern int pxm_to_nid (int pxm);extern void numa_remove_cpu (int cpu);
arch/x86/include/asm/numa_64.h +1 -0
@@ -40,6 +40,7 @@ extern void __cpuinit numa_remove_cpu(in#ifdef CONFIG_NUMA_EMU #define FAKE_NODE_MIN_SIZE ((u64)32 << 20)#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) +void numa_emu_cmdline (char *);#endif /* CONFIG_NUMA_EMU */ #else static inline void init_cpu_to_node (void ) { }
arch/x86/mm/numa.c +22 -0
@@ -2,6 +2,28 @@#include <linux/topology.h> #include <linux/module.h> #include <linux/bootmem.h> +#include <asm/numa.h> +#include <asm/acpi.h> + +int __initdata numa_off; + +static __init int numa_setup (char *opt) +{ +if (!opt) +return -EINVAL ; +if (!strncmp (opt,"off" ,3 )) + numa_off =1 ; +#ifdef CONFIG_NUMA_EMU +if (!strncmp (opt,"fake=" ,5 )) +numa_emu_cmdline (opt +5 ); +#endif +#ifdef CONFIG_ACPI_NUMA +if (!strncmp (opt,"noacpi" ,6 )) + acpi_numa =-1 ; +#endif +return 0 ; +} +early_param ("numa" , numa_setup);/* * Which logical CPUs are on which nodes
arch/x86/mm/numa_64.c +5 -19
@@ -30,7 +30,6 @@ s16 apicid_to_node[MAX_LOCAL_APIC] __cpu [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE }; -int numa_off__initdata ;static unsigned long __initdata nodemap_addr;static unsigned long __initdata nodemap_size;
@@ -263,6 +262,11 @@ static struct bootnode nodes[MAX_NUMNODEstatic struct bootnode physnodes[MAX_NUMNODES ]__cpuinitdata ;static char *cmdline__initdata ; +void __init numa_emu_cmdline (char *str) +{ + cmdline = str; +} +static int __init setup_physnodes (unsigned long start,unsigned long end,int acpi,int amd) {
@@ -670,24 +674,6 @@ unsigned long __init numa_free_all_bootmreturn pages; } -static __init int numa_setup (char *opt) -{ -if (!opt) -return -EINVAL ; -if (!strncmp (opt,"off" ,3 )) - numa_off =1 ; -#ifdef CONFIG_NUMA_EMU -if (!strncmp (opt,"fake=" ,5 )) - cmdline = opt +5 ; -#endif -#ifdef CONFIG_ACPI_NUMA -if (!strncmp (opt,"noacpi" ,6 )) - acpi_numa =-1 ; -#endif -return 0 ; -} -early_param ("numa" , numa_setup); -#ifdef CONFIG_NUMA static __init int find_near_online_node (int node)
arch/x86/mm/srat_32.c +0 -1
@@ -59,7 +59,6 @@ static struct node_memory_chunk_s __initstatic int __initdata num_memory_chunks;/* total number of memory chunks */ static u8 __initdata apicid_to_pxm[MAX_APICID ]; -int numa_off__initdata ;int acpi_numa__initdata ;static __init void bad_srat (void )
Quoted 4 lines · Jan Beulich
In order to be able to suppress the use of SRAT tables that 32-bit Linux can't deal with (in one case known to lead to a non-bootable system, unless disabling ACPI altogether), move the "numa=" option handling to common code.
As this does not only unify the numa_32/64.c code a bit, but is also needed for being able to boot a machine, it looks like a candidate for 2.6.38-rcX.
Thomas
[tip:x86/urgent] x86: Unify "numa=" command line option handling
In reply to Jan BeulichCommit-ID: 9032160275ba018003ff390835ff8ed2b5b788b8 Gitweb: http://git.kernel.org/tip/9032160275ba018003ff390835ff8ed2b5b788b8 Author: Jan Beulich <[email protected]> AuthorDate: Wed, 19 Jan 2011 08:57:21 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 19 Jan 2011 10:25:18 +0100
x86: Unify "numa=" command line option handling
In order to be able to suppress the use of SRAT tables that 32-bit Linux can't deal with (in one case known to lead to a non-bootable system, unless disabling ACPI altogether), move the "numa=" option handling to common code.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/numa_32.h | 2 ++ arch/x86/include/asm/numa_64.h | 1 + arch/x86/mm/numa.c | 22 ++++++++++++++++++++++ arch/x86/mm/numa_64.c | 24 +++++------------------- arch/x86/mm/srat_32.c | 1 - 5 files changed, 30 insertions(+), 20 deletions(-)
arch/x86/include/asm/numa_32.h +2 -0
@@ -1,6 +1,8 @@#ifndef _ASM_X86_NUMA_32_H#define _ASM_X86_NUMA_32_H +extern int numa_off; +extern int pxm_to_nid (int pxm);extern void numa_remove_cpu (int cpu);
arch/x86/include/asm/numa_64.h +1 -0
@@ -40,6 +40,7 @@ extern void __cpuinit numa_remove_cpu(int cpu);#ifdef CONFIG_NUMA_EMU #define FAKE_NODE_MIN_SIZE ((u64)32 << 20)#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) +void numa_emu_cmdline (char *);#endif /* CONFIG_NUMA_EMU */ #else static inline void init_cpu_to_node (void ) { }
arch/x86/mm/numa.c +22 -0
@@ -2,6 +2,28 @@#include <linux/topology.h> #include <linux/module.h> #include <linux/bootmem.h> +#include <asm/numa.h> +#include <asm/acpi.h> + +int __initdata numa_off; + +static __init int numa_setup (char *opt) +{ +if (!opt) +return -EINVAL ; +if (!strncmp (opt,"off" ,3 )) + numa_off =1 ; +#ifdef CONFIG_NUMA_EMU +if (!strncmp (opt,"fake=" ,5 )) +numa_emu_cmdline (opt +5 ); +#endif +#ifdef CONFIG_ACPI_NUMA +if (!strncmp (opt,"noacpi" ,6 )) + acpi_numa =-1 ; +#endif +return 0 ; +} +early_param ("numa" , numa_setup);/* * Which logical CPUs are on which nodes
arch/x86/mm/numa_64.c +5 -19
@@ -30,7 +30,6 @@ s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE }; -int numa_off__initdata ;static unsigned long __initdata nodemap_addr;static unsigned long __initdata nodemap_size;
@@ -263,6 +262,11 @@ static struct bootnode nodes[MAX_NUMNODES] __initdata;static struct bootnode physnodes[MAX_NUMNODES ]__cpuinitdata ;static char *cmdline__initdata ; +void __init numa_emu_cmdline (char *str) +{ + cmdline = str; +} +static int __init setup_physnodes (unsigned long start,unsigned long end,int acpi,int amd) {
@@ -670,24 +674,6 @@ unsigned long __init numa_free_all_bootmem(void)return pages; } -static __init int numa_setup (char *opt) -{ -if (!opt) -return -EINVAL ; -if (!strncmp (opt,"off" ,3 )) - numa_off =1 ; -#ifdef CONFIG_NUMA_EMU -if (!strncmp (opt,"fake=" ,5 )) - cmdline = opt +5 ; -#endif -#ifdef CONFIG_ACPI_NUMA -if (!strncmp (opt,"noacpi" ,6 )) - acpi_numa =-1 ; -#endif -return 0 ; -} -early_param ("numa" , numa_setup); -#ifdef CONFIG_NUMA static __init int find_near_online_node (int node)
arch/x86/mm/srat_32.c +0 -1
@@ -59,7 +59,6 @@ static struct node_memory_chunk_s __initdata node_memory_chunk[MAXCHUNKS];static int __initdata num_memory_chunks;/* total number of memory chunks */ static u8 __initdata apicid_to_pxm[MAX_APICID ]; -int numa_off__initdata ;int acpi_numa__initdata ;static __init void bad_srat (void )