From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF997C433ED for ; Fri, 9 Apr 2021 10:20:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2EA4A611AB for ; Fri, 9 Apr 2021 10:20:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EA4A611AB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE94C6B006C; Fri, 9 Apr 2021 06:20:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC0496B006E; Fri, 9 Apr 2021 06:20:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 960666B0070; Fri, 9 Apr 2021 06:20:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 7ADE66B006C for ; Fri, 9 Apr 2021 06:20:57 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3601F18215EE9 for ; Fri, 9 Apr 2021 10:20:57 +0000 (UTC) X-FDA: 78012435354.28.933B77E Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf28.hostedemail.com (Postfix) with ESMTP id E4F792000263 for ; Fri, 9 Apr 2021 10:20:56 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGvKd22R6z9vBmN; Fri, 9 Apr 2021 12:20:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id U6kaT8vyPDk2; Fri, 9 Apr 2021 12:20:53 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4FGvKd0qpkz9vBmM; Fri, 9 Apr 2021 12:20:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 449288B7E3; Fri, 9 Apr 2021 12:20:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 20mYPqZcSrF8; Fri, 9 Apr 2021 12:20:54 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0866D8B7E1; Fri, 9 Apr 2021 12:20:52 +0200 (CEST) Subject: Re: [PATCH v4 18/20] x86: Convert to GENERIC_CMDLINE To: Rob Herring Cc: will@kernel.org, danielwa@cisco.com, daniel@gimpelevich.san-francisco.ca.us, arnd@kernel.org, akpm@linux-foundation.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, microblaze , linux-mips@vger.kernel.org, nios2 , openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org References: <20210408194148.GB1724284@robh.at.kernel.org> From: Christophe Leroy Message-ID: <834c4850-5541-b5c2-0b7b-d7d960ab2629@csgroup.eu> Date: Fri, 9 Apr 2021 12:20:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210408194148.GB1724284@robh.at.kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E4F792000263 X-Stat-Signature: r6w3azigyurqe76zo7qbabq5a68uj5fj Received-SPF: none (csgroup.eu>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=pegase1.c-s.fr; client-ip=93.17.236.30 X-HE-DKIM-Result: none/none X-HE-Tag: 1617963656-399310 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Le 08/04/2021 =C3=A0 21:41, Rob Herring a =C3=A9crit=C2=A0: > On Fri, Apr 02, 2021 at 03:18:20PM +0000, Christophe Leroy wrote: >> This converts the architecture to GENERIC_CMDLINE. >> >> Signed-off-by: Christophe Leroy >> --- >> arch/x86/Kconfig | 45 ++-------------------------------------= -- >> arch/x86/kernel/setup.c | 17 ++-------------- >> 2 files changed, 4 insertions(+), 58 deletions(-) >> >> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >> index a20684d56b4b..66b384228ca3 100644 >> --- a/arch/x86/Kconfig >> +++ b/arch/x86/Kconfig >> @@ -104,6 +104,7 @@ config X86 >> select ARCH_USE_QUEUED_SPINLOCKS >> select ARCH_USE_SYM_ANNOTATIONS >> select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH >> + select ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT >=20 > Seems to be non-existent kconfig option. Oops. Added in v5. >> @@ -883,18 +881,7 @@ void __init setup_arch(char **cmdline_p) >> bss_resource.start =3D __pa_symbol(__bss_start); >> bss_resource.end =3D __pa_symbol(__bss_stop)-1; >> =20 >> -#ifdef CONFIG_CMDLINE_BOOL >> -#ifdef CONFIG_CMDLINE_FORCE >> - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); >> -#else >> - if (builtin_cmdline[0]) { >> - /* append boot loader cmdline to builtin */ >> - strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); >> - strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); >> - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); >> - } >> -#endif >> -#endif >> + cmdline_build(boot_command_line, boot_command_line); >> =20 >> strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); >> *cmdline_p =3D command_line; >=20 > Once this is all done, I wonder if we can get rid of the strlcpy and > perhaps also cmdline_p. >=20 It seems rather complicated, in init/main.c you have heavy manipulations = of command lines which=20 seems to be done in setup_command_line() which seems to add stuff in fron= t of command lines, at the=20 end we end up with several command lines: /* Untouched saved command line (eg. for /proc) */ char *saved_command_line; /* Command line for parameter parsing */ static char *static_command_line; /* Untouched extra command line */ static char *extra_command_line; Some of them come from the cmdline_p which others are from boot_command_l= ine. I think a cleanup on all that stuff would be worth it as a further step.