Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1228740pxf; Fri, 9 Apr 2021 03:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8+R9Pyh5LxMZHU5vMQByT9WIKgsPmJpQQHHAwU+rIRnnbd0Kc4O9iva0Df4tZwFnCw5yQ X-Received: by 2002:a05:6402:5211:: with SMTP id s17mr16904799edd.327.1617963781292; Fri, 09 Apr 2021 03:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617963781; cv=none; d=google.com; s=arc-20160816; b=HmzBL6P8hun/8YyiHw9Q9xHleIx13QbbeVa0KAUZDXIxbvkvx9/Wy4L0mGF5x2175a GM5srtB0leUMNebgVc3rdKTVRPpDNZshMmjHSxqlbR6ivmhbldQzREafXEw2Ugxy/OTL qUH87XzwJg/1cqu30wbqbPqWqIjsNuY6uN7JGws62wfz+/bh1pFlDDlH3ptIaGMMroj5 73yK/fUl7sLpaH3ZZAsZsCcNAI+c0XulIrKM5b/FlfJZ13PA/y9YW+fAcAGWTopBDHC3 hTNaWCNAgHjQeZk1vjay2skc187sHCLJxOb8NOv4wzCJAfsF9xDKLpMa1vY5oE/JST41 BjUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=10PV9M163+85crXmKLCHMwhA0w7gzua/Yg/4Rt4C05A=; b=HS0mSmelU6x2syLPUaFHL7XbtJR9qX4x5E/ZMlOkVRL+J4Yg1dpb8Z4KxhTu7t5yVK 4qOtIqmpb/cAcwztAuhWMp4xzQIH2E9tz97z8KfBkpPgh3b7ibSYgCoNi5RqQM4NZp5+ qzPphy2i7CUlckGH6agEEu+yCLVJlYzUpNxr5sGx/0LQ6K82Nx57e3P5td5RCvGt7Rmo mb8LXS2EvHQNPgx2iF/ncsvyOMOAn+u+XVGX5NoyT745ddsib1xCTrojRW5zIn99d9W/ NDbMVb7mwy+NBE1qw34VSh8qPOaOnfLzVJCfZqsubil39s668v8eeiYSse8cSXA+7dvO XfUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si1976784edv.470.2021.04.09.03.22.33; Fri, 09 Apr 2021 03:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233695AbhDIKVX (ORCPT + 99 others); Fri, 9 Apr 2021 06:21:23 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:29555 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbhDIKVN (ORCPT ); Fri, 9 Apr 2021 06:21:13 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 08/04/2021 à 21:41, Rob Herring a écrit : > 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 > > 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 = __pa_symbol(__bss_start); >> bss_resource.end = __pa_symbol(__bss_stop)-1; >> >> -#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); >> >> strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); >> *cmdline_p = command_line; > > Once this is all done, I wonder if we can get rid of the strlcpy and > perhaps also cmdline_p. > It seems rather complicated, in init/main.c you have heavy manipulations of command lines which seems to be done in setup_command_line() which seems to add stuff in front of command lines, at the 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_line. I think a cleanup on all that stuff would be worth it as a further step.