From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Jonathan Richardson <jonathan.richardson@broadcom.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Petr Mladek <pmladek@suse.com>,
gregkh@linuxfoundation.org, jslaby@suse.com,
sergey.senozhatsky@gmail.com, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org,
Scott Branden <scott.branden@broadcom.com>,
Ray Jui <ray.jui@broadcom.com>,
Srinath Mannam <srinath.mannam@broadcom.com>
Subject: Re: console output duplicated when registering additional consoles
Date: Tue, 19 Nov 2019 09:34:57 +0900 [thread overview]
Message-ID: <20191119003457.GA208047@google.com> (raw)
In-Reply-To: <CAHrpVsWu54rKg3bGhY6WVj5d-myYxGSEkxGhOJKTyyc1EH4qOA@mail.gmail.com>
On (19/11/18 13:38), Jonathan Richardson wrote:
> > +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. It also needs to be cleared when the second console driver is
> registered (of the same type, boot or normal)
The second 'normal' console can be, for instance, netcon - it's sort
of OK to have CON_PRINTBUFFER tty and CON_PRINTBUFFER netcon consoles.
Maybe
> not just when a normal con replaces a bootconsole. A simple way of
> avoiding the problem I'm seeing is to not even set the CON_PRINTBUFFER
> flag on my consoles.
This is up to the console driver to decide.
> It skips the replay and the output on all consoles looks fine. The flag
> is only used by register_console(), although I don't think that is the
> intended usage? There are no console drivers that do this.
Not sure I'm following. There are consoles that want all logbuf messages
once those consoles are available.
$ git grep "\.flags" drivers/tty/ | grep -c CON_PRINTBUFFER
72
-ss
next prev parent reply other threads:[~2019-11-19 0:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-07 1:09 console output duplicated when registering additional consoles Jonathan Richardson
2019-11-14 1:28 ` Jonathan Richardson
2019-11-14 9:57 ` Petr Mladek
2019-11-15 4:33 ` Sergey Senozhatsky
2019-11-18 21:38 ` Jonathan Richardson
2019-11-19 0:34 ` Sergey Senozhatsky [this message]
2019-11-19 18:46 ` Jonathan Richardson
2019-11-21 9:33 ` Petr Mladek
2019-11-19 11:30 ` Petr Mladek
2019-11-19 18:36 ` Jonathan Richardson
2019-11-20 0:28 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191119003457.GA208047@google.com \
--to=sergey.senozhatsky.work@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathan.richardson@broadcom.com \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=ray.jui@broadcom.com \
--cc=scott.branden@broadcom.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=srinath.mannam@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).