From: tip-bot for Don Zickus <dzickus@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
eparis@redhat.com, peterz@infradead.org, randy.dunlap@oracle.com,
gorcunov@gmail.com, fweisbec@gmail.com, tglx@linutronix.de,
dzickus@redhat.com, mingo@elte.hu
Subject: [tip:perf/nmi] x86: Move trigger_all_cpu_backtrace to its own die_notifier
Date: Thu, 13 May 2010 06:53:04 GMT [thread overview]
Message-ID: <tip-7cbb7e7fa46f6e5229438ac9e4a5c72ec0d53e0b@git.kernel.org> (raw)
In-Reply-To: <1273266711-18706-6-git-send-email-dzickus@redhat.com>
Commit-ID: 7cbb7e7fa46f6e5229438ac9e4a5c72ec0d53e0b
Gitweb: http://git.kernel.org/tip/7cbb7e7fa46f6e5229438ac9e4a5c72ec0d53e0b
Author: Don Zickus <dzickus@redhat.com>
AuthorDate: Fri, 7 May 2010 17:11:48 -0400
Committer: Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Wed, 12 May 2010 23:55:47 +0200
x86: Move trigger_all_cpu_backtrace to its own die_notifier
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.
V2:
- use arch_spin_locks
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Eric Paris <eparis@redhat.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
LKML-Reference: <1273266711-18706-6-git-send-email-dzickus@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.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..8c3edfb 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 arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED;
+
+ arch_spin_lock(&lock);
+ printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
+ show_regs(regs);
+ dump_stack();
+ arch_spin_unlock(&lock);
+ cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
+ return NOTIFY_STOP;
+ }
+
+ return NOTIFY_DONE;
+}
+
+static __read_mostly struct notifier_block backtrace_notifier = {
+ .notifier_call = arch_trigger_all_cpu_backtrace_handler,
+ .next = NULL,
+ .priority = 1
+};
+
+static int __init register_trigger_all_cpu_backtrace(void)
+{
+ register_die_notifier(&backtrace_notifier);
+ return 0;
+}
+early_initcall(register_trigger_all_cpu_backtrace);
#endif
/* STUB calls to mimic old nmi_watchdog behaviour */
next prev parent reply other threads:[~2010-05-13 6:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 21:11 [PATCH 0/8] lockup detector changes Don Zickus
2010-05-07 21:11 ` [PATCH 1/8] [watchdog] combine nmi_watchdog and softlockup Don Zickus
2010-05-12 19:55 ` Frederic Weisbecker
2010-05-13 6:51 ` [tip:perf/nmi] lockup_detector: Combine nmi_watchdog and softlockup detector tip-bot for Don Zickus
2010-05-07 21:11 ` [PATCH 2/8] [nmi watchdog] touch_softlockup cleanups and softlockup_tick removal Don Zickus
2010-05-12 20:06 ` Frederic Weisbecker
2010-05-12 20:26 ` Don Zickus
2010-05-12 20:28 ` Frederic Weisbecker
2010-05-12 20:56 ` Don Zickus
2010-05-12 21:00 ` Frederic Weisbecker
2010-05-12 21:38 ` Cyrill Gorcunov
2010-05-12 21:50 ` Don Zickus
2010-05-13 15:53 ` Cyrill Gorcunov
2010-05-13 16:04 ` Don Zickus
2010-05-13 6:52 ` [tip:perf/nmi] lockup_detector: Touch_softlockup " tip-bot for Don Zickus
2010-05-07 21:11 ` [PATCH 3/8] [watchdog] remove old softlockup code Don Zickus
2010-05-13 6:52 ` [tip:perf/nmi] lockup_detector: Remove " tip-bot for Don Zickus
2010-05-07 21:11 ` [PATCH 4/8] [watchdog] remove nmi_watchdog.c file Don Zickus
2010-05-13 6:52 ` [tip:perf/nmi] lockup_detector: Remove " tip-bot for Don Zickus
2010-05-07 21:11 ` [PATCH 5/8] [x86] watchdog: move trigger_all_cpu_backtrace to its own die_notifier Don Zickus
2010-05-13 6:53 ` tip-bot for Don Zickus [this message]
2010-05-07 21:11 ` [PATCH 6/8] [x86] watchdog: cleanup hw_nmi.c cruft Don Zickus
2010-05-13 6:53 ` [tip:perf/nmi] x86: Cleanup " tip-bot for Don Zickus
2010-05-07 21:11 ` [PATCH 7/8] [watchdog] resolve softlockup.c conflicts Don Zickus
2010-05-07 21:11 ` [PATCH 8/8] [watchdog] separate touch_nmi_watchdog code path from touch_watchdog Don Zickus
2010-05-13 6:53 ` [tip:perf/nmi] lockup_detector: Separate " tip-bot for 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=tip-7cbb7e7fa46f6e5229438ac9e4a5c72ec0d53e0b@git.kernel.org \
--to=dzickus@redhat.com \
--cc=eparis@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=randy.dunlap@oracle.com \
--cc=tglx@linutronix.de \
/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).