Re: [PATCH v4] panic: add an option to replay all the printk message in buffer

From: Sergey Senozhatsky
Date: Fri Apr 26 2019 - 12:18:53 EST

On (04/27/19 01:43), Sergey Senozhatsky wrote:
> > The console waiter logic is effective but it does not always
> > work. The current console owner must be calling the console
> > drivers.
> >
> > > Hmm, we might have a bit of a problem here, maybe.
> >
> > Hmm, the printk() might wait forever when NMI stopped
> > the current console owner in the console driver code
> > or with the logbuf_lock taken.
> I guess this is why we re-init logbuf lock from panic,
> however, we don't do anything with the console_owner.
> > The console waiter logic might get solved by clearing
> > the console_owner in console_flush_on_panic(). It can't
> > be much worse, we already ignore console_lock() there, ...

Hmm, or maybe we are fine... console_waiter logic should work
before we send out stop IPI/NMI from panic CPU. When we call
flush_on_panic() console_unlock() clears console_owner, so
panic_print_sys_info() should not deadlock on console_owner.

It's probably only problematic if we kill a console_owner
CPU and then try to printk() (from smp_send_stop()) before
we do flush_on_panic()->console_unlock().