From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aleksey Makarov Subject: Re: [PATCH v9 3/3] printk: fix double printing with earlycon Date: Mon, 15 May 2017 00:01:48 +0300 Message-ID: <02d08d4a-95b2-b0f2-0319-f41e16e4c8b3@linaro.org> References: <20170315102854.1763-1-aleksey.makarov@linaro.org> <20170405202006.18234-1-aleksey.makarov@linaro.org> <20170509082915.GA13236@bistromath.localdomain> <20170511082433.GA421@jagdpanzerIV.localdomain> <20170511084158.GB421@jagdpanzerIV.localdomain> <20170512125729.GO3452@pathway.suse.cz> <20170512134655.GD31170@pathway.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170512134655.GD31170@pathway.suse.cz> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Petr Mladek , Sergey Senozhatsky Cc: Sabrina Dubroca , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , Greg Kroah-Hartman , Peter Hurley , Jiri Slaby , Robin Murphy , Steven Rostedt , "Nair, Jayachandran" , Sergey Senozhatsky List-Id: linux-serial@vger.kernel.org On 05/12/2017 04:46 PM, Petr Mladek wrote: > On Fri 2017-05-12 14:57:29, Petr Mladek wrote: >> On Thu 2017-05-11 17:41:58, Sergey Senozhatsky wrote: >>> On (05/11/17 17:24), Sergey Senozhatsky wrote: >>>> On (05/09/17 10:29), Sabrina Dubroca wrote: >>>> [..] >>>>> That's caused a change of behavior in my qemu setup, with this cmdline >>>>> >>>>> root=/dev/sda1 console=ttyS1 console=ttyS0 >>>>> >>>>> Before, the kernel logs appeared on ttyS1, and I logged in with ttyS0 >>>>> (with my setup, ttyS1 is a file and ttyS0 is unix socket). Now, the >>>>> kernel logs go to ttyS0. I need to swap the two console= parameters to >>>>> restore behavior. > > Do you actually need to define console=ttyS0 on the cmdline? Exactly. You should specify a console on the command line only if you want kernel logs on it. It's kernel bug that one of this consoles does not receive kernel logs, see Documentation/admin-guide/serial-console.rst > IMHO, if register_console() was called for the unix socket, it > would make logs appear on both ttyS0 and ttyS1. It seems > that register_console() is called only for the console that > stores logs into the file. It's not quite accurate sentence. It's qemu who deals with file/socket and it is transparent to kernel. >>>>> adding >>>>> console=tty0 anywhere on that cmdline makes the logs appear on both >>>>> tty0 and one ttyS* (but only one of them, and the ordering of the >>>>> ttyS* matters). > > I guess that it worked this way before. I mean that the logs appeared > on both tty0 and one of ttyS*. The only difference should be that > the patch changed the selected ttyS*. So this is still the same problem. > > >> Hmm, I have no idea how to fix this. This is the case where >> a registered console matches more entries from the command line. >> The fix that caused this regression fixed exactly this situation >> and we wanted to make the preferred console first. >> >> I am not sure if we broke some backward compatibility or actually made >> it more predictable in the long term. > > I think that we actually fixed a very old bug. The last mentioned > console= should be the preferred one and the logs are finally > printed there. Or do I miss anything? Last mentioned 'console=' (preferred console) is the console that should become /dev/console. Its driver is returned by console_device(). In other respects the last mentioned console is not special, so I believe it is irrelevant to the report. Thank you Aleksey Makarov