Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp416142ybc; Tue, 19 Nov 2019 03:32:09 -0800 (PST) X-Google-Smtp-Source: APXvYqw9yj9kpAiPvx6GTHfjaUWnDFRv8RZfVsqOAqQ9GAg+Mqxe7qv6tkhgf7KvPxKBK3lBSANa X-Received: by 2002:adf:e8ca:: with SMTP id k10mr1478604wrn.377.1574163129497; Tue, 19 Nov 2019 03:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574163129; cv=none; d=google.com; s=arc-20160816; b=w1uV4e/EBqinb4tcBXqzXrKb4syyfPXwxnmwnfRAchw/s1rMo81XhHHdnXAIGoGrdu Hek5DHhm3WQ+CPq9+jGuYIAFX+Hdqy9KvLTlANv5mSM6QPlkEXuGqsMaEvSe0bFq9lZv ltktu/ZAFHSo5kA8YYnqx6P2iCldB3zxTTdBArv4Fr4W7jb3XtkaIOj00GV71/lTJasE fzsNpIi9KzHbvp2FzQc0JhFHUSSBnZwL1/KMFlJlrUJ8eV6S0pSP0H0uzazMUMz1cf3l /cd0j5x/4TuIpVnBdJggBWpbPu2sqVFbmfY5UW4Sn2CpwwG9kAZ44QPndsbLuWP/nVWr wnNw== 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; bh=CEo8bpdrOsdkfKhnhPker9O7VVdTgTgoDuXe7njDNaA=; b=kqImKeIsdHXJN0fJlr8+NEEhdiQsyWNu0PkcIcxTeOBIbtDkc44CDxJbpskXnOv8yQ iH7jOWViJ+XPdWZb4o90iGj3q4gu+Nfl+KF4EN/axnZOG1KlK54fcs/vljjjN8it0uwN FCtivwFMheOaaYFaxXAqBek10hWc2O8vyZSuXypjJ49jZUFnDUSLRAekSVbob78w8aV/ uGSkaGUraKSPLtKY6XwyNiUtFdW5tBestfG0FkOWCsN8F5BYya9KyjQKRY93C0J/iauq Jd9/7LmtjQ/dtyCM+wQWROlNnWBedT00S84CCsGIfpRcEI+M0Di6FXlTkBXfM2BGpZFK TyDA== 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 z15si15761145edd.8.2019.11.19.03.31.44; Tue, 19 Nov 2019 03:32:09 -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 S1727699AbfKSLaa (ORCPT + 99 others); Tue, 19 Nov 2019 06:30:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:60568 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725280AbfKSLaa (ORCPT ); Tue, 19 Nov 2019 06:30:30 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2D790BC27; Tue, 19 Nov 2019 11:30:28 +0000 (UTC) Date: Tue, 19 Nov 2019 12:30:27 +0100 From: Petr Mladek To: Jonathan Richardson Cc: Sergey Senozhatsky , gregkh@linuxfoundation.org, jslaby@suse.com, sergey.senozhatsky@gmail.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Scott Branden , Ray Jui , Srinath Mannam Subject: Re: console output duplicated when registering additional consoles Message-ID: <20191119113027.74lp3dsg5ftvylp4@pathway.suse.cz> References: <20191114095737.wl5nvxu3w6p5thfc@pathway.suse.cz> <20191115043356.GA220831@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2019-11-18 13:38:04, Jonathan Richardson wrote: > On Thu, Nov 14, 2019 at 8:33 PM Sergey Senozhatsky > wrote: > > > > Gosh, that part of printk is really complex. > > > > On (19/11/14 10:57), Petr Mladek wrote: > > > For a proper solution we would need to match boot and real > > > consoles that write messages into the physical device. > > > But I am afraid that there is no support for this. > > > > Wouldn't those have same tty driver? Interesting idea. Well, do early consoles have tty driver? > > --- > > > > kernel/printk/printk.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > > index f1b08015d3fa..a84cb20acf42 100644 > > --- a/kernel/printk/printk.c > > +++ b/kernel/printk/printk.c > > @@ -2690,6 +2690,19 @@ static int __init keep_bootcon_setup(char *str) > > > > early_param("keep_bootcon", keep_bootcon_setup); > > > > +static bool known_console_driver(struct console *newcon) > > +{ > > + struct console *con; > > + > > + for_each_console(con) { > > + if (!(con->flags & CON_ENABLED)) > > + continue; > > + if (con->device && con->device == newcon->device) > > + return true; > > + } > > + return false; > > +} > > + > > /* > > * The console driver calls this routine during kernel initialization > > * to register the console printing procedure with printk() and to > > @@ -2828,6 +2841,9 @@ void register_console(struct console *newcon) > > if (newcon->flags & CON_EXTENDED) > > nr_ext_console_drivers++; > > > > + if (known_console_driver(newcon)) > > + newcon->flags &= ~CON_PRINTBUFFER; > > + > > if (newcon->flags & CON_PRINTBUFFER) { > > /* > > * console_unlock(); will print out the buffered messages > > Thanks. Jonathan, have you tried this patch, please? Does it solve your problem? Best Regards, Petr