Call early_param earlier.
RFC 7/8 Call early_param earlier.
We delete all the arch calls: we call it from start_kernel earlier now. We also no longer take a temporary copy, but parse in place.
Note: this probably breaks IA64. There's a comment which says machvec needs to be set before other parameter parsing. This machvec= setting should probably be moved before start_kernel, or even arch_get_boot_command_line(). Or we can drop this change.
--- arch/avr32/kernel/setup.c | 2 -- arch/ia64/kernel/setup.c | 2 -- arch/m68k/kernel/setup.c | 2 -- arch/mips/kernel/setup.c | 2 -- arch/powerpc/kernel/prom.c | 1 - arch/s390/kernel/setup.c | 2 -- arch/sh/kernel/setup.c | 2 -- arch/sparc/kernel/setup.c | 3 --- arch/sparc64/kernel/setup.c | 3 --- arch/x86/kernel/setup.c | 3 --- include/linux/init.h | 2 -- init/main.c | 21 ++++----------------- 12 files changed, 4 insertions(+), 41 deletions(-)
arch/avr32/kernel/setup.c +0 -2
@@ -579,8 +579,6 @@ void __init setup_arch(void) ((cpu_hz + 500) / 1000) % 1000); } -parse_early_param (); -setup_bootmem ();#ifdef CONFIG_VT
arch/ia64/kernel/setup.c +0 -2
@@ -554,8 +554,6 @@ void __init setup_arch(void)*/ machvec_init_from_cmdline (boot_command_line);#endif - -parse_early_param ();if (early_console_setup (boot_command_line) ==0 )mark_bsp_online ();
arch/m68k/kernel/setup.c +0 -2
@@ -268,8 +268,6 @@ void __init setup_arch(void) init_mm.end_data = (unsigned long ) &_edata; init_mm.brk = (unsigned long ) &_end; -parse_early_param (); -#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;#endif
arch/mips/kernel/setup.c +0 -2
@@ -482,8 +482,6 @@ static void __init arch_mem_init(void)pr_info ("Determined physical RAM map:\n" );print_memory_map (); -parse_early_param (); -if (usermem) {pr_info ("User-defined physical RAM map:\n" );print_memory_map ();
arch/powerpc/kernel/prom.c +0 -1
@@ -1188,7 +1188,6 @@ void __init early_init_devtree(void *par/* Save command line for /proc/cmdline and then parse parameters */ strlcpy (boot_command_line, cmd_line,COMMAND_LINE_SIZE ); -parse_early_param ();/* Reserve LMB regions used by kernel, initrd, dt, etc... */ lmb_reserve (PHYSICAL_START ,__pa (klimit) -PHYSICAL_START );
arch/s390/kernel/setup.c +0 -2
@@ -785,8 +785,6 @@ setup_arch(void)else memcpy (&uaccess, &uaccess_std,sizeof (uaccess)); -parse_early_param (); -setup_ipl ();setup_memory_end ();setup_addressing_mode ();
arch/sh/kernel/setup.c +0 -2
@@ -382,8 +382,6 @@ void __init setup_arch(void)if (!memory_end) memory_end = memory_start + __MEMORY_SIZE; -parse_early_param (); -sh_mv_setup ();/*
arch/sparc/kernel/setup.c +0 -3
@@ -214,9 +214,6 @@ void __init setup_arch(void)unsigned long highest_paddr; sparc_ttable = (struct tt_entry *) &start; - -/* Initialize PROM console. */ -parse_early_param ();/* Set sparc_cpu_model */ sparc_cpu_model = sun_unknown;
arch/sparc64/kernel/setup.c +0 -3
@@ -283,9 +283,6 @@ void __init arch_get_boot_command_line(vvoid __init setup_arch (void ) { -/* Initialize PROM console. */ -parse_early_param (); -boot_flags_init (boot_command_line);register_console (&prom_early_console);
arch/x86/kernel/setup.c +0 -3
@@ -887,8 +887,6 @@ void __init setup_arch(void) bss_resource.start =virt_to_phys (&__bss_start); bss_resource.end =virt_to_phys (&__bss_stop)-1 ; -parse_early_param (); -#ifdef CONFIG_X86_64 check_efer ();#endif
@@ -926,7 +924,6 @@ void __init setup_arch(void)probe_roms ();#endif -/* after parse_early_param, so could debug it */ insert_resource (&iomem_resource, &code_resource);insert_resource (&iomem_resource, &data_resource);insert_resource (&iomem_resource, &bss_resource);
include/linux/init.h +0 -2
@@ -245,8 +245,6 @@ struct obs_kernel_param {#define early_param (str, fn) \ __setup_param(str, fn, fn, 1) -/* Relies on boot_command_line being set */ -void __init parse_early_param (void );#endif /* __ASSEMBLY__ */ /**
init/main.c +4 -17
@@ -206,7 +206,7 @@ static int __init obsolete_checksetup(chint n =strlen (p->str);if (!strncmp (line, p->str, n)) {if (p->early) { -/* Already done in parse_early_param? +/* Already done in do_early_param? * (Needs exact match on param part). * Keep iterating, as we can have early * params and __setups of same names 8( */
@@ -518,21 +518,6 @@ static int __init do_early_param(char *preturn 0 ; } -/* Arch code calls this early on, or if not, just before other parsing. */ -void __init parse_early_param (void ) -{ -static __initdata int done =0 ; -static __initdata char tmp_cmdline[COMMAND_LINE_SIZE ]; - -if (done) -return ; - -/* All fall through to do_early_param. */ -strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE ); -parse_args ("early options" , tmp_cmdline,NULL ,0 , do_early_param, true); - done =1 ; -} -/* * Activate the first processor. */
@@ -568,6 +553,9 @@ asmlinkage void __init start_kernel(voidparse_args ("Core params" , boot_command_line, __start___core_param, __stop___core_param - __start___core_param, unknown_core_ok, true); +/* All fall through to do_early_param. */ +parse_args ("early options" , boot_command_line,NULL ,0 , do_early_param, + true);smp_setup_processor_id ();
@@ -617,7 +605,6 @@ asmlinkage void __init start_kernel(voidbuild_all_zonelists ();page_alloc_init ();printk (KERN_NOTICE "Kernel command line: %s\n" , boot_command_line); -parse_early_param ();parse_args ("Booting kernel" , static_command_line, __start___param, __stop___param - __start___param, &unknown_bootoption, false);
RFC 7/8 Call early_param earlier (take II)
We delete all the arch calls: we call it from start_kernel earlier now. We also no longer take a temporary copy, but parse in place.
Note: IA64 has a comment about machvec parsing before general commandline. I moved machvec_init_from_cmdline() into arch_get_boot_command_line(), but that hoists it above various other init functions in setup_arch(). Please check.
--- arch/avr32/kernel/setup.c | 2 -- arch/ia64/kernel/setup.c | 2 -- arch/m68k/kernel/setup.c | 2 -- arch/mips/kernel/setup.c | 2 -- arch/powerpc/kernel/prom.c | 1 - arch/s390/kernel/setup.c | 2 -- arch/sh/kernel/setup.c | 2 -- arch/sparc/kernel/setup.c | 3 --- arch/sparc64/kernel/setup.c | 3 --- arch/x86/kernel/setup.c | 3 --- include/linux/init.h | 2 -- init/main.c | 21 ++++----------------- 12 files changed, 4 insertions(+), 41 deletions(-)
arch/avr32/kernel/setup.c +0 -2
@@ -580,8 +580,6 @@ void __init setup_arch(void) ((cpu_hz + 500) / 1000) % 1000); } -parse_early_param (); -setup_bootmem ();#ifdef CONFIG_VT
arch/ia64/kernel/setup.c +9 -11
@@ -533,6 +533,15 @@ void __init arch_get_boot_command_line(v {strlcpy (boot_command_line,__va (ia64_boot_param->command_line),COMMAND_LINE_SIZE ); + +#ifdef CONFIG_IA64_GENERIC +/* machvec needs to be parsed from the command line +* before parse_early_param() is called to ensure +* that ia64_mv is initialised before any command line +* settings may cause console setup to occur +*/ +machvec_init_from_cmdline (boot_command_line); +#endif }void __init setup_arch (void )
@@ -545,17 +554,6 @@ void __init setup_arch(void)efi_init ();io_port_init (); - -#ifdef CONFIG_IA64_GENERIC -/* machvec needs to be parsed from the command line -* before parse_early_param() is called to ensure -* that ia64_mv is initialised before any command line -* settings may cause console setup to occur -*/ -machvec_init_from_cmdline (boot_command_line); -#endif - -parse_early_param ();if (early_console_setup (boot_command_line) ==0 )mark_bsp_online ();
arch/m68k/kernel/setup.c +0 -2
@@ -268,8 +268,6 @@ void __init setup_arch(void) init_mm.end_data = (unsigned long ) &_edata; init_mm.brk = (unsigned long ) &_end; -parse_early_param (); -#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;#endif
arch/mips/kernel/setup.c +0 -2
@@ -482,8 +482,6 @@ static void __init arch_mem_init(void)pr_info ("Determined physical RAM map:\n" );print_memory_map (); -parse_early_param (); -if (usermem) {pr_info ("User-defined physical RAM map:\n" );print_memory_map ();
arch/powerpc/kernel/prom.c +0 -1
@@ -1188,7 +1188,6 @@ void __init early_init_devtree(void *par/* Save command line for /proc/cmdline and then parse parameters */ strlcpy (boot_command_line, cmd_line,COMMAND_LINE_SIZE ); -parse_early_param ();/* Reserve LMB regions used by kernel, initrd, dt, etc... */ lmb_reserve (PHYSICAL_START ,__pa (klimit) -PHYSICAL_START );
arch/s390/kernel/setup.c +0 -2
@@ -785,8 +785,6 @@ setup_arch(void)else memcpy (&uaccess, &uaccess_std,sizeof (uaccess)); -parse_early_param (); -setup_ipl ();setup_memory_end ();setup_addressing_mode ();
arch/sh/kernel/setup.c +0 -2
@@ -382,8 +382,6 @@ void __init setup_arch(void)if (!memory_end) memory_end = memory_start + __MEMORY_SIZE; -parse_early_param (); -sh_mv_setup ();/*
arch/sparc/kernel/setup.c +0 -3
@@ -214,9 +214,6 @@ void __init setup_arch(void)unsigned long highest_paddr; sparc_ttable = (struct tt_entry *) &start; - -/* Initialize PROM console. */ -parse_early_param ();/* Set sparc_cpu_model */ sparc_cpu_model = sun_unknown;
arch/sparc64/kernel/setup.c +0 -3
@@ -283,9 +283,6 @@ void __init arch_get_boot_command_line(vvoid __init setup_arch (void ) { -/* Initialize PROM console. */ -parse_early_param (); -boot_flags_init (boot_command_line);register_console (&prom_early_console);
arch/x86/kernel/setup.c +0 -3
@@ -876,8 +876,6 @@ void __init setup_arch(void) bss_resource.start =virt_to_phys (&__bss_start); bss_resource.end =virt_to_phys (&__bss_stop)-1 ; -parse_early_param (); -#ifdef CONFIG_X86_64 check_efer ();#endif
@@ -915,7 +913,6 @@ void __init setup_arch(void)probe_roms ();#endif -/* after parse_early_param, so could debug it */ insert_resource (&iomem_resource, &code_resource);insert_resource (&iomem_resource, &data_resource);insert_resource (&iomem_resource, &bss_resource);
include/linux/init.h +0 -2
@@ -246,8 +246,6 @@ struct obs_kernel_param {#define early_param (str, fn) \ __setup_param(str, fn, fn, 1) -/* Relies on boot_command_line being set */ -void __init parse_early_param (void );#endif /* __ASSEMBLY__ */ /**
init/main.c +4 -17
@@ -206,7 +206,7 @@ static int __init obsolete_checksetup(chint n =strlen (p->str);if (!strncmp (line, p->str, n)) {if (p->early) { -/* Already done in parse_early_param? +/* Already done in do_early_param? * (Needs exact match on param part). * Keep iterating, as we can have early * params and __setups of same names 8( */
@@ -523,21 +523,6 @@ static int __init do_early_param(char *preturn 0 ; } -/* Arch code calls this early on, or if not, just before other parsing. */ -void __init parse_early_param (void ) -{ -static __initdata int done =0 ; -static __initdata char tmp_cmdline[COMMAND_LINE_SIZE ]; - -if (done) -return ; - -/* All fall through to do_early_param. */ -strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE ); -parse_args ("early options" , tmp_cmdline,NULL ,0 , do_early_param, true); - done =1 ; -} -/* * Activate the first processor. */
@@ -571,6 +556,9 @@ asmlinkage void __init start_kernel(voidparse_args ("Core params" , boot_command_line, __start___core_param, __stop___core_param - __start___core_param, unknown_core_ok, true); +/* All fall through to do_early_param. */ +parse_args ("early options" , boot_command_line,NULL ,0 , do_early_param, + true);smp_setup_processor_id ();
@@ -620,7 +608,6 @@ asmlinkage void __init start_kernel(voidbuild_all_zonelists ();page_alloc_init ();printk (KERN_NOTICE "Kernel command line: %s\n" , boot_command_line); -parse_early_param ();parse_args ("Booting kernel" , static_command_line, __start___param, __stop___param - __start___param, &unknown_bootoption, false);
init/main.c asmlinkage void __init start_kernel(void · line 558
Quoted 6 lines · Rusty Russell
init/main.c +3
-0parse_args ("Core params" , boot_command_line, __start___core_param, __stop___core_param - __start___core_param, unknown_core_ok, true); +/* All fall through to do_early_param. */ +parse_args ("early options" , boot_command_line,NULL ,0 , do_early_param, + true);
Why have two separate lists since they are processed contiguously?
David
Quoted 9 lines · On Thursday 04 December 2008 00:14:10 David Howells wrote:
Review
Quoted 6 lines · Rusty Russell
(quoted diff) +3
-0parse_args("Core params", boot_command_line, __start___core_param, __stop___core_param - __start___core_param, unknown_core_ok, true); + /* All fall through to do_early_param. */ + parse_args("early options", boot_command_line, NULL, 0, do_early_param, + true);Why have two separate lists since they are processed contiguously?
You're right. I don't think we care about people who have early_param of same name as core_param; they deserve horrible death anyway.
param: combine core_param and early_param parsing.
David Howells points out that we can now do early_param and core_param in a single pass of parse_args.
--- init/main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
init/main.c +3 -5
@@ -548,12 +548,10 @@ asmlinkage void __init start_kernel(void asmlinkage void __init start_kernel(void) {arch_get_boot_command_line (); -parse_args ("Core params" , boot_command_line, __start___core_param, +parse_args ("Core and early params" , boot_command_line, + __start___core_param, __stop___core_param - __start___core_param, - unknown_core_ok, true); -/* All fall through to do_early_param. */ -parse_args ("early options" , boot_command_line,NULL ,0 , do_early_param, - true); + do_early_param, true);smp_setup_processor_id ();