Re: [PATCH printk v5 19/30] printk: nbcon: Provide function to flush using write_atomic()

John Ogness
2024-05-21T19:07:29Z

On 2024-05-20, Petr Mladek <pmladek@suse.com> wrote:
> What about reshufling the code a bit?
>
> <proposal>
[...]
> </proposal>

Your proposal is fine and is easier to follow. Thanks.

>> + /*
>> + * This context must flush any new records added while the console
>> + * was locked. The console_srcu_read_lock must be taken to ensure
>> + * the console is usable throughout flushing.
>> + */
>> + cookie = console_srcu_read_lock();
>
> In principle, this should not be needed because the console is
> added/removed under con->device_lock() in
> register_console()/unregister_console(). And this function
> nbcon_driver_release() should be called under the same lock.

I added a comment here to make it clear why it is needed. It is about
making sure the console is _usable_ during the flushing, i.e. it
prevents console_suspend() and console_stop() from exiting while the
flush is in progress.

I will leave this as is for v6.

John