]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kernel/watchdog: flush all printk nmi buffers when hardlockup detected
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Thu, 31 Dec 2020 22:03:56 +0000 (22:03 +0000)
committerJohannes Weiner <hannes@cmpxchg.org>
Thu, 31 Dec 2020 22:03:56 +0000 (22:03 +0000)
commitd292dbc316359c613bbadf765f01ac44798d4c16
treec5d043ff14fa7efdc422a8df89ca1b3cddcb65e0
parentffd40fcaffc7f363c1bf82a27826f4f72b2651d3
kernel/watchdog: flush all printk nmi buffers when hardlockup detected

In NMI context printk() could save messages into per-cpu buffers and
schedule flush by irq_work when IRQ are unblocked.  This means message
about hardlockup appears in kernel log only when/if lockup is gone.

Comment in irq_work_queue_on() states that remote IPI aren't NMI safe thus
printk() cannot schedule flush work to another cpu.

This patch adds simple atomic counter of detected hardlockups and flushes
all per-cpu printk buffers in context softlockup watchdog at any other cpu
when it sees changes of this counter.

Link: http://lkml.kernel.org/r/158132813726.1980.17382047082627699898.stgit@buzz
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/nmi.h
kernel/watchdog.c
kernel/watchdog_hld.c