Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2703039rwp; Fri, 14 Jul 2023 10:00:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlF2GGdf3hkk+oNLfsxG5k8d0BNYVxOtpp8rDjZgFy+A+F5TQ7BaSDR1i+gjOc/uaUgMenEd X-Received: by 2002:a05:6512:1595:b0:4f9:56aa:26c2 with SMTP id bp21-20020a056512159500b004f956aa26c2mr4276534lfb.57.1689354016533; Fri, 14 Jul 2023 10:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689354016; cv=none; d=google.com; s=arc-20160816; b=HGR6/Il2LmuhfTf4Qh7yMCEeJayFwQ6AqhF35mg7eWya8f6Qn2VSjBTxkMcTYk76A0 Vog7nuYd238fYMAC0uXbIjiwXED1iyjiSmq9Mrey0C/IGBdv0ikJF/hd3GtZmRjRgkIX JMKJVe+BnV0DZp9w2w1yZ/F9i2n9xBcD3L3c1pdQtNPSC6RqJYQRwkDeO3R7wVdaswch peCf4q6KYoEAun/vvWULioZHM/HdUxQ8ooO2cREJS49mY+qWh3yH/Vj7nJ4YqyPY3Yn1 6Phlls2mMsZr9ooWvn3sqH/vrJquH17zEgG3vFiltvBls22R5HTHyHq2JLJQxZagFs+y qOtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2WFfkLeMA7JU5LDVotJAeiQUyypNJsj7GRSVRQRb4/o=; fh=/ryTAl/E1uI2B8k/ttDQD+aaBO5JnOCMFR2cuCuU+3U=; b=gOhoTHFCOBwGYp4lH1cq8qUpjYaoQFXF7EEFum40zmSkdF00RwiKLUsroLQyQcZik0 8Aa/c4efezt8Mpl8OqYy5T5sTCULTZqip5JY7KpTaEuQW9gexfYKPbw3snZXQBu6b4mB rLib6xR2TVXkTNh9lG04V13LFmB/3wR34v1wdHru8bsmlYvkiOQvi8GuIGQRvuwmtQru PRFRMKo7RjoS5hh9IG8rkAQHPAv4j8q/cRJTRxRHmI8Www8JMeJqjhcAuS6FU3X4hKmP qPaJ767P8G/IaGg2cH/ooyGlh/sUaP1GZtg8IRWMgIdeWqwRlgz+oHTH1fejxuhQsK1z CbZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=efa8ZjY5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020aa7d5d6000000b005214c004891si1490368eds.577.2023.07.14.09.59.52; Fri, 14 Jul 2023 10:00:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=efa8ZjY5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235332AbjGNQi2 (ORCPT + 99 others); Fri, 14 Jul 2023 12:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235470AbjGNQi0 (ORCPT ); Fri, 14 Jul 2023 12:38:26 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFABB30EA for ; Fri, 14 Jul 2023 09:38:23 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 86D401F747; Fri, 14 Jul 2023 16:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1689352702; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2WFfkLeMA7JU5LDVotJAeiQUyypNJsj7GRSVRQRb4/o=; b=efa8ZjY51WJsgYDxce5yB34dgbZxZ+TH6YmjThTNpBddOW8P8FSg9zhbKjMPFsHt0DS3p1 FtMUKc/D7RqbdaYR1LYxbctcrILrWngNpuOzDxyElJLxWGV20Y2pKQDbixLFUpPV1LqX8A 2jNq9clCfMRSgoYkkCX5bnsU7Pm88mg= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9D24C2C142; Fri, 14 Jul 2023 16:38:21 +0000 (UTC) Date: Fri, 14 Jul 2023 18:38:21 +0200 From: Petr Mladek To: Raul Rangel Cc: Randy Dunlap , Mario Limonciello , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , kramasub@chromium.org, Alexander Potapenko , Andrew Morton , Ard Biesheuvel , "Jason A. Donenfeld" , Li Zhe , "Liam R. Howlett" , Mark Rutland , Will Deacon , Wolfram Sang , Zhou jie Subject: Re: [PATCH] init: Don't proxy console= to earlycon Message-ID: References: <20230707191721.1.Id08823b2f848237ae90ce5c5fa7e027e97c33ad3@changeid> <6101a3bb-30eb-97fc-3a8e-6d15afc4efb5@amd.com> <3de1ff24-3970-6e22-a73c-70446b8de4bd@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2023-07-10 09:30:19, Raul Rangel wrote: > On Sun, Jul 9, 2023 at 8:43 PM Randy Dunlap wrote: > > > > > > > > On 7/9/23 18:15, Mario Limonciello wrote: > > > On 7/9/23 18:46, Randy Dunlap wrote: > > >> > > >> > > >> On 7/7/23 18:17, Raul E Rangel wrote: > > >>> Right now we are proxying the `console=XXX` command line args to the > > >>> param_setup_earlycon. This is done because the following are > > >>> equivalent: > > >>> > > >>> console=uart[8250],mmio,[,options] > > >>> earlycon=uart[8250],mmio,[,options] > > >>> > > >>> In addition, when `earlycon=` or just `earlycon` is specified on the > > >>> command line, we look at the SPCR table or the DT to extract the device > > >>> options. > > >>> > > >>> When `console=` is specified on the command line, it's intention is to > > >>> disable the console. Right now since we are proxying the `console=` > > >> > > >> How do you figure this (its intention is to disable the console)? > > > > > https://www.kernel.org/doc/html/v6.1/admin-guide/kernel-parameters.html > says the following: > console= > { null | "" } > Use to disable console output, i.e., to have kernel > console messages discarded. > This must be the only console= parameter used on the > kernel command line. > > earlycon= [KNL] Output early console device and options. > > When used with no options, the early console is > determined by stdout-path property in device tree's > chosen node or the ACPI SPCR table if supported by > the platform. Sigh, I wasn't aware of this when we discussed the console= handling. > The reason this bug showed up is that ChromeOS has set `console=` for a > very long time: > https://chromium.googlesource.com/chromiumos/platform/crosutils/+/main/build_kernel_image.sh#282 > I'm not sure on the exact history, but AFAIK, we don't have the ttyX devices. > > Coreboot recently added support for the ACPI SPCR table which in > combination with the > `console=` arg, we are now seeing earlycon enabled when it shouldn't be. But this happens only when both "earlycon" and "console=" parameters are used together. Do I get it correctly? This combination is ambiguous on its own. Why would anyone add "earlycon" parameter and wanted to keep it disabled? > > >>> diff --git a/init/main.c b/init/main.c > > >>> index aa21add5f7c54..f72bf644910c1 100644 > > >>> --- a/init/main.c > > >>> +++ b/init/main.c > > >>> @@ -738,8 +738,7 @@ static int __init do_early_param(char *param, char *val, > > >>> for (p = __setup_start; p < __setup_end; p++) { > > >>> if ((p->early && parameq(param, p->str)) || > > >>> (strcmp(param, "console") == 0 && > > >>> - strcmp(p->str, "earlycon") == 0) > > >>> - ) { > > >>> + strcmp(p->str, "earlycon") == 0 && val && val[0])) { > > >>> if (p->setup_func(val) != 0) > > >>> pr_warn("Malformed early option '%s'\n", param); > > >>> } Huh, this is getting more and more complicated. You know, it is already bad that: + "console" enables the default console which might be overridden by ACPI SPCR and devicetree + "console=" causes that "ttynull" console is preferred, it might cause that no console is registered at all + both "earlyconsole" and "earlyconsole=" cause that consoles is enabled It is already bad that "earlycon" and "console" handle the empty value a different way. But this makes it even worse. The behaviour would depend on a subtle difference whether "console" or "console=" is used. > > >> > > > > > > > -- > > ~Randy