Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5091155ybv; Tue, 11 Feb 2020 09:01:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxnM6HY6HELvxksKqckILLa56FsZs3jo2Wi6kJ62GQZeQWj40O2+kXRvOyh0LkgTwepGnja X-Received: by 2002:a05:6830:1bda:: with SMTP id v26mr5742195ota.314.1581440512460; Tue, 11 Feb 2020 09:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581440512; cv=none; d=google.com; s=arc-20160816; b=CRnzdU4s5oGIjZxN9TiQDa+31kltz5lBmbbpbSS96xuDdPOIHR0QS/B2E/fHhDqdaY gdbZTGphLsWX7vpcmg4rXyCrM01as0h6zZr4U8bbzMzRF4xn49gm8pgK73KWpTQRXlDq OAVO/2gcnN1JCAH1TSOKp2RheRshM0w5+vTdw/x21X9JoXTViI/hwxh9dlfh+x/EigKO /vKtlpGcELchL4zV77JkRlHL72Me5dXDLQGKU2Nsf+UPk+NoJE1y5aBQIhqD4071GwE6 ggfccBDUAnJfJc6e8JpqIYeCTYLR11Zyu9WT9GZ7lf8UlzZeVXj315rEbW16HGOx6usX xMXw== 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:date:cc:to:from:subject:message-id; bh=VqRSCtwsFfh05+3pPWcbYNsK8dcApEqH9hsKvBlwQWU=; b=0RXEIJ934GpsZ33EkEpb2XAQ662BRzU+rsmJ7cVZUjctQ50P3V//D+QCTp9u2isInl CiEF/WlA0pZ5Z20eaUyHXxormIE/eUYf6De1Ra7THDxLewgxGVc60QtGYhfBoFaKwbGv +aO2iSAz2IpGhqOhQPQPVyM0M08eOxeoC61lbERWxr25LUamr+kF1XlyjBWfXVOoqiBB hgiVpIbBeeiy54+HIRzW3r3N5fyIneJeVOWpuZ41ktBrb/9CUxiUUXkiiP8QOeNnvy50 c26dLSs7+FVLiy2gSr4aQ9ZTaJG3dFQuuZRjSjt7xnVTu68xVoEi9PMfURP/Db24cV3u AREQ== 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 v13si2116905otp.273.2020.02.11.09.01.22; Tue, 11 Feb 2020 09:01:52 -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 S1729371AbgBKPeI (ORCPT + 99 others); Tue, 11 Feb 2020 10:34:08 -0500 Received: from kernel.crashing.org ([76.164.61.194]:55458 "EHLO kernel.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728891AbgBKPeI (ORCPT ); Tue, 11 Feb 2020 10:34:08 -0500 Received: from localhost (gate.crashing.org [63.228.1.57]) (authenticated bits=0) by kernel.crashing.org (8.14.7/8.14.7) with ESMTP id 01BFXxMK017696 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 11 Feb 2020 09:34:02 -0600 Message-ID: <52b18db7c4c74fc759bf455e7e4acfb1a404951b.camel@kernel.crashing.org> Subject: Re: [PATCH v3 2/3] printk: Fix preferred console selection with multiple matches From: Benjamin Herrenschmidt To: Petr Mladek Cc: Sergey Senozhatsky , "linux-kernel@vger.kernel.org" Date: Tue, 11 Feb 2020 16:33:57 +0100 In-Reply-To: <20200211144134.fyxxphyr32dkmhsw@pathway.suse.cz> References: <97dc50d411e10ac8aab1de0376d7a535fea8c60a.camel@kernel.crashing.org> <20200211144134.fyxxphyr32dkmhsw@pathway.suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-02-11 at 15:41 +0100, Petr Mladek wrote: > > > 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. Yeah the sentence is a bit convoluted, I agree. As for the fix, see below > And I would do the same check as in the for cycle: > > if (newcon->flags & CON_ENABLED && c->user_specified == user_specified) > return 0; Fair enough, this is simpler. > 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. Of course. I'm travelling this week (which is why I somewhat rushed sending you the patches last week, hence the glitches you noted), so I won't have a chance to repost until sometime next week. > > PS: JFYI, I am going to look at the 3rd patch tomorrow. I have to go now. No worries. It's not super important, it's a minor thing I noticed while testing (when I artifically make my consoles not match to test the "default" fallback). It's not directly related to the fix in patch 2, but is completely standlaone. Cheers, Ben.