mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Anton Blanchard <anton@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues
Date: Thu, 23 Apr 2015 23:37:13 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1504232242510.13914@nanos> (raw)
In-Reply-To: <20150423203236.GJ13605@tassilo.jf.intel.com>

On Thu, 23 Apr 2015, Andi Kleen wrote:
> On Thu, Apr 23, 2015 at 10:01:04PM +0200, Thomas Gleixner wrote:
> > On Thu, 23 Apr 2015, Alexander Shishkin wrote:
> > 
> > > The problem with using cycle counter for NMI watchdog is that its
> > > frequency changes with the corresponding core's frequency. This means
> > > that, in particular, if the core frequency scales up, watchdog NMI will
> > > arrive more frequently than what user requested through watchdog_thresh
> > > and also increasing the probability of setting off the hardlockup detector,
> > > because the corresponding hrtimer will keep firing at the same intervals
> > > regardless of the core frequency. And, if the core can turbo to up to 2.5x
> > > its base frequency (and therefore TSC) [1], we'll have the hrtimer and NMI
> > 
> > So you are saying that this M-5Y10 has a non-constant TSC again? You
> > really can't be serious about that.
> 
> The TSC is constant, but the maximum frequency can be >=2.5TSC, so the
> watchdog which uses cycles can have that much error.

That makes sense. I misinterpreted the (therefore TSC) above.

The nmi_watchdog then fires not once per watchdog_tresh seconds, it
fires once per watchdog_tresh * 400ms. So the hrtimer might not have a
chance to increment hrtimer_interrupts and the hardlockup detector
triggers.

But do we really need that whole calibration maze to deal with this?

Definitely not.

We can just detect the deviation in the callback itself:

       u64 now = ktime_get_mono_fast_ns();

       if (now - __this_cpu_read(nmi_timestamp) < period)
       	       return;

       __this_cpu_write(nmi_timestamp, now);

It's that simple.

Thanks,

	tglx

  reply	other threads:[~2015-04-23 21:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 15:03 Alexander Shishkin
2015-04-23 20:01 ` Thomas Gleixner
2015-04-23 20:32   ` Andi Kleen
2015-04-23 21:37     ` Thomas Gleixner [this message]
2015-04-24  0:51       ` Andi Kleen
2015-04-24  8:44         ` Thomas Gleixner
2015-04-24  9:35           ` Thomas Gleixner
2015-04-24  9:46             ` Alexander Shishkin
2015-04-24  9:48               ` Thomas Gleixner
2015-04-24  9:59           ` Andi Kleen
2015-04-24 11:50             ` Thomas Gleixner
2015-04-24  9:01         ` Borislav Petkov

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=alpine.DEB.2.11.1504232242510.13914@nanos \
    --to=tglx@linutronix.de \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anton@samba.org \
    --cc=dzickus@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®