Saturday, February 6, 2010

linux.kernel - 17 new messages in 10 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* new nmi_watchdog using perf events - 3 messages, 1 author
http://groups.google.com/group/linux.kernel/t/a35e701a169206e9?hl=en
* Upgrade Your Email Account - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/36940e7f774c7870?hl=en
* Stack size protection broken on ppc64 - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/c1edecbd60f1c6b3?hl=en
* 2.6.32.8-stable review : kernel crashed asap - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/5ab567c3854f45a6?hl=en
* Display goes off with i915.powersave=1 after suspend-resume - 2 messages, 1
author
http://groups.google.com/group/linux.kernel/t/7f2a07997a4d5832?hl=en
* x86: keep chip_data in create_irq_nr and destroy_irq - 3 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/8d79051b75e0b2aa?hl=en
* cx23885: Enable Message Signaled Interrupts(MSI). - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/bfdbce7e7e7a16a1?hl=en
* perf_core: provide a kernel-internal interface to get to performance
counters - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/8a34517ced4cd8ff?hl=en
* [2/4] SLAB: Set up the l3 lists for the memory of freshly added memory - 3
messages, 1 author
http://groups.google.com/group/linux.kernel/t/4398545cf5dbd1de?hl=en
* Weird JCPU times? - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/d8ad7d49c731b980?hl=en

==============================================================================
TOPIC: new nmi_watchdog using perf events
http://groups.google.com/group/linux.kernel/t/a35e701a169206e9?hl=en
==============================================================================

== 1 of 3 ==
Date: Fri, Feb 5 2010 6:50 pm
From: Don Zickus


This patch series tries to implement a new nmi_watchdog using the perf
events subsystem. I am posting this series early for feedback on the
approach. It isn't feature compatible with the old nmi_watchdog yet, nor
does it have all the old workarounds either.

The basic design is to create an in-kernel performance counter that goes off
every few seconds and checks for cpu lockups. It is fairly straight
forward. Some of the quirks are making sure the cpu lockup detection works
correctly.

It has been lightly tested for now. Once people are ok with the approach,
I'll expand testing to more machines in our lab.

I tried taking a generic approach so all arches could use it if they want
and then implement some per arch specific hooks. I believe this is what
Ingo was suggesting. The initial work is based off of kernel/softlockup.c.

Any feedback would be great.

v2:
- moved a notify_die call into a #ifdef block
- used better default values for configuring the nmi_watchdog based on
the old nmi_watchdog values

Cheers,
Don

--
damn it forgot to cc lkml

Don Zickus (3):
[RFC][x86] move notify_die from nmi.c to traps.c
[RFC] nmi_watchdog: new implementation using perf events
[RFC] nmi_watchdog: config option to enable new nmi_watchdog

arch/x86/kernel/apic/Makefile | 7 ++-
arch/x86/kernel/apic/hw_nmi.c | 114 ++++++++++++++++++++++++
arch/x86/kernel/apic/nmi.c | 7 --
arch/x86/kernel/traps.c | 7 ++
include/linux/nmi.h | 4 +
kernel/Makefile | 1 +
kernel/nmi_watchdog.c | 196 +++++++++++++++++++++++++++++++++++++++++
lib/Kconfig.debug | 13 +++
8 files changed, 341 insertions(+), 8 deletions(-)
create mode 100644 arch/x86/kernel/apic/hw_nmi.c
create mode 100644 kernel/nmi_watchdog.c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 2 of 3 ==
Date: Fri, Feb 5 2010 6:50 pm
From: Don Zickus


In order to handle a new nmi_watchdog approach, I need to move the notify_die()
routine out of nmi_watchdog_tick() and into default_do_nmi(). This lets me easily
swap out the old nmi_watchdog with the new one with just a config change.

The change probably makes sense from a high level perspective because the
nmi_watchdog shouldn't be handling notify_die routines anyway. However, this
move does change the semantics a little bit. Instead of checking on every nmi
interrupt if the cpus are stuck, only check them on the nmi_watchdog interrupts.

v2: move notify_die call into #idef block

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
arch/x86/kernel/apic/nmi.c | 7 -------
arch/x86/kernel/traps.c | 5 +++++
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index 0159a69..5d47682 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -400,13 +400,6 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
int cpu = smp_processor_id();
int rc = 0;

- /* check for other users first */
- if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
- == NOTIFY_STOP) {
- rc = 1;
- touched = 1;
- }
-
sum = get_timer_irqs(cpu);

if (__get_cpu_var(nmi_touch)) {
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 3339917..3be4687 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -400,7 +400,12 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT)
== NOTIFY_STOP)
return;
+
#ifdef CONFIG_X86_LOCAL_APIC
+ if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
+ == NOTIFY_STOP)
+ return;
+
/*
* Ok, so this is none of the documented NMI sources,
* so it must be the NMI watchdog.
--
1.6.6.83.gc9a2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 3 of 3 ==
Date: Fri, Feb 5 2010 6:50 pm
From: Don Zickus


This is a new generic nmi_watchdog implementation using the perf events
infrastructure as suggested by Ingo.

The implementation is simple, just create an in-kernel perf event and register
an overflow handler to check for cpu lockups. I created a generic implementation
that lives in kernel/ and the hardware specific part that for now lives in arch/x86.

I have done light testing to make sure the framework works correctly and it does.

v2: sets the correct timeout values based on the old nmi watchdog

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
arch/x86/kernel/apic/hw_nmi.c | 114 ++++++++++++++++++++++++
kernel/nmi_watchdog.c | 191 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 305 insertions(+), 0 deletions(-)
create mode 100644 arch/x86/kernel/apic/hw_nmi.c
create mode 100644 kernel/nmi_watchdog.c

diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
new file mode 100644
index 0000000..8c0e6a4
--- /dev/null
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -0,0 +1,114 @@
+/*
+ * HW NMI watchdog support
+ *
+ * started by Don Zickus, Copyright (C) 2010 Red Hat, Inc.
+ *
+ * Arch specific calls to support NMI watchdog
+ *
+ * Bits copied from original nmi.c file
+ *
+ */
+
+#include <asm/apic.h>
+#include <linux/smp.h>
+#include <linux/cpumask.h>
+#include <linux/sched.h>
+#include <linux/percpu.h>
+#include <linux/cpumask.h>
+#include <linux/kernel_stat.h>
+#include <asm/mce.h>
+
+#include <linux/nmi.h>
+#include <linux/module.h>
+
+/* For reliability, we're prepared to waste bits here. */
+static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
+
+static DEFINE_PER_CPU(unsigned, last_irq_sum);
+
+/*
+ * Take the local apic timer and PIT/HPET into account. We don't
+ * know which one is active, when we have highres/dyntick on
+ */
+static inline unsigned int get_timer_irqs(int cpu)
+{
+ return per_cpu(irq_stat, cpu).apic_timer_irqs +
+ per_cpu(irq_stat, cpu).irq0_irqs;
+}
+
+static inline int mce_in_progress(void)
+{
+#if defined(CONFIG_X86_MCE)
+ return atomic_read(&mce_entry) > 0;
+

No comments:

Post a Comment