Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3205590pxb; Mon, 16 Nov 2020 08:23:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBzUePxzoYR3LYDufjQ9BhR0tt/4yWdhRkzXIT3A6EuGtRK7QEqyJZZ5ZBtQSar1WJW9JR X-Received: by 2002:a17:906:7f95:: with SMTP id f21mr14836569ejr.340.1605543814539; Mon, 16 Nov 2020 08:23:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605543814; cv=none; d=google.com; s=arc-20160816; b=Wcg9W+sVO3+5ZVHYMUECu7NvfVCwCa6rZopfvg6qad/bp0UmY1gpRwAqfqP5K2PkaV lRKSuioFlcbT2foD+8g1p0ToSl6ncsx1QIEUWEitDh95J0fBvPFg7a3eMM22TWxegCPo hF6Vjit6NhxLx+YNURE5y/SW53HJP3zciAI8BEHSFTc8UxXipzfdsczjwQFeL+K20dMx OB08BcSSD6MDikKJSGSdQQ7lHLKJmvz5uOLVolED2xudQsRKJ6liT7bivaVivVdKSv6s GddZMa9ShcGbpVvsiHEPiDDQ2MQt5/p3T61h8XqmPTyDvSnfIuhMulYFqEznEv25Ty+a /JTg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=40yfWRXLa2zy92JsDyv1W7tlg+pQ9YiYvZ8oyXD5WJQ=; b=m2F23xcAwMuU5GWzc19eoDK/XMKG5VJeT2WWManr5BnNXiYTLkEkTS9BD8Q5VmAkoj gvILzrzqAn5lDVi/VvUfMCwt6up6ln1uiLUYc5+cAqQGa/pjbYozuWV8hBOMzPdZ7KUe ILOdJxE4q75iwvpBs9ZkQJCOd17OZsQBnGBlHuULGJrPQNdUdv2Bx/zy/gFJSi9WN7jP WXKJrox6q95oyzjigMmhdeuRTogayZvx0KzwEwV1Du/DKkVNjZKw8tBCIj8P7UR6PKJE mNU+M6wvX6WIEPLV3Z2FElJxAL4m6V/sUfmzqE5PCmbklmbbgtjRIBJO00zhHTtyeElC eQvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=IF8aUeqz; 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=QUARANTINE 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 us5si12137880ejb.394.2020.11.16.08.23.11; Mon, 16 Nov 2020 08:23:34 -0800 (PST) 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=IF8aUeqz; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731926AbgKPQUI (ORCPT + 99 others); Mon, 16 Nov 2020 11:20:08 -0500 Received: from mx2.suse.de ([195.135.220.15]:37536 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbgKPQUG (ORCPT ); Mon, 16 Nov 2020 11:20:06 -0500 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=1605543605; h=from:from:reply-to: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=40yfWRXLa2zy92JsDyv1W7tlg+pQ9YiYvZ8oyXD5WJQ=; b=IF8aUeqzC/spfwShNBfSbgfpA2ME9vUYagO4xCADHc6oyRnCEqlI//sueZTTJLEbIDXICs jPXN+iWoyYElVKjRoLRT1VW27AT9/NaoHZeAHbYug8/ybYkHLzioMzW3BJGgzxaq+qFuxr xI+zHtWn6jZ4AygO3Uh/ElbboM54wxw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7C244ABD6; Mon, 16 Nov 2020 16:20:05 +0000 (UTC) Date: Mon, 16 Nov 2020 17:20:04 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Steven Rostedt , John Ogness , Linus Torvalds , Guenter Roeck , Shreyas Joshi , shreyasjoshi15@gmail.com, Greg Kroah-Hartman , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] init/console: Use ttynull as a fallback when there is no console Message-ID: <20201116162004.GP1602@alley> References: <20201111135450.11214-1-pmladek@suse.com> <20201111135450.11214-2-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-11-12 10:45:46, Sergey Senozhatsky wrote: > On (20/11/12 09:17), Sergey Senozhatsky wrote: > > On (20/11/11 14:54), Petr Mladek wrote: > > [..] > > > diff --git a/init/main.c b/init/main.c > > > index 130376ec10ba..24413c055a85 100644 > > > --- a/init/main.c > > > +++ b/init/main.c > > > @@ -1470,8 +1470,14 @@ void __init console_on_rootfs(void) > > > struct file *file = filp_open("/dev/console", O_RDWR, 0); > > > > > > if (IS_ERR(file)) { > > > - pr_err("Warning: unable to open an initial console.\n"); > > > - return; > > > + pr_err("Warning: unable to open an initial console. Fallback to ttynull.\n"); > > > + register_ttynull_console(); > > > + > > > > A nit, this probably can be done in console_device() function. > > > > For several reasons: > > > > - we will get covered all the future cases when something other than > > console_on_rootfs() will filp_open("/dev/console") Good point! My concern is that console_device might be called in "unclear" context. For example, it is called under tty_mutex in: + tty_open_by_driver() + tty_lookup_driver() + console_device() Also console_on_rootf() is likely the first code that would actually use the device. Well, there is spk_ttyio_initialise_ldisc() that calls tty_kopen(). I am a bit lazy to investigate whether it is called sooner or later. Anyway, it is accessibility code, so that there should be configured an accessibility console anyway. > And the existing ones (including user-space). For instance, > kernel/bpf/preload/iterators/iterators.c probably fails (?) > on systems with console= > > debug_fd = open("/dev/console", O_WRONLY | O_NOCTTY | O_CLOEXEC); > if (debug_fd < 0) > return 1; > > -ss This looks like an userspace tool, so it should get called after console_on_rootfs(). It might be my laziness. But I would prefer to go with this patchset. We could always improve it when anyone meet the problem. Best Regards, Petr