Thomas Gleixner 7edaeb6841 kernel/watchdog: Prevent false positives with turbo modes
The hardlockup detector on x86 uses a performance counter based on unhalted
CPU cycles and a periodic hrtimer. The hrtimer period is about 2/5 of the
performance counter period, so the hrtimer should fire 2-3 times before the
performance counter NMI fires. The NMI code checks whether the hrtimer
fired since the last invocation. If not, it assumess a hard lockup.

The calculation of those periods is based on the nominal CPU
frequency. Turbo modes increase the CPU clock frequency and therefore
shorten the period of the perf/NMI watchdog. With extreme Turbo-modes (3x
nominal frequency) the perf/NMI period is shorter than the hrtimer period
which leads to false positives.

A simple fix would be to shorten the hrtimer period, but that comes with
the side effect of more frequent hrtimer and softlockup thread wakeups,
which is not desired.

Implement a low pass filter, which checks the perf/NMI period against
kernel time. If the perf/NMI fires before 4/5 of the watchdog period has
elapsed then the event is ignored and postponed to the next perf/NMI.

That solves the problem and avoids the overhead of shorter hrtimer periods
and more frequent softlockup thread wakeups.

Fixes: 58687acba592 ("lockup_detector: Combine nmi_watchdog and softlockup detector")
Reported-and-tested-by: Kan Liang <Kan.liang@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: dzickus@redhat.com
Cc: prarit@redhat.com
Cc: ak@linux.intel.com
Cc: babu.moger@oracle.com
Cc: peterz@infradead.org
Cc: eranian@google.com
Cc: acme@redhat.com
Cc: stable@vger.kernel.org
Cc: atomlin@redhat.com
Cc: akpm@linux-foundation.org
Cc: torvalds@linux-foundation.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1708150931310.1886@nanos
2017-08-18 12:35:02 +02:00
..
2017-02-24 17:46:57 -08:00
2011-03-11 14:25:50 +00:00
2015-11-23 09:44:58 +01:00
2017-03-30 09:37:20 +02:00
2011-10-29 21:20:22 +02:00
2017-06-09 11:52:07 +02:00
2017-02-24 17:46:57 -08:00
2017-05-09 15:40:28 -07:00
2014-04-30 19:49:37 +01:00
2017-02-24 17:46:57 -08:00
2017-02-13 21:44:10 -05:00
2017-07-07 09:44:06 -07:00
2014-08-08 15:57:25 -07:00
2012-07-30 17:25:16 -07:00
2014-06-25 17:45:43 -07:00
2016-12-06 10:17:03 +02:00
2015-09-08 14:35:59 -07:00
2017-02-24 17:46:57 -08:00
2015-03-23 22:12:08 -04:00
2017-05-15 23:40:22 -04:00
2016-08-02 17:31:41 -04:00
2017-07-07 10:37:54 -07:00