From: Don Zickus <dzickus@redhat.com>
To: <x86@kernel.org>, Andi Kleen <andi@firstfloor.org>,
Robert Richter <robert.richter@amd.com>,
Peter Zijlstra <peterz@infradead.org>,
ying.huang@intel.com
Cc: LKML <linux-kernel@vger.kernel.org>,
paulmck@linux.vnet.ibm.com, avi@redhat.com, jeremy@goop.org,
Don Zickus <dzickus@redhat.com>
Subject: [V7][PATCH 6/6] x86, nmi: print out NMI stats in /proc/interrupts
Date: Fri, 30 Sep 2011 15:06:24 -0400 [thread overview]
Message-ID: <1317409584-23662-7-git-send-email-dzickus@redhat.com> (raw)
In-Reply-To: <1317409584-23662-1-git-send-email-dzickus@redhat.com>
This is a cheap hack to add the stats to the middle of /proc/interrupts.
It is more of a conversation starter than anything as I am not sure
the right letters and place to put this stuff.
The benefit of these stats is a better breakdown of which list the NMIs
get handled in either a normal handler, unknown, or external. It also
list the number of unknown NMIs swallowed to help check for false
positives or not. Another benefit is the ability to actually see which
NMI handlers are currently registered in the system.
The output of 'cat /proc/interrupts/ will look like this:
<snip>
58: 275 0 864 0 PCI-MSI-edge eth0
NMI: 4161 4155 158 4194 Non-maskable interrupts
SWA: 0 0 0 0 Unknown NMIs swallowed
0: 4161 4155 158 4194 NMI PMI, arch_bt
UNK: 0 0 0 0 NMI
EXT: 0 0 0 0 NMI
LOC: 12653 13304 13974 12926 Local timer interrupts
SPU: 0 0 0 0 Spurious interrupts
PMI: 6 6 5 6 Performance monitoring interrupts
IWI: 0 0 0 0 IRQ work interrupts
RES: 1839 1897 1821 1854 Rescheduling interrupts
CAL: 524 2714 392 331 Function call interrupts
TLB: 217 146 593 576 TLB shootdowns
TRM: 0 0 0 0 Thermal event interrupts
THR: 0 0 0 0 Threshold APIC interrupts
MCE: 0 0 0 0 Machine check exceptions
MCP: 1 1 1 1 Machine check polls
ERR: 0
MIS: 0
V2:
- convert to list_for_each_rcu
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
arch/x86/include/asm/nmi.h | 2 ++
arch/x86/kernel/irq.c | 2 ++
arch/x86/kernel/nmi.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index fd3f9f1..af5fa3b 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -24,6 +24,8 @@ void arch_trigger_all_cpu_backtrace(void);
#define NMI_FLAG_FIRST 1
+void arch_show_nmi(struct seq_file *p, int prec);
+
enum {
NMI_LOCAL=0,
NMI_UNKNOWN,
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 6c0802e..44d1cac 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -16,6 +16,7 @@
#include <asm/idle.h>
#include <asm/mce.h>
#include <asm/hw_irq.h>
+#include <asm/nmi.h>
atomic_t irq_err_count;
@@ -55,6 +56,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
for_each_online_cpu(j)
seq_printf(p, "%10u ", irq_stats(j)->__nmi_count);
seq_printf(p, " Non-maskable interrupts\n");
+ arch_show_nmi(p, prec);
#ifdef CONFIG_X86_LOCAL_APIC
seq_printf(p, "%*s: ", prec, "LOC");
for_each_online_cpu(j)
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 36b16fa..c946a99 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -429,3 +429,36 @@ void local_touch_nmi(void)
{
__this_cpu_write(last_nmi_rip, 0);
}
+
+void arch_show_nmi(struct seq_file *p, int prec)
+{
+ int j;
+ struct nmiaction *action;
+
+ seq_printf(p, "%*s: ", prec, "SWA");
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", per_cpu(nmi_stats.swallow, j));
+ seq_printf(p, " Unknown NMIs swallowed\n");
+
+ seq_printf(p, "%*s: ", prec, " 0");
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", per_cpu(nmi_stats.normal, j));
+ seq_printf(p, " NMI\t");
+ list_for_each_entry_rcu(action, &(nmi_to_desc(NMI_LOCAL))->head, list)
+ seq_printf(p, "%s, ", action->name);
+ seq_putc(p, '\n');
+
+ seq_printf(p, "%*s: ", prec, "UNK");
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", per_cpu(nmi_stats.unknown, j));
+ seq_printf(p, " NMI\t");
+ list_for_each_entry_rcu(action, &(nmi_to_desc(NMI_UNKNOWN))->head, list)
+ seq_printf(p, "%s, ", action->name);
+ seq_putc(p, '\n');
+
+ seq_printf(p, "%*s: ", prec, "EXT");
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", per_cpu(nmi_stats.external, j));
+ seq_printf(p, " NMI");
+ seq_putc(p, '\n');
+}
--
1.7.6
next prev parent reply other threads:[~2011-09-30 19:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-30 19:06 [V7][PATCH 0/6] x86, nmi: new NMI handling routines Don Zickus
2011-09-30 19:06 ` [V7][PATCH 1/6] x86, nmi: split out nmi from traps.c Don Zickus
2011-09-30 19:06 ` [V7][PATCH 2/6] x86, nmi: create new NMI handler routines Don Zickus
2011-09-30 19:06 ` [V7][PATCH 3/6] x86, nmi: wire up NMI handlers to new routines Don Zickus
2011-09-30 19:06 ` [V7][PATCH 4/6] x86, nmi: add in logic to handle multiple events and unknown NMIs Don Zickus
2011-09-30 19:06 ` [V7][PATCH 5/6] x86, nmi: track NMI usage stats Don Zickus
2011-09-30 19:06 ` Don Zickus [this message]
2011-10-03 15:47 ` [V7][PATCH 0/6] x86, nmi: new NMI handling routines Peter Zijlstra
2011-10-03 15:52 ` Peter Zijlstra
2011-10-03 15:56 ` Don Zickus
2011-10-03 15:59 ` Peter Zijlstra
2011-10-04 15:05 ` Robert Richter
2011-10-04 16:43 ` Peter Zijlstra
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=1317409584-23662-7-git-send-email-dzickus@redhat.com \
--to=dzickus@redhat.com \
--cc=andi@firstfloor.org \
--cc=avi@redhat.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=x86@kernel.org \
--cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.