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
Subject: Re: [V4][PATCH 6/6] x86, nmi: print out NMI stats in /proc/interrupts
Date: Thu, 15 Sep 2011 10:47:26 -0400 [thread overview]
Message-ID: <20110915144726.GA5795@redhat.com> (raw)
In-Reply-To: <1315947509-6429-7-git-send-email-dzickus@redhat.com>
On Tue, Sep 13, 2011 at 04:58:29PM -0400, Don Zickus wrote:
> 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.
I wanted to trying modifying this patch to add a /proc/nmi instead.
In there I was thinking about putting per-NMI-handler stats. However, I
don't know how to dynamically allocate per-cpu memory (basically every
time someone registers a handler, allocate a per-cpu chunk to track its
stats). Is this overkill? Anyone have any ideas on how to do that?
Cheers,
Don
>
> 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
>
> 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 | 47 ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 51 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
> index fc74547..a4f1945 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 326886c..bfcb4b8 100644
> --- a/arch/x86/kernel/nmi.c
> +++ b/arch/x86/kernel/nmi.c
> @@ -424,3 +424,50 @@ void restart_nmi(void)
> {
> ignore_nmis--;
> }
> +
> +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");
> + action = (nmi_to_desc(NMI_LOCAL))->head;
> + if (action) {
> + seq_printf(p, "\t%s", action->name);
> + while ((action = action->next) != NULL)
> + 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");
> + action = (nmi_to_desc(NMI_UNKNOWN))->head;
> + if (action) {
> + seq_printf(p, "\t%s", action->name);
> + while ((action = action->next) != NULL)
> + 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");
> + action = (nmi_to_desc(NMI_EXTERNAL))->head;
> + if (action) {
> + seq_printf(p, "\t%s", action->name);
> + while ((action = action->next) != NULL)
> + seq_printf(p, ", %s", action->name);
> + }
> + seq_putc(p, '\n');
> +}
> --
> 1.7.6
>
prev parent reply other threads:[~2011-09-15 14:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 20:58 [V4][PATCH 0/6] x86, nmi: new NMI handling routines Don Zickus
2011-09-13 20:58 ` [V4][PATCH 1/6] x86, nmi: split out nmi from traps.c Don Zickus
2011-09-13 20:58 ` [V4][PATCH 2/6] x86, nmi: create new NMI handler routines Don Zickus
2011-09-13 20:58 ` [V4][PATCH 3/6] x86, nmi: wire up NMI handlers to new routines Don Zickus
2011-09-13 22:49 ` Corey Minyard
2011-09-13 20:58 ` [V4][PATCH 4/6] x86, nmi: add in logic to handle multiple events and unknown NMIs Don Zickus
2011-09-14 7:08 ` Avi Kivity
2011-09-14 13:00 ` Don Zickus
2011-09-14 13:22 ` Avi Kivity
2011-09-14 15:03 ` Don Zickus
2011-09-14 12:56 ` Don Zickus
2011-09-14 20:20 ` Robert Richter
2011-09-14 16:26 ` Robert Richter
2011-09-14 17:58 ` Don Zickus
2011-09-14 20:16 ` Robert Richter
2011-09-14 20:44 ` Don Zickus
2011-09-15 16:55 ` Robert Richter
2011-09-13 20:58 ` [V4][PATCH 5/6] x86, nmi: track NMI usage stats Don Zickus
2011-09-13 20:58 ` [V4][PATCH 6/6] x86, nmi: print out NMI stats in /proc/interrupts Don Zickus
2011-09-15 14:47 ` Don Zickus [this message]
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=20110915144726.GA5795@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox