public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC 7/8] Call early_param earlier.
@ 2008-12-01 12:56 Rusty Russell
  2008-12-03  3:21 ` [RFC 7/8] Call early_param earlier (take II) Rusty Russell
  2008-12-03 13:44 ` [RFC 7/8] Call early_param earlier David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: Rusty Russell @ 2008-12-01 12:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Haavard Skinnemoen, Tony Luck, Geert Uytterhoeven, Ralf Baechle,
	Paul Mackerras, Heiko Carstens, Paul Mundt, David S. Miller,
	Ingo Molnar, Tony Luck, Tony Luck, Geert Uytterhoeven,
	Ralf Baechle, Paul Mackerras, Heiko Carstens, Paul Mundt,
	David S. Miller, Ingo Molnar, Tony Luck


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.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tony Luck <tony.luck@intel.com>
---
 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(-)

diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -579,8 +579,6 @@ void __init setup_arch(void)
 		       ((cpu_hz + 500) / 1000) % 1000);
 	}
 
-	parse_early_param();
-
 	setup_bootmem();
 
 #ifdef CONFIG_VT
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -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();
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -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
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -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();
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -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);
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -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();
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -382,8 +382,6 @@ void __init setup_arch(void)
 	if (!memory_end)
 		memory_end = memory_start + __MEMORY_SIZE;
 
-	parse_early_param();
-
 	sh_mv_setup();
 
 	/*
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -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;
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -283,9 +283,6 @@ void __init arch_get_boot_command_line(v
 
 void __init setup_arch(void)
 {
-	/* Initialize PROM console. */
-	parse_early_param();
-
 	boot_flags_init(boot_command_line);
 	register_console(&prom_early_console);
 
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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);
diff --git a/include/linux/init.h b/include/linux/init.h
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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__ */
 
 /**
diff --git a/init/main.c b/init/main.c
--- a/init/main.c
+++ b/init/main.c
@@ -206,7 +206,7 @@ static int __init obsolete_checksetup(ch
 		int 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 *p
 	return 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(void
 	parse_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(void
 	build_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);



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC 7/8] Call early_param earlier (take II)
  2008-12-01 12:56 [RFC 7/8] Call early_param earlier Rusty Russell
@ 2008-12-03  3:21 ` Rusty Russell
  2008-12-03 13:44 ` [RFC 7/8] Call early_param earlier David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2008-12-03  3:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Haavard Skinnemoen, Tony Luck, Geert Uytterhoeven, Ralf Baechle,
	Paul Mackerras, Heiko Carstens, Paul Mundt, David S. Miller,
	Ingo Molnar

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.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tony Luck <tony.luck@intel.com>
---
 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(-)

diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -580,8 +580,6 @@ void __init setup_arch(void)
 		       ((cpu_hz + 500) / 1000) % 1000);
 	}
 
-	parse_early_param();
-
 	setup_bootmem();
 
 #ifdef CONFIG_VT
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -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();
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -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
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -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();
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -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);
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -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();
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -382,8 +382,6 @@ void __init setup_arch(void)
 	if (!memory_end)
 		memory_end = memory_start + __MEMORY_SIZE;
 
-	parse_early_param();
-
 	sh_mv_setup();
 
 	/*
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -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;
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -283,9 +283,6 @@ void __init arch_get_boot_command_line(v
 
 void __init setup_arch(void)
 {
-	/* Initialize PROM console. */
-	parse_early_param();
-
 	boot_flags_init(boot_command_line);
 	register_console(&prom_early_console);
 
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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);
diff --git a/include/linux/init.h b/include/linux/init.h
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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__ */
 
 /**
diff --git a/init/main.c b/init/main.c
--- a/init/main.c
+++ b/init/main.c
@@ -206,7 +206,7 @@ static int __init obsolete_checksetup(ch
 		int 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 *p
 	return 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(void
 	parse_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(void
 	build_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);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 7/8] Call early_param earlier.
  2008-12-01 12:56 [RFC 7/8] Call early_param earlier Rusty Russell
  2008-12-03  3:21 ` [RFC 7/8] Call early_param earlier (take II) Rusty Russell
@ 2008-12-03 13:44 ` David Howells
  2008-12-03 23:47   ` Rusty Russell
  1 sibling, 1 reply; 4+ messages in thread
From: David Howells @ 2008-12-03 13:44 UTC (permalink / raw)
  To: Rusty Russell
  Cc: dhowells, linux-kernel, Haavard Skinnemoen, Tony Luck,
	Geert Uytterhoeven, Ralf Baechle, Paul Mackerras, Heiko Carstens,
	Paul Mundt, David S. Miller, Ingo Molnar

Rusty Russell <rusty@rustcorp.com.au> wrote:

>  	parse_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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 7/8] Call early_param earlier.
  2008-12-03 13:44 ` [RFC 7/8] Call early_param earlier David Howells
@ 2008-12-03 23:47   ` Rusty Russell
  0 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2008-12-03 23:47 UTC (permalink / raw)
  To: David Howells; +Cc: linux-kernel

On Thursday 04 December 2008 00:14:10 David Howells wrote:
> Rusty Russell <rusty@rustcorp.com.au> wrote:
> >  	parse_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.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: David Howells <dhowells@redhat.com>
---
 init/main.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/init/main.c b/init/main.c
--- a/init/main.c
+++ b/init/main.c
@@ -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();
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-03 23:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 12:56 [RFC 7/8] Call early_param earlier Rusty Russell
2008-12-03  3:21 ` [RFC 7/8] Call early_param earlier (take II) Rusty Russell
2008-12-03 13:44 ` [RFC 7/8] Call early_param earlier David Howells
2008-12-03 23:47   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox