Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5075115ybv; Tue, 11 Feb 2020 08:43:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwodYccXBqXNbAlHEyoxe10p2PA2ZL/64DkYrMHrcU3w9UhEceIa5uc+/fuUOU8tADwxa9e X-Received: by 2002:a9d:6ad6:: with SMTP id m22mr6136299otq.7.1581439422276; Tue, 11 Feb 2020 08:43:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581439422; cv=none; d=google.com; s=arc-20160816; b=iDcdrl5/zF7R5XNy09n1Pij/DYA/4pS7IEPcMrbs0cffF5QkE+xWzVlhNbZkkDryFJ vM5fDOcCiXwxaPm5TQoIAjsXtNbHZxG2R+4r9489HmHt9bz2IFJCFt2+ht82vcZkjlZw XFhrmHBswO9n7P1GFuFIfKUMVc4urJZ7jHLfahSbiWx2yJlC9pkm7O+U7YK7hyTiT8F2 SRswVlYze+LPodREV125WVZQaFGCfrFhqtzsN+jvBawSHwkJUezJpSVjafl7A9Exzl4t 4l9WTc3QWO1w9Qtl/x/msIq+NNcthJADTrY3x5j7XJF8MjUWQofcJUF5nr+dZWTYVh1K TjdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CNh3vY/Vb7N1djbLmg1ghZXfx6MYA1VOpnFpcqjmuMY=; b=axK93GCjZNjWZDLUH9mn53j8R/q4dFK57JyC8paB4k37L8FV66spQVxz0qFHf90JZX IldEukYvmuyW5ceflYTaEvjGIr+ZUfdo6SDRYkOCSmhuv4sscbKdk5voZioA8m9vRG4k E6aaEMhOZcA22q8kHdt1MMaWx2CI7YuVi5ZuRXT+uNhtPMed7KdziPcaOtvRVGZfQc2M /eZRxAK8EJvd7JAKAakf08for4AHtlIQkVTBxq87vqzUUxxCADx2rD6abpc8vgsxJp9d PJLjCLZh2CTjH+vWlLpEwioIhRgDDg+Qhl4pKm39XuxlAqFFHdkRmTe3tIdxLYXiOp2d 8mdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si2120782otq.209.2020.02.11.08.43.28; Tue, 11 Feb 2020 08:43:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728989AbgBKOlh (ORCPT + 99 others); Tue, 11 Feb 2020 09:41:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:39778 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727728AbgBKOlh (ORCPT ); Tue, 11 Feb 2020 09:41:37 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CBF29C194; Tue, 11 Feb 2020 14:41:35 +0000 (UTC) Date: Tue, 11 Feb 2020 15:41:34 +0100 From: Petr Mladek To: Benjamin Herrenschmidt Cc: Sergey Senozhatsky , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/3] printk: Fix preferred console selection with multiple matches Message-ID: <20200211144134.fyxxphyr32dkmhsw@pathway.suse.cz> References: <97dc50d411e10ac8aab1de0376d7a535fea8c60a.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97dc50d411e10ac8aab1de0376d7a535fea8c60a.camel@kernel.crashing.org> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-02-06 15:02:25, Benjamin Herrenschmidt wrote: > In the following circumstances, the rule of selecting the console > corresponding to the last "console=" entry on the command line as > the preferred console (CON_CONSDEV, ie, /dev/console) fails. This > is a specific example, but it could happen with different consoles > that have a similar name aliasing mechanism. > > This tentative fix register_console() to scan first for consoles > specified on the command line, and only if none is found, to then > scan for consoles specified by the architecture. > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 17602d7b7ffc..5cf47a7b880c 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2674,8 +2679,13 @@ static int try_enable_new_console(struct console *newcon) > /* > * Some consoles, such as pstore and netconsole, can be enabled even > * without matching. > + * > + * Note: We only do this test on the !user_specified pass so that such > + * a statically enabled console that isn't user specified gets a chance > + * to have its match() or setup() function called on our second pass > + * through this function. I had some troubles to part the comment. I wonder if the following is more clear: * Accept pre-enabled consoles only when match() and setup() * was called. And I would do the same check as in the for cycle: if (newcon->flags & CON_ENABLED && c->user_specified == user_specified) return 0; With the above change: Reviewed-by: Petr Mladek I could do the change when pushing if you agree and v4 is not needed for other reasons. Best Regards, Petr PS: JFYI, I am going to look at the 3rd patch tomorrow. I have to go now.