Messages in this thread | | | Date | Fri, 7 May 2021 16:49:51 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [PATCH] printk: stop spining waiter when console resume to flush prb |
| |
On (21/05/07 15:33), luojiaxing wrote: > > console_unlock() > > { > > ... > > > > if (printed_messages > limit && !console_lock_spinning_disable_and_check()) { > > printk_safe_exit_irqrestore(flags); > > > > console_locked = 0; > > up_console_sem(); > > > > defer_console_output(); > > return; > > } > > > Hi, Sergey, I test this, it works. > > > But, I have a doubt. If the log buffer exceeds limit, we can schedule IRQ > work to become the console lock owner and let current context return. > > So why not just let the IRQ work process the console output without limit?
log buffer can be several tenth of megabytes in size which IRQ work will have to print to a potentially slow serial console, which will trigger watchdogs on the CPU that IRQ is running on.
> I wonder if the driver can only cache the print and queue the output tasks > to a workqueue to return
Work queue task is preemptible, which did cause problems in the past: huge printing delays under memory pressure. So, ideally, what we want from a console lock owner is be non-preemptible and to either print pending messages or handover the lock to another task.
| |