From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754520AbYL0NNR (ORCPT ); Sat, 27 Dec 2008 08:13:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753788AbYL0NND (ORCPT ); Sat, 27 Dec 2008 08:13:03 -0500 Received: from ozlabs.org ([203.10.76.45]:51116 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753690AbYL0NNA (ORCPT ); Sat, 27 Dec 2008 08:13:00 -0500 From: Rusty Russell To: Hugh Dickins Subject: Re: linux-next: parsing mem=700M broken Date: Sat, 27 Dec 2008 23:42:53 +1030 User-Agent: KMail/1.10.3 (Linux/2.6.27-9-generic; KDE/4.1.3; i686; ; ) Cc: Ingo Molnar , Yinghai Lu , Stephen Rothwell , Andrew Morton , linux-kernel@vger.kernel.org, Paul Mackerras , Benjamin Herrenschmidt References: <200812241808.16195.rusty@rustcorp.com.au> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Message-Id: <200812272342.54881.rusty@rustcorp.com.au> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by alpha id mBRDDLki009263 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 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 #include #include +#include #include #include @@ -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(); {.n++%ݶw{.n+{G{ayʇڙ,jfhz_(階ݢj"mG?&~iOzv^m ?I