Re: [PATCH v2] printk/console: Enable console kthreads only when there is no boot console left

From: Sergey Senozhatsky
Date: Tue Jun 21 2022 - 22:57:40 EST


On (22/06/21 13:19), Petr Mladek wrote:
> > > -static int __init printk_activate_kthreads(void)
> > > -{
> > > - struct console *con;
> > >
> > > - console_lock();
> > > - printk_kthreads_available = true;
> > > - for_each_console(con)
> > > - printk_start_kthread(con);
> > > - console_unlock();
> > > + /*
> > > + * Boot consoles may be accessing the same hardware as normal
> > > + * consoles and thus must not be called in parallel. Therefore
> > > + * only activate threaded console printing if it is known that
> > > + * there are no boot consoles registered.
> > > + */
> > > + if (no_bootcon)
> > > + printk_activate_kthreads();
> >
> > A quick question. Here we still can have bootcon which can unregistered
> > later, right? Do you think it'll make sense to check if printing kthreads
> > can be safely started and start them if so (if no CON_BOOT found and kthreads
> > are not already created) at the end of unregister_console()?
>
> Yeah, that's my plan how to optimize it in the future. I just
> wanted to do something simple and be on the safe side for 5.19.

Sounds good.