public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: kan.liang@intel.com
To: linux-kernel@vger.kernel.org
Cc: dzickus@redhat.com, mingo@kernel.org, akpm@linux-foundation.org,
	babu.moger@oracle.com, atomlin@redhat.com, prarit@redhat.com,
	torvalds@linux-foundation.org, peterz@infradead.org,
	tglx@linutronix.de, eranian@google.com, acme@redhat.com,
	ak@linux.intel.com, Kan Liang <Kan.liang@intel.com>,
	stable@vger.kernel.org
Subject: [PATCH] kernel/watchdog: fix spurious hard lockups
Date: Tue, 20 Jun 2017 14:33:09 -0700	[thread overview]
Message-ID: <20170620213309.30051-1-kan.liang@intel.com> (raw)

From: Kan Liang <Kan.liang@intel.com>

Some users reported spurious NMI watchdog timeouts.

We now have more and more systems where the Turbo range is wide enough
that the NMI watchdog expires faster than the soft watchdog timer that
updates the interrupt tick the NMI watchdog relies on.

This problem was originally added by commit 58687acba592
("lockup_detector: Combine nmi_watchdog and softlockup detector").
Previously the NMI watchdog would always check jiffies, which were
ticking fast enough. But now the backing is quite slow so the expire
time becomes more sensitive.

For mainline the right fix is to switch the NMI watchdog to reference
cycles, which tick always at the same rate independent of turbo mode.
But this is requires some complicated changes in perf, which are too
difficult to backport. Since we need a stable fix too just increase the
NMI watchdog rate here to avoid the spurious timeouts. This is not an
ideal fix because a 3x as large Turbo range could still fail, but for
now that's not likely.

Signed-off-by: Kan Liang <Kan.liang@intel.com>
Cc: stable@vger.kernel.org
Fixes: 58687acba592 ("lockup_detector: Combine nmi_watchdog and
softlockup detector")
---

The right fix for mainline can be found here.
perf/x86/intel: enable CPU ref_cycles for GP counter
perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86
https://patchwork.kernel.org/patch/9779087/
https://patchwork.kernel.org/patch/9779089/

 kernel/watchdog_hld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 54a427d1f344..0f7c6e758b82 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -164,7 +164,7 @@ int watchdog_nmi_enable(unsigned int cpu)
 		firstcpu = 1;
 
 	wd_attr = &wd_hw_attr;
-	wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
+	wd_attr->sample_period = 3 * hw_nmi_get_sample_period(watchdog_thresh);
 
 	/* Try to register using hardware perf events */
 	event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL);
-- 
2.11.0

             reply	other threads:[~2017-06-20 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 21:33 kan.liang [this message]
2017-06-20 22:03 ` [PATCH] kernel/watchdog: fix spurious hard lockups Andrew Morton
2017-06-21 12:40   ` Liang, Kan
2017-06-21 13:47     ` Don Zickus
2017-06-21 14:10       ` Liang, Kan
2017-06-20 22:34 ` Prarit Bhargava
2017-06-20 23:00   ` Andi Kleen
2017-06-21  0:12     ` Prarit Bhargava
2017-06-21 21:02       ` Marc Herbert
2017-06-21 13:40 ` Don Zickus
2017-06-21 14:02   ` Liang, Kan
2017-06-28 11:40 ` Michal Hocko
2017-06-28 13:24   ` Liang, Kan
2017-06-28 14:29     ` Michal Hocko
2017-06-28 14:32       ` Liang, Kan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170620213309.30051-1-kan.liang@intel.com \
    --to=kan.liang@intel.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=atomlin@redhat.com \
    --cc=babu.moger@oracle.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=prarit@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox