Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp580276ybk; Wed, 20 May 2020 07:03:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDcTqO7dAvYPTPvTbb8CXapcP5dK+FH1A2UO5vqOCIgEfOEASkbVoRBs/u/0x/m53J8W5t X-Received: by 2002:a17:906:9617:: with SMTP id s23mr3730661ejx.505.1589983430344; Wed, 20 May 2020 07:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589983430; cv=none; d=google.com; s=arc-20160816; b=UGe3iszjxTZ7XP4JKPz6TmXB27lSa0c82vtuggcye38UJAQwNQrJ/AXvqo+xfUOV+k TZ/3WG+Sc4CvLi4G7C/WrqmG+//fSwKZtTn0XZo/fFlugEspkxxk7YURrkImGzlww+4H RTvqSkcs4Lw+MqMOMIhOhUadYSdXMcTgYoeEo6QfbYN8BNK16DUTJznV7Tyazop7DIt9 DSzfChVzaxsu+hU7YmmhPz680EkuX5hJUptT0BiPY5ZPpjC0rzGQiA9DH+WrwOTi97kF 3fH3U/jqmnljuccMJj4dCebi6plrXExkz2L4papkPbLaqMs9kYhBxcmOUxPJx1WHBkoL Rkfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=sh6Z0VJupMTS29FQOfrFz02kxhjyZD05AenhOPtkiIs=; b=cb5lN+1riMmOJS1/FYqsv1nd16lIjMqe2Q0PBzAr2p4kZGCSWol/Y/qvLoZLrcrAjD jsJGszrxQZuz3c9tt5gikXi8GczV2D8NjBahzPt/D+2zTZ6h82qmQ3ETdstggoSYFgRk 83PpIHdwTPJbCb2aGo5I/xxQ/W1jeoXxtfx7+Vpbo2bYsyRULdyD3282CD3nPHbgoCN2 Mi6071Oguoifsx/HkOEGLgzuhTGCivmMBzgGAMhbtk2g2WQqpv2ttnJiKcwqieKC23Dq oH5lYeBgMQgF4XS/mdwn9lk442zCVXm40fhJYAEnj7+COSl7dB/Q44wuhAfkw8M0U36d QPcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0TS6d83M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si1782023eji.549.2020.05.20.07.02.54; Wed, 20 May 2020 07:03:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0TS6d83M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbgETOBN (ORCPT + 99 others); Wed, 20 May 2020 10:01:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:47240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbgETOBN (ORCPT ); Wed, 20 May 2020 10:01:13 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A922E20756; Wed, 20 May 2020 14:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589983268; bh=BDNtqPfixaGPXHmy4aaEnNMCMcHQWxQTdhCB4L+54W4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0TS6d83MvK9M9azZbyjEjOV13UPf0ijHKPiIJl5dhRUnxxkJD+aZLx+6p1NW94vFa BGJYMMFeQTlXaTNkxnjUzBxyyjav4BaeA61XxPhcg/bL/zJFSaAabxQARtHLw8nZro waynX92icbwJ86RCSKZ7URGqpykfkLTbHDjYTYPc= Date: Wed, 20 May 2020 23:01:03 +0900 From: Masami Hiramatsu To: =?UTF-8?B?546L56iL5Yia?= Cc: "'Steven Rostedt \(VMware'" , "'Andrew Morton'" , "'Kees Cook'" , "'Thomas Gleixner'" , "'Dominik Brodowski'" , "'Arvind Sankar'" , "'Mike Rapoport'" , "'Alexander Potapenko'" , , Subject: Re: [PATCH] init/main.c: Print all command line when boot Message-Id: <20200520230103.4b34de53c7d5f62368ca30b5@kernel.org> In-Reply-To: <010201d62d8d$bf7605f0$3e6211d0$@vivo.com> References: <010201d62d8d$bf7605f0$3e6211d0$@vivo.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 May 2020 11:29:46 +0800 王程刚 wrote: > Function pr_notice print max length maybe less than the command line length, > need more times to print all. > For example, arm64 has 2048 bytes command line length, but printk maximum > length is only 1024 bytes. Good catch, and if you use bootconfig, you can expand it longer than that. > > Signed-off-by: Chenggang Wang > --- > init/main.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/init/main.c b/init/main.c > index 03371976d387..4cf676cc3305 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -825,6 +825,16 @@ void __init __weak arch_call_rest_init(void) > rest_init(); > } > > +static void __init print_cmdline(void) > +{ > + const char *prefix = "Kernel command line: "; > + int len = -strlen(prefix); > + > + len += pr_notice("%s%s\n", prefix, boot_command_line); Why don't you use saved_command_line here? Those can be different and the effective one is saved_command_line. > + while (boot_command_line[len]) > + len += pr_notice("%s\n", &boot_command_line[len]); Also, don't append "\n" unless you are sure there is an actual option separator (not a space, because the option can be quoted.) Thank you, -- Masami Hiramatsu