Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp78559ybl; Tue, 10 Dec 2019 18:02:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwwkDX9zEjG4qUv6xAhlzPL0Sv+KRPGUWAeyl/GHavebZoPB+5yVrPl9R9F/gswWHoEJbY+ X-Received: by 2002:aca:4e87:: with SMTP id c129mr841701oib.153.1576029761544; Tue, 10 Dec 2019 18:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576029761; cv=none; d=google.com; s=arc-20160816; b=ZNvdlt0f8Tm0BeAlReRX/fPmRtcLe4vqx5Kp0mHSG+Uy4bojYldbnJm69G5LBODPmJ 5Iy5LZraVuYWPfCe0gcLfXqV/4al4pF3AgnB9zHb8SgxcM+K8MmixQoA22Zp+2ccWC3F cvj/080uAdFxfoi4pHYsniMWiU9KQzDVG4lCAXkecUuZmWoI5sJ3qw/M+hJ6v8EsrFDc HVQ+Qd6BnkTngH+YCkj0I409O3vZL4t5AXqlwl3VE/CFn89Znh7VMJG1RQeOK52YWZEf 6AsQ0/D/ZV1R+AIXPksB2MtAHVYm0SPByeeiPiEWneEeSiDosu3o4Kcz5dcjlNUGz2Bw zaqA== 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:dkim-signature; bh=z1y/LTXMqZQ7+fbUeIxen+lHLUxUeQ6tnCSwfKzyG/M=; b=pq0v+GuoDs2xwmWKXSBEWSJGVYAeQ7waunTPvLFu8kKpoN+/I3VAZWJ0s4YyI3GGip K5kpfEfpgxSy3PKSfk3TQoknaQIAwTWAfp5lUqUEtxrJC90x2wnM3PkcTdzP63Ipt8SB ee/kS2gVtzP4KFvc5cSHkFMG06A2SOgBaF5jlNSukBBF50KnwME6QpLm4HrKYb87vSql FumrTQFAIvYqeQ2cuzciSCMR6+V1Xu7kuwKbCFdctOfG/6a22jyeNPs6XRLETOHX70g0 OWzWx2fmbDFdFbGo2Noj4hzsc9+7M0xRVyCb0lp0VqeXMAtgM27ZYSYTtGD4Eb7Vs3uI 2cqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qlUENcu0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13si160223oth.175.2019.12.10.18.02.29; Tue, 10 Dec 2019 18:02:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qlUENcu0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbfLKCBw (ORCPT + 99 others); Tue, 10 Dec 2019 21:01:52 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35373 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbfLKCBw (ORCPT ); Tue, 10 Dec 2019 21:01:52 -0500 Received: by mail-pl1-f196.google.com with SMTP id s10so752754plp.2 for ; Tue, 10 Dec 2019 18:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=z1y/LTXMqZQ7+fbUeIxen+lHLUxUeQ6tnCSwfKzyG/M=; b=qlUENcu0E0Q9DLS7cfJlDkXjHaDctO9pXEp/m8Ll6UVPyzHzjS8G6sHF4FhvrNiqQ8 eLseGys7dWSaxlj/2YZOROOTrx6XX0dcOV8XoEcRtEB47TvgzZoaxUjLtOLRw/sHnkzK BlsiQA8MfBEgQ/dlOQTIHtWvw3NjxFK1j6HAYYpFDlqaaC9udPapLmcfR/I3abK+XUEb iEeOeAS25uN9TVQ1aDzOYY26VPRUi640Rp9eNzVupyMPYKHYWCo5JvuiK64gVCycyGuM 3NVzT1FSO69jgn4wl45z9ikbIdmpaulQ6XXfuHC5MzaGNjALunj15nlxGJlb7vdtsIvg 48/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=z1y/LTXMqZQ7+fbUeIxen+lHLUxUeQ6tnCSwfKzyG/M=; b=lg0Sil/KvdzZyJuAM774e1g6768jNV3kj655IFERjYeovN0JqZl3wDku3acs9F57/i WacemaF//VNKTebTsN0yKSnkZZZtkxq9QPPx8vu78gxgZEk6oYg3FhXl0/SMft7uj3kk xXlBgoCHLKp782E0g58StAL2+0w74XbsRTydN5oD5Dp8TJp4MEZjf/ZteBp3q8VbPB3u 0/ABDuP/SUk+JhfTUKRRscaJm8aa5YatnAWMpKYPQ1msw5O29E2HszXfvVOvNm6ilNod qsOUp6eHXbKz5EQnzoi8cSgHqIyYchGVJtsAzA6lP1oFhhBdQSmIHxsX9KgAWnCtudWa Sfwg== X-Gm-Message-State: APjAAAU+OMeu1JO9z+JJsHsKxPBEPb3eGaUeewnNCf8VmVvZyDQv19hF P24HfaTOw2C1ZyFuvs4TlW8= X-Received: by 2002:a17:902:fe8b:: with SMTP id x11mr604022plm.83.1576029711685; Tue, 10 Dec 2019 18:01:51 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:250d:e71d:5a0a:9afe]) by smtp.gmail.com with ESMTPSA id c18sm295405pgj.24.2019.12.10.18.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 18:01:50 -0800 (PST) Date: Wed, 11 Dec 2019 11:01:49 +0900 From: Sergey Senozhatsky To: Benjamin Herrenschmidt Cc: Sergey Senozhatsky , linux-kernel@vger.kernel.org, Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds Subject: Re: [RFC/PATCH] printk: Fix preferred console selection with multiple matches Message-ID: <20191211020149.GN88619@google.com> References: <20191210080154.GJ88619@google.com> <98df321d16adb67c5579ac4b67d845fc0c2c97df.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <98df321d16adb67c5579ac4b67d845fc0c2c97df.camel@kernel.crashing.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (19/12/11 09:26), Benjamin Herrenschmidt wrote: [..] > No not exactly. Architectures/platforms use add_preferred_console() > (such as arm64 with ACPI but powerpc at least does it too) based on > various factors to select a reasonable "default" for that specific > platform. Without that the kernel will basically default to the first > one to register which may not be what you want. > > The command line ones however want to override the defaults (provided > they exist, ie, it's possible that whever is specified on the command > line doesn't actually exist, and thus shall be ignored. That typically > happens when there is either no match or ->setup fails). > > > Hmm. > > > > The patch may affect setups where alias matching is expected to > > happen. E.g.: > > > > console=uartFOO,BAR > > > > Is 8250 the only console that does alias matching? > > Why would the patch affect this negatively ? Today we stop on the first > match, mark the driver enabled, and make it preferred if the match > index matches preferred_console. As far as I know, ->match() does not only match but also does ->setup(). If we have two console list entries that match (one via aliasing and one via exact match) then the console driver is setup twice. Do all console drivers handle it? [double setup] If we could perform simple alias matching, without ->setup() call, and exact matching (strcmp()), and then, if newcon would match two entries, we would pick up the last matching entry and configure newcon only once. This changes the order, tho. [..] > - Another match that is marked preferred_console, in which case in > addition to being enabled, the newly registered console will also be > made the default console (ie, first in the list with CONSDEV set). This > is actually what we want ! IE. The console matches the last specified > one on the command line. Well, it still looks to me that what you want is to "ignore alias match and prefer exact match". -ss