linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>,
	mingo@elte.hu, peterz@infradead.org, aris@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] [watchdog] combine nmi_watchdog and softlockup
Date: Fri, 16 Apr 2010 16:46:17 +0200	[thread overview]
Message-ID: <20100416144616.GC5162@nowhere> (raw)
In-Reply-To: <20100416143232.GA5540@lenovo>

On Fri, Apr 16, 2010 at 06:32:32PM +0400, Cyrill Gorcunov wrote:
> On Fri, Apr 16, 2010 at 03:47:14AM +0200, Frederic Weisbecker wrote:
> [...]
> > > +
> > > +/* Callback function for perf event subsystem */
> > > +void watchdog_overflow_callback(struct perf_event *event, int nmi,
> > > +		 struct perf_sample_data *data,
> > > +		 struct pt_regs *regs)
> > > +{
> > > +	int this_cpu = smp_processor_id();
> > > +	unsigned long touch_ts = per_cpu(watchdog_touch_ts, this_cpu);
> > > +
> > > +	if (touch_ts == 0) {
> > > +		__touch_watchdog();
> > > +		return;
> > > +	}
> > > +
> > > +	/* check for a hardlockup
> > > +	 * This is done by making sure our timer interrupt
> > > +	 * is incrementing.  The timer interrupt should have
> > > +	 * fired multiple times before we overflow'd.  If it hasn't
> > > +	 * then this is a good indication the cpu is stuck
> > > +	 */
> > > +	if (is_hardlockup(this_cpu)) {
> > > +		/* only print hardlockups once */
> > > +		if (cpumask_test_cpu(this_cpu, to_cpumask(hardlockup_mask)))
> > > +			return;
> > > +
> > > +		if (hardlockup_panic)
> > > +			panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
> > > +		else
> > > +			WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
> > > +
> > > +		cpumask_set_cpu(this_cpu, to_cpumask(hardlockup_mask));
> > 
> > 
> > 
> > May be have an arch spin lock there to update your cpu mask safely.
> > 
> 
> Hmm, this is NMI handler path so from what we protect this per-cpu data?
> Do I miss something? /me confused


The cpu mask is not per cpu here, this is a shared bitmap, so you
can race against other cpus NMIs.

That said, as I suggested, having a per cpu var that we set when we
warned would be much better than a spinlock here.


  reply	other threads:[~2010-04-16 14:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 21:25 [PATCH v2] [watchdog] combine nmi_watchdog and softlockup Don Zickus
2010-04-15 22:32 ` Randy Dunlap
2010-04-16 14:12   ` Don Zickus
2010-04-16  1:47 ` Frederic Weisbecker
2010-04-16 14:12   ` Don Zickus
2010-04-16 14:43     ` Frederic Weisbecker
2010-04-16 15:04       ` Don Zickus
2010-04-16 15:32         ` Frederic Weisbecker
2010-04-16 16:14           ` Don Zickus
2010-04-16 16:24             ` Frederic Weisbecker
2010-04-16 14:32   ` Cyrill Gorcunov
2010-04-16 14:46     ` Frederic Weisbecker [this message]
2010-04-16 14:53       ` Peter Zijlstra
2010-04-16 14:59         ` Frederic Weisbecker
2010-04-16 14:54       ` Cyrill Gorcunov
2010-04-16 14:46     ` Don Zickus
2010-04-19 21:21   ` Don Zickus
2010-04-19 21:35     ` Ingo Molnar
2010-04-19 21:51       ` Don Zickus

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=20100416144616.GC5162@nowhere \
    --to=fweisbec@gmail.com \
    --cc=aris@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).