Re: linux-next: parsing mem=700M broken

Rusty Russell
2008-12-27T13:13:17Z

On Thursday 25 December 2008 01:14:35 Hugh Dickins wrote:> But (of course: it's a patch to arch/x86) doesn't help at all on> ppc64; and I presume other architectures also remain broken...
Confirmed ppc64. But it's broken in a *different* way.
Whereas most archs called parse_early_param from setup_arch, powerpcdoes it before start_kernel. So instead of moving parsing earlier,my patch actually moved it later for powerpc.
Too late, for mem=.
Rather than try to untangle the powerpc boot process (most archs woulddo most of this in setup_arch), I think I have to expose the parseragain so they can call it:
commit 25bf48b74b9fb23b347d00656b604f9e55c72183Author: Rusty Russell <rusty@rustcorp.com.au>Date: Sat Dec 27 23:40:37 2008 +1030
Fix powerpc (tested on ppc64) command line handling. Powerpc used to call parse_early_param() really early; the change made it too late. Put it back.
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.cindex d36cbd0..e5f2387 100644--- a/arch/powerpc/kernel/prom.c+++ b/arch/powerpc/kernel/prom.c@@ -32,6 +32,7 @@ #include <linux/debugfs.h> #include <linux/irq.h> #include <linux/lmb.h>+#include <linux/start_kernel.h> #include <asm/prom.h> #include <asm/rtas.h>@@ -1188,6 +1189,7 @@ void __init early_init_devtree(void *params) /* Save command line for /proc/cmdline and then parse parameters */ strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);+ parse_early_and_core_params(boot_command_line); /* Reserve LMB regions used by kernel, initrd, dt, etc... */ lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.cindex a237371..52ca63a 100644--- a/arch/powerpc/kernel/setup_32.c+++ b/arch/powerpc/kernel/setup_32.c@@ -264,12 +264,6 @@ static void __init exc_lvl_early_init(void) #define exc_lvl_early_init() #endif -void arch_get_boot_command_line(void)-{- /* FIXME: Get rid of cmd_line in favor of boot_command_line? */- strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);-}- /* Warning, IO base is not yet inited */ void __init setup_arch(void) {diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.cindex 7d25b42..348bc8a 100644--- a/arch/powerpc/kernel/setup_64.c+++ b/arch/powerpc/kernel/setup_64.c@@ -502,12 +502,6 @@ static void __init emergency_stack_init(void) } } -void arch_get_boot_command_line(void)-{- /* FIXME: Get rid of cmd_line in favor of boot_command_line? */- strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);-}- /* * Called into from start_kernel, after lock_kernel has been called. * Initializes bootmem, which is unsed to manage page allocation untildiff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.hindex d3e5f27..347cc95 100644--- a/include/linux/start_kernel.h+++ b/include/linux/start_kernel.h@@ -9,4 +9,7 @@ extern asmlinkage void __init start_kernel(void); +/* Usually called by start_kernel, but some nasty archs need it earlier. */+void __init parse_early_and_core_params(char *cmdline);+ #endif /* _LINUX_START_KERNEL_H */diff --git a/init/main.c b/init/main.cindex fb00387..ad933ad 100644--- a/init/main.c+++ b/init/main.c@@ -522,6 +522,21 @@ void __init __weak thread_info_cache_init(void) { } +/* Non-destructive early parse of commandline. PowerPC calls this early. */+void __init parse_early_and_core_params(char *cmdline)+{+ static bool __initdata done = false;++ if (done)+ return;++ parse_args("Core and early params", cmdline,+ __start___core_param,+ __stop___core_param - __start___core_param,+ do_early_param, true);+ done = true;+}+ asmlinkage void __init start_kernel(void) { char *static_command_line;@@ -530,10 +545,7 @@ asmlinkage void __init start_kernel(void) printk(linux_banner); arch_get_boot_command_line();- parse_args("Core and early params", boot_command_line,- __start___core_param,- __stop___core_param - __start___core_param,- do_early_param, true);+ parse_early_and_core_params(boot_command_line); smp_setup_processor_id(); \0ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥