From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755290AbdEKImA (ORCPT ); Thu, 11 May 2017 04:42:00 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34467 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbdEKIl6 (ORCPT ); Thu, 11 May 2017 04:41:58 -0400 Date: Thu, 11 May 2017 17:41:58 +0900 From: Sergey Senozhatsky To: Aleksey Makarov 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 , Petr Mladek , Sergey Senozhatsky Subject: Re: [PATCH v9 3/3] printk: fix double printing with earlycon Message-ID: <20170511084158.GB421@jagdpanzerIV.localdomain> References: <20170315102854.1763-1-aleksey.makarov@linaro.org> <20170405202006.18234-1-aleksey.makarov@linaro.org> <20170509082915.GA13236@bistromath.localdomain> <20170511082433.GA421@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170511082433.GA421@jagdpanzerIV.localdomain> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > There might be some other problem (in qemu?) though, because 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). > > thanks for the report. > > so we have ttyS1 first and ttyS0 last. > after commit in question, register_console() iterates console_cmdline > in reverse order so we see ttyS0 first, then we hit `if (newcon->index < 0)' > condition, set newcon to ttyS0, because we iterate in reverse order now, and > break out. so we enable ttyS0, instead of ttyS1. > > previously, we iterated console_cmdline from index 0 and saw ttyS1 first. > so the same `if (newcon->index < 0)' condition would set newcone to ttyS1, > and, thus, we would enable ttyS1, not ttyS0. Alexey, can we have preferred console at offset 0 (not at console_cmdline_cnt - 1) and restore the previous register_console() iteration order? -ss