Messages in this thread | | | Date | Fri, 22 Apr 2022 09:48:51 +0200 | From | Petr Mladek <> | Subject | Re: [PATCH printk v4 13/15] printk: add kthread console printers |
| |
On Thu 2022-04-21 23:28:48, John Ogness wrote: > Create a kthread for each console to perform console printing. During > normal operation (@system_state == SYSTEM_RUNNING), the kthread > printers are responsible for all printing on their respective > consoles. > > During non-normal operation, console printing is done as it has been: > within the context of the printk caller or within irqwork triggered > by the printk caller, referred to as direct printing. > > Since threaded console printers are responsible for all printing > during normal operation, this also includes messages generated via > deferred printk calls. If direct printing is in effect during a > deferred printk call, the queued irqwork will perform the direct > printing. To make it clear that this is the only time that the > irqwork will perform direct printing, rename the flag > PRINTK_PENDING_OUTPUT to PRINTK_PENDING_DIRECT_OUTPUT. > > Threaded console printers synchronize against each other and against > console lockers by taking the console lock for each message that is > printed. > > Note that the kthread printers do not care about direct printing. > They will always try to print if new records are available. They can > be blocked by direct printing, but will be woken again once direct > printing is finished. > > Console unregistration is a bit tricky because the associated > kthread printer cannot be stopped while the console lock is held. > A policy is implemented that states: whichever task clears > con->thread (under the console lock) is responsible for stopping > the kthread. unregister_console() will clear con->thread while > the console lock is held and then stop the kthread after releasing > the console lock. > > For consoles that have implemented the exit() callback, the kthread > is stopped before exit() is called. > > Signed-off-by: John Ogness <john.ogness@linutronix.de>
Looks good to me.
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards, Petr
| |