Re: console output duplicated when registering additional consoles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux