Re: [PATCHv7 3/8] printk: introduce per-cpu safe_print seq buffer

From: Sergey Senozhatsky
Date: Wed Jan 04 2017 - 20:01:54 EST


On (01/04/17 14:31), Petr Mladek wrote:
> On Tue 2016-12-27 23:16:06, Sergey Senozhatsky wrote:
> > This patch extends the idea of NMI per-cpu buffers to regions
> > that may cause recursive printk() calls and possible deadlocks.
> > Namely, printk() can't handle printk calls from schedule code
> > or printk() calls from lock debugging code (spin_dump() for instance);
> > because those may be called with `sem->lock' already taken or any
> > other `critical' locks (p->pi_lock, etc.). An example of deadlock
> > can be
> >
> > Usage example:
> >
> > printk()
> > printk_safe_enter_irqsave(flags)
> > //
> > // any printk() call from here will endup in vprintk_safe(),
> > // that stores messages in a special per-CPU buffer.
> > //
> > printk_safe_exit_irqrestore(flags)
> >
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
>
> I really like the new variants for printk_safe_enter/exit and
> different IRQ context.
>
> Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

thanks.

-ss