powerpc: Add irq accounting for watchdog interrupts
authorNicholas Piggin <npiggin@gmail.com>
Tue, 1 Aug 2017 12:00:54 +0000 (22:00 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 10 Aug 2017 12:30:02 +0000 (22:30 +1000)
This adds an irq counter for the watchdog soft-NMI. This interrupt
only fires when interrupts are soft-disabled, so it will not
increment much even when the watchdog is running. However it's
useful for debugging and sanity checking.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/hardirq.h
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/watchdog.c

index 64b73b03d473fd9c12831d425bc87b374beb94a5..c97603d617e366d1b55a9a780615f3ad3f68873c 100644 (file)
@@ -13,6 +13,9 @@ typedef struct {
        unsigned int spurious_irqs;
        unsigned int hmi_exceptions;
        unsigned int sreset_irqs;
+#ifdef CONFIG_PPC_WATCHDOG
+       unsigned int soft_nmi_irqs;
+#endif
 #ifdef CONFIG_PPC_DOORBELL
        unsigned int doorbell_irqs;
 #endif
index 5c18335580b60256205d4e267c0068f5e4af323b..77a7f75143272e3a496915218e55f5d3fb2442ff 100644 (file)
@@ -475,6 +475,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)
                seq_printf(p, "%10u ", per_cpu(irq_stat, j).sreset_irqs);
        seq_printf(p, "  System Reset interrupts\n");
 
+#ifdef CONFIG_PPC_WATCHDOG
+       seq_printf(p, "%*s: ", prec, "WDG");
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).soft_nmi_irqs);
+       seq_printf(p, "  Watchdog soft-NMI interrupts\n");
+#endif
+
 #ifdef CONFIG_PPC_DOORBELL
        if (cpu_has_feature(CPU_FTR_DBELL)) {
                seq_printf(p, "%*s: ", prec, "DBL");
@@ -500,6 +507,9 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
        sum += per_cpu(irq_stat, cpu).timer_irqs_others;
        sum += per_cpu(irq_stat, cpu).hmi_exceptions;
        sum += per_cpu(irq_stat, cpu).sreset_irqs;
+#ifdef CONFIG_PPC_WATCHDOG
+       sum += per_cpu(irq_stat, cpu).soft_nmi_irqs;
+#endif
 #ifdef CONFIG_PPC_DOORBELL
        sum += per_cpu(irq_stat, cpu).doorbell_irqs;
 #endif
index b67f8b03a32d0f12ce29eeb4ac3be0a97384fe72..4b9a567c997561c498f74ca3461460c8beaa4758 100644 (file)
@@ -204,6 +204,9 @@ void soft_nmi_interrupt(struct pt_regs *regs)
                return;
 
        nmi_enter();
+
+       __this_cpu_inc(irq_stat.soft_nmi_irqs);
+
        tb = get_tb();
        if (tb - per_cpu(wd_timer_tb, cpu) >= wd_panic_timeout_tb) {
                per_cpu(wd_timer_tb, cpu) = tb;