public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Don Zickus <dzickus@redhat.com>
Cc: mingo@elte.hu, peterz@infradead.org, gorcunov@gmail.com,
	aris@redhat.com, linux-kernel@vger.kernel.org,
	randy.dunlap@oracle.com
Subject: Re: [PATCH 5/6] [x86] watchdog: move trigger_all_cpu_backtrace to its own die_notifier
Date: Wed, 21 Apr 2010 23:34:36 +0200	[thread overview]
Message-ID: <20100421213434.GD8677@nowhere> (raw)
In-Reply-To: <20100421211012.GX15159@redhat.com>

On Wed, Apr 21, 2010 at 05:10:12PM -0400, Don Zickus wrote:
> On Wed, Apr 21, 2010 at 11:00:04PM +0200, Frederic Weisbecker wrote:
> > On Tue, Apr 20, 2010 at 11:24:02AM -0400, Don Zickus wrote:
> > > As part of the transition of the nmi watchdog to something more generic,
> > > the trigger_all_cpu_backtrace code is getting left behind.  Put it in its
> > > own die_notifier so it can still be used.
> > > 
> > > Signed-off-by: Don Zickus <dzickus@redhat.com>
> > > ---
> > >  arch/x86/kernel/apic/hw_nmi.c |   65 ++++++++++++++++++++++++++++++++---------
> > >  1 files changed, 51 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
> > > index 79425f9..19d3435 100644
> > > --- a/arch/x86/kernel/apic/hw_nmi.c
> > > +++ b/arch/x86/kernel/apic/hw_nmi.c
> > > @@ -17,6 +17,10 @@
> > >  #include <linux/cpumask.h>
> > >  #include <linux/kernel_stat.h>
> > >  #include <asm/mce.h>
> > > +#include <linux/kdebug.h>
> > > +#include <linux/notifier.h>
> > > +#include <linux/kprobes.h>
> > > +
> > >  
> > >  #include <linux/nmi.h>
> > >  #include <linux/module.h>
> > > @@ -54,20 +58,6 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
> > >  	unsigned int sum;
> > >  	int cpu = smp_processor_id();
> > >  
> > > -	/* FIXME: cheap hack for this check, probably should get its own
> > > -	 * die_notifier handler
> > > -	 */
> > > -	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
> > > -		static DEFINE_SPINLOCK(lock);	/* Serialise the printks */
> > > -
> > > -		spin_lock(&lock);
> > > -		printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
> > > -		show_regs(regs);
> > > -		dump_stack();
> > > -		spin_unlock(&lock);
> > > -		cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
> > > -	}
> > > -
> > >  	/* if we are doing an mce, just assume the cpu is not stuck */
> > >  	/* Could check oops_in_progress here too, but it's safer not to */
> > >  	if (mce_in_progress())
> > > @@ -109,6 +99,53 @@ void arch_trigger_all_cpu_backtrace(void)
> > >  		mdelay(1);
> > >  	}
> > >  }
> > > +
> > > +static int __kprobes
> > > +arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self,
> > > +			 unsigned long cmd, void *__args)
> > > +{
> > > +	struct die_args *args = __args;
> > > +	struct pt_regs *regs;
> > > +	int cpu = smp_processor_id();
> > > +
> > > +	switch (cmd) {
> > > +	case DIE_NMI:
> > > +	case DIE_NMI_IPI:
> > > +		break;
> > > +
> > > +	default:
> > > +		return NOTIFY_DONE;
> > > +	}
> > > +
> > > +	regs = args->regs;
> > > +
> > > +	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
> > > +		static DEFINE_SPINLOCK(lock);	/* Serialise the printks */
> > > +
> > > +		spin_lock(&lock);
> > 
> > 
> > 
> > This should be an arch_spin_lock(), so that it won't sleep with rt mutex.
> 
> ok, I just copied and pasted what was there currently.
> 
> > 
> > 
> > In fact this whole function can be moved to generic code, right?
> 
> generic for x86, yes.  Ingo stuck in the nmi.c code awhile ago.  This code
> just needs a home somewhere.  I really don't care where.


Ah right, this is x86 only, sorry.


  reply	other threads:[~2010-04-21 21:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 15:23 [PATCH 0/6] lockup detector changes Don Zickus
2010-04-20 15:23 ` [PATCH 1/6] [watchdog] combine nmi_watchdog and softlockup Don Zickus
2010-04-20 15:53   ` Randy Dunlap
2010-04-20 16:11     ` Don Zickus
2010-04-21 17:27   ` Frederic Weisbecker
2010-04-21 17:50     ` Don Zickus
2010-04-21 20:24       ` Frederic Weisbecker
2010-04-21 20:49         ` Don Zickus
2010-04-20 15:23 ` [PATCH 2/6] [watchdog] convert touch_softlockup_watchdog to touch_watchdog Don Zickus
2010-04-21 20:46   ` Frederic Weisbecker
2010-04-21 21:31     ` Don Zickus
2010-04-21 21:46       ` Frederic Weisbecker
2010-04-22 13:20         ` Don Zickus
2010-04-22 18:53           ` Frederic Weisbecker
2010-04-20 15:24 ` [PATCH 3/6] [watchdog] remove old softlockup code Don Zickus
2010-04-20 15:24 ` [PATCH 4/6] [watchdog] remove nmi_watchdog.c file Don Zickus
2010-04-20 15:24 ` [PATCH 5/6] [x86] watchdog: move trigger_all_cpu_backtrace to its own die_notifier Don Zickus
2010-04-21 21:00   ` Frederic Weisbecker
2010-04-21 21:10     ` Don Zickus
2010-04-21 21:34       ` Frederic Weisbecker [this message]
2010-04-20 15:24 ` [PATCH 6/6] [x86] watchdog: cleanup hw_nmi.c cruft Don Zickus
2010-04-20 16:16 ` [PATCH 7/6] [watchdog] resolve softlockup.c conflicts 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=20100421213434.GD8677@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 \
    --cc=randy.dunlap@oracle.com \
    /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