kernel/watchdog: prevent false hardlockup on overloaded system
authorDon Zickus <dzickus@redhat.com>
Tue, 24 Jan 2017 23:17:53 +0000 (15:17 -0800)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 02:59:20 +0000 (02:59 +0000)
commit8b6f35afc0f3e8f853820838fcb1d3d4a1d3565f
treed4de20e60a8543f97dd60747d5baba70d2d04e59
parent2ca1889236309f7cf6b3463adb6b7357df9c6163
kernel/watchdog: prevent false hardlockup on overloaded system

[ Upstream commit b94f51183b0617e7b9b4fb4137d4cf1cab7547c2 ]

On an overloaded system, it is possible that a change in the watchdog
threshold can be delayed long enough to trigger a false positive.

This can easily be achieved by having a cpu spinning indefinitely on a
task, while another cpu updates watchdog threshold.

What happens is while trying to park the watchdog threads, the hrtimers
on the other cpus trigger and reprogram themselves with the new slower
watchdog threshold.  Meanwhile, the nmi watchdog is still programmed
with the old faster threshold.

Because the one cpu is blocked, it prevents the thread parking on the
other cpus from completing, which is needed to shutdown the nmi watchdog
and reprogram it correctly.  As a result, a false positive from the nmi
watchdog is reported.

Fix this by setting a park_in_progress flag to block all lockups until
the parking is complete.

Fix provided by Ulrich Obergfell.

[akpm@linux-foundation.org: s/park_in_progress/watchdog_park_in_progress/]
Link: http://lkml.kernel.org/r/1481041033-192236-1-git-send-email-dzickus@redhat.com
Signed-off-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/nmi.h
kernel/watchdog.c
kernel/watchdog_hld.c