From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0205C34CFAB for ; Thu, 19 Feb 2026 16:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519895; cv=none; b=r45gBh33NR3lS+55tMMfFKdKgqmsFuVazvdUlqb86iWBTfYGX2uo1WdOqt1dr5G2dnxkmshkgj7uWogx10G7FeTX1O96OaxHsTQE4oZ77j4mcfMzZG4HIEgrEZbvt2sEcYqaF+Uz/hAsUM60J6l0Auxjtqt7exZjog0HmMPL6F0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519895; c=relaxed/simple; bh=cXAchwE9iRCWercH1oNS64WJJm51BJtd44yY4Lyq1qU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Lo0qY/nnOh8bP9vvzStzi6NwKucnlEkANIZHq/XaVUzOxGa01r0XQXmzVILMmi6Da9VVkh3oGEAVrMNXGdUW3u/dW5/IzdpVFB1dbHU4m9+Y+2KLkZorn2gOZw8Qsyxv0/63BO1Asrhu1t/YwFEOauIkdo4WMvy9fZ1TKVWuw7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=YQFbrEKn; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="YQFbrEKn" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4834826e555so11378375e9.2 for ; Thu, 19 Feb 2026 08:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1771519892; x=1772124692; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7NS4GtUaSXgGtSpInfiKCYGyRM+hA0WLOEGMPhedxX0=; b=YQFbrEKnEH26xwm0gYHMYRjhLYYc4Oj/uhq8/6jU+l/PoIMHEs1wPH0OJuzeXdg38J srbskhb4DCSjlMDSFywFotI5EWlqbfxbRbXPZUNWc9hgh24+aaanYzZlxl0p5nG6wK2g Ni2SQ8hMTdWlXR+8TCynn9z8hEqVlLFQyoMsWwISdqYX69D0zebTChKqbnb6Cxr6ht0+ ImWyTxANDkHoruCWGjCL7kzp15g+Jdn8ASyruZkMVOOX6Vb1ic7Daz1FTq5r8w4apUSf y6PhcnkRL2xf4XpRhN5TtieY6J8IxwhU2rJ5jFwkoXA0ag3oEg2yDkYNvrTQNZzy6xhD HWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771519892; x=1772124692; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7NS4GtUaSXgGtSpInfiKCYGyRM+hA0WLOEGMPhedxX0=; b=f9xVxAXmbGDbJQlltSZ1nt0aazOGnEZlLPE2KbUU6eQMA+n+ptYG0NwrUPraLQ1bPf deuKWT8vbPTbacdWZiATpTZ3equ8WHAHI8JquDfa7a8n3yQ7T/gUz9PvEbryiyPHWovU R57piOAi6jJcnHSm69sLCFgimFqd7LYmIraAXIM+IxWouMXZ0H0MZ+O5r/VfHcmfKebN XRpoHTScUdgq8HFJ6/db4fHj45piD4hzoTnM6epStcQ1f8UBq7YOYn71B/DKREqxy6Bf c4LfR1WGKvpAlNppylLdl1tTdmx8bKv1mVVMzumd1xBhKQYQPzLEw7JVhJyc8ibE0EdC XQZw== X-Forwarded-Encrypted: i=1; AJvYcCV/A0SHl9xSA+ccvJ2+jPV/IZ3LG4vSDOWrj588QFHMuGi2xNKfED9nUWK8hXvBWyikaLT9c5RHIbK/DD8=@vger.kernel.org X-Gm-Message-State: AOJu0YyZKCXV9h2YxIa/egdFGFwqNqxSs7aeEvf+lc5e3vJKKSINqyd0 JSu6qW+g2Q96zcNbVVn/YqvXbHgi17hSc1S4KN+zmkbWigXJ+Y3zpUgldGOgZSKrMcQ= X-Gm-Gg: AZuq6aKggV1UkBK7YFurBiR1ogK939EATZbECdGCjnLmQ1rzSRpvpoBbdlM/omt5QAw IxSXI35Wtwk0mIZMs0Z5btvvnktTrKtMkIj8D5iOoIe4TOcQH2TiHz6aVn6BF5via3WgjZOe6pY rwxe/XdeMiwnr91xPJILT+VqaFyZX7bpwI12kYr/YIlWJs5XZyRfc+7Zb69puLuw9ilP8nJifZ+ +Whv9HIS7n3rDOb7tsFhNO+MpYJO9s4KxO03/fsPZgkNMFRZ2OwjIqI5oJw47Vza7fpTb1FEUIb Rp50nLMyG9hpxdHnUACB4Immbi+k5M9r8Pg3saeECEdU4pyGn6k9e4xYJcZB0HM4JYAx/VrIFG0 rb4ZjiQhQOuR7BuMvfqvSs24kiPGWzLV68hEjN1NB+8KmlTWANHXxh1R1lmAgo+pRbv98xfQyLg 1qpjTUZ1WSCdgXseKHZTDKPxnzUw== X-Received: by 2002:a05:600c:848a:b0:483:aa2:6bce with SMTP id 5b1f17b1804b1-48379c00bf9mr254427645e9.30.1771519892085; Thu, 19 Feb 2026 08:51:32 -0800 (PST) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4839e7f3919sm28954435e9.0.2026.02.19.08.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 08:51:31 -0800 (PST) Date: Thu, 19 Feb 2026 17:51:29 +0100 From: Petr Mladek To: Chris Down Cc: John Ogness , Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/8] printk: Separate code for adding/updating preferred console metadata Message-ID: References: <20260206165002.496724-1-pmladek@suse.com> <20260206165002.496724-4-pmladek@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu 2026-02-19 22:48:49, Chris Down wrote: > Petr Mladek writes: > > @@ -2531,28 +2587,14 @@ static int __add_preferred_console(const char *name, const short idx, > > for (i = 0, pc = preferred_consoles; > > i < MAX_PREFERRED_CONSOLES && (pc->name[0] || pc->devname[0]); > > i++, pc++) { > > - if ((name && strcmp(pc->name, name) == 0 && pc->index == idx) || > > - (devname && strcmp(pc->devname, devname) == 0)) { > > - if (!brl_options) > > - preferred_dev_console = i; > > - set_user_specified(pc, user_specified); > > - return 0; > > - } > > So, in this old code when __add_preferred_console() finds an existing > matching entry, it returns immediately without touching the options at all. > > But in the new patch the loop breaks out and falls through to > update_preferred_console(), which only conditionally updates options. > > This has different behaviour. For example if you imagine SPCR/DT setting the > options, before they win out against the command line, but now they do not. > > This may well be intended, since the user cmdline probably should win over > the platform defaults anyway. I'd argue that sounds like the right behaviour > anyway. But I don't see this change being mentioned as intentional in the > changelog. Is it? If it is, let's mention it there. Good point! I considered this as a bug fix and I described this in the last paragraph of the commit message: While this is primarily a refactoring, it fixes two minor behavioral consistencies: console options can now be overridden via the command line, and Braille options are preserved even if a non-Braille console with the same name was previously defined. I hope that this change should be on the safe size because: 1. People should be able to override any default value on the command line. It seems to be the only sane approach. 2. 20 of 33 add_preferred_console() callers do not pass options[*] 3. I somehow hooped that add_preferred_console() is mostly called before the command line is proceed. Otherwise, the command line would not be able to overwrite the options. Also /dev/console is supposed to be associated with the last console= defined on the command line. I have to admit that I checked this only on x86_64 where the spcr is handled before the command line, see: + setup_arch() + acpi_boot_init() + acpi_parse_spcr() Hmm, I see that the device tree seems to be handled later, for example, + serial_core_add_one_port() + of_console_check() Honestly, I am a bit afraid of regressions caused by this change. But I hope that it will be a corner case and users might be persuaded that their command line was bogus. As I said, people should be able to override the defaults via the command line. And I do not see any other way how to achieve it. By other words, the sooner we enforce a sane rule the better. I hope that it is not too late. And the only way to check it in the real life is to try it. /o\. But you are right, I should be more clear about this in the commit message. I am going to improve it in v2. [*] $> git grep add_preferred_console | grep -v -e "__add_pre" -e "xen_add_pref" -e "printk" -e "console.h" | wc -l 33 $> git grep add_preferred_console | grep -v -e "__add_pre" -e "xen_add_pref" -e "printk" -e "console.h" | grep ", NULL);" | wc -l 20 Best Regards, Petr