On Wed, Sep 18, 2024 at 02:26:25PM +0200, Petr Mladek wrote: > On Fri 2024-09-13 16:11:37, John Ogness wrote: > > Implement the necessary callbacks to switch the 8250 console driver > > to perform as an nbcon console. > > > > Add implementations for the nbcon console callbacks (write_atomic, > > write_thread, device_lock, device_unlock) and add CON_NBCON to the > > initial flags. > > > > All register access in the callbacks are within unsafe sections. > > The write_thread() callback allows safe handover/takeover per byte. > > The write_atomic() callback allows safe handover/takeover per > > printk record and adds a preceding newline if it took over mid-line. > > > > For the write_atomic() case, a new irq_work is used to defer modem > > control since it may be a context that does not allow waking up > > tasks. > > It would be fair to mention that it does not longer support fifo in > the 8250 driver. It basically reverted the commit 8f3631f0f6eb42e5 > ("serial/8250: Use fifo in 8250 console driver"). > > It is not usable in write_thread() because it would not allow > a safe takeover between emitting particular characters. > > It might still be used in write_atomic() but it is probably not > worth it. This callback is used "only" in emergency and panic > situations. This is unfortunate. It will drop down the efficiency of printing. I think it should be done differently, i.e. the takeover the code has to drop FIFO (IIRC it's easy to achieve by disabling it or so) and switch to printing the panic/emergency message. But still at some baud rate speeds draining the FIFO to the other end may be not a bad idea as it takes a few dozens of microseconds. -- With Best Regards, Andy Shevchenko