Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1119834pxu; Thu, 8 Oct 2020 04:00:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEpCtm+Nv3gMwkpqJ4FQOR6u7QI3tFgwKQUnz/d0dBzKxAhKzGEzkoHnnHopWllgdQ0spO X-Received: by 2002:a05:6402:94f:: with SMTP id h15mr8146665edz.12.1602154856524; Thu, 08 Oct 2020 04:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602154856; cv=none; d=google.com; s=arc-20160816; b=xM5OCx/nN17MHDx+qkbkcw0OETQc1oqxtqrQTdZG2D1L9kfRO9+dfo/Tn11GWYLX4O gZMeL/RIG8caEmqN/5miuIdRKGhS/bsGQaX5xXpyRgeVHorgFCMF7BWVDYEujBNb1Y+6 gaBjLq6JG010+t0A+TIw9vtbnQk/9cuzIhk7ejd7DZM66+EavdIk5zmEYeKfajGlLS48 K/VzjKMgZ09FIWl7hrQKrEaFpe5Lq+BOxlxIMJqsE7rGW1ox1wt0cVWKzbvsSaOhBxI+ I5Eg4HW7ebMXE07IhuXlykStZ/dYUrIXBfegi9kAZmIf23WjqjIF9bVG6Ex0EPqc2XwG 48WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AzJEdvC+G7NnMzyULtk00YOH5Sxb+JafFdEJYX2lY7Y=; b=Ig5Y0MTcVy1vSSeLuXhJBXNVSyST0hMwR3F0heCJS0OzQf/orluNqvh88UqHG3J0et ICxJQEcTekqYVHbFftFfovxB0rxwGYnmpSe2RGKXOYLC68iShN/n1z+xwr8HWEIlzwou IyzKQjg1ErGvbAOLvxDXvRM+mXKTGEVWnBb4mrtj5m1hfeFcvL5D2awRZvBjsLc1TPr6 yTWp2o7o3URzVh2pzVOiw6joLirsy34qmQpaU4LEgsQkl1jl045vJRLDi8O6iT086t3+ eqWB5VNE6V5/XpGSf5nlu8T9c7tLEcxzmSVBB6ghDDymvobLaFS2ZCb0BqwVnEKtDJdo baXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=kOkwM9wA; 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=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si3414678ejh.727.2020.10.08.04.00.31; Thu, 08 Oct 2020 04:00:56 -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=@suse.com header.s=susede1 header.b=kOkwM9wA; 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=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728373AbgJHJB5 (ORCPT + 99 others); Thu, 8 Oct 2020 05:01:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:33286 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbgJHJB5 (ORCPT ); Thu, 8 Oct 2020 05:01:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1602147715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AzJEdvC+G7NnMzyULtk00YOH5Sxb+JafFdEJYX2lY7Y=; b=kOkwM9wA1Bsn8lGGr7eqceZu2K9P0znL4DhCXJ4k5Wxy5ff+HKIAc3zjQWFCpeXTh4TG4h qVRVDig54AxLJbFjSorbxWUo+YEmOEKAQ2Vcmutjo+JhI9I/Hv57U2sa9ysvoW0wSlPS8l I7iSrZbIswmBwteHdX9kOm6mqSQ1DQ8= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AAF32AF4E; Thu, 8 Oct 2020 09:01:55 +0000 (UTC) Date: Thu, 8 Oct 2020 11:01:55 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Guenter Roeck , Shreyas Joshi , rostedt@goodmis.org, shreyasjoshi15@gmail.com, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Linus Torvalds Subject: Re: [PATCH] printk: handle blank console arguments passed in. Message-ID: <20201008090155.GB16837@alley> References: <20201006095226.GB32369@alley> <24f7a6bc-c917-2bb7-0e86-9d729c18e812@roeck-us.net> <20201006134328.GD32369@alley> <20201006163514.GE32369@alley> <20201006171504.GA64770@jagdpanzerIV.localdomain> <20201007072853.GF32369@alley> <20201007123044.GA509@jagdpanzerIV.localdomain> <20201007162942.GA440@jagdpanzerIV.localdomain> <20201008055238.GA554@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201008055238.GA554@jagdpanzerIV.localdomain> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-10-08 14:52:38, Sergey Senozhatsky wrote: > On (20/10/08 01:29), Sergey Senozhatsky wrote: > > On (20/10/07 08:57), Guenter Roeck wrote: > > > On 10/7/20 5:30 AM, Sergey Senozhatsky wrote: > > > > [..] > > > > > I can see to options: Link /dev/console to /dev/null if there is no console, > > > or do something like > > > > > > if (IS_ERR(file)) { > > > pr_warn("Warning: unable to open an initial console.\n"); > > > file = filp_open("/dev/null", O_RDWR, 0); > > > if (IS_ERR(file)) > > > return; > > > } > > > > As far as I can tell, /dev/null does not exist yet on this stage > > (at least not in my system). But generally the idea looks interesting. > > Hmm. How about this. console= is undocumented and unspecified - it > may work sometimes or it may kill the system (and theoretically even > corrupt some files, depending on what fd 1 and fd 2 point to). So > maybe we can document console= and handle it in printk, rather than > somewhere deep in init/main.c > > IOW add one more flag (yeah, I know) and set it when console_setup() > sees console= boot param. The idea is allow console registration, > but all consoles should be disabled (cleared CON_ENABLED bit). This > would be easier to document, at least. > > Schematically: > > --- > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 929e86a01148..b71ff9d87693 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -281,6 +281,7 @@ static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; > > static int preferred_console = -1; > static bool has_preferred_console; > +static bool mute_consoles = false; > int console_set_on_cmdline; > EXPORT_SYMBOL(console_set_on_cmdline); > > @@ -2141,6 +2142,9 @@ static int __add_preferred_console(char *name, int idx, char *options, > struct console_cmdline *c; > int i; > > + if (mute_consoles) > + return; > + > /* > * See if this tty is not yet registered, and > * if we have a slot free. Interesting idea. Well, it looks like yet another mess: + it would show the consoles in /proc/consoles even thought they will be basically unusable + it is yet another way to affect the amount of messages on console. We already have console_loglevel, ignore_loglevel. + this effect is far from obvious when using console="" IMHO, we should try to understand why it actually crashes first. It might help to solve the problem some cleaner way. Thanks a lot for digging into it. Best Regards, Petr