Re: [PATCH v2] printk/nmi: avoid direct printk()-s from __printk_nmi_flush()

From: Andrew Morton
Date: Tue Aug 30 2016 - 18:03:20 EST


On Wed, 31 Aug 2016 01:13:54 +0900 Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> wrote:

> __printk_nmi_flush() can be called from nmi_panic(), therefore it has to
> test whether it's executed in NMI context and thus must route the messages
> through deferred printk() or via direct printk().

Why? What misbehaviour does the current code cause?

> Except for two places
> where __printk_nmi_flush() does unconditional direct printk() calls:
> - pr_err("printk_nmi_flush: internal error ...")
> - pr_cont("\n")
>
> Factor out print_nmi_seq_line() parts into a new printk_nmi_flush_line()
> function, which takes care of in_nmi(), and use it in __printk_nmi_flush()
> for printing and error-reporting.