From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756687Ab0DUVeb (ORCPT ); Wed, 21 Apr 2010 17:34:31 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:34216 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755363Ab0DUVea (ORCPT ); Wed, 21 Apr 2010 17:34:30 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=vwPWGxGNdnxakMQIhltcaxOeVE4LiSgZ8pAiNUd/MbcdSZHWhet+W4es/qt0CCdFLG WTFEMR7V9BB32qH6W35Gz0Qd3kvSAkWsoCbqebOzXNqxrBXqNu44KxpbSPN2gEGCJp3J 9tDjWZpr6hd+NnR4Dj2UOUODLPKm+v78kbLKQ= Date: Wed, 21 Apr 2010 23:34:36 +0200 From: Frederic Weisbecker To: Don Zickus 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 Message-ID: <20100421213434.GD8677@nowhere> References: <1271777043-3807-1-git-send-email-dzickus@redhat.com> <1271777043-3807-6-git-send-email-dzickus@redhat.com> <20100421210003.GC8677@nowhere> <20100421211012.GX15159@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100421211012.GX15159@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > --- > > > 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 > > > #include > > > #include > > > +#include > > > +#include > > > +#include > > > + > > > > > > #include > > > #include > > > @@ -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.