[S390] irq: have detailed statistics for interrupt types
Heiko Carstens [Wed, 5 Jan 2011 11:47:28 +0000 (12:47 +0100)]
Up to now /proc/interrupts only has statistics for external and i/o
interrupts but doesn't split up them any further.
This patch adds a line for every single interrupt source so that it
is possible to easier tell what the machine is/was doing.
Part of the output now looks like this;

           CPU0       CPU2       CPU4
EXT:       3898       4232       2305
I/O:        782        315        245
CLK:       1029       1964        727   [EXT] Clock Comparator
IPI:       2868       2267       1577   [EXT] Signal Processor
TMR:          0          0          0   [EXT] CPU Timer
TAL:          0          0          0   [EXT] Timing Alert
PFL:          0          0          0   [EXT] Pseudo Page Fault
[...]
NMI:          0          1          1   [NMI] Machine Checks

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

arch/s390/include/asm/irq.h
arch/s390/kernel/irq.c
arch/s390/kernel/nmi.c
arch/s390/kernel/smp.c
arch/s390/kernel/time.c
arch/s390/kernel/vtime.c
arch/s390/mm/fault.c
drivers/s390/block/dasd_diag.c
drivers/s390/char/sclp.c
drivers/s390/kvm/kvm_virtio.c
net/iucv/iucv.c

index 7da991a..f65faf6 100644 (file)
@@ -1,23 +1,22 @@
 #ifndef _ASM_IRQ_H
 #define _ASM_IRQ_H
 
-#ifdef __KERNEL__
 #include <linux/hardirq.h>
 
-/*
- * the definition of irqs has changed in 2.5.46:
- * NR_IRQS is no longer the number of i/o
- * interrupts (65536), but rather the number
- * of interrupt classes (2).
- * Only external and i/o interrupts make much sense here (CH).
- */
-
 enum interruption_class {
        EXTERNAL_INTERRUPT,
        IO_INTERRUPT,
-
+       EXTINT_CLK,
+       EXTINT_IPI,
+       EXTINT_TMR,
+       EXTINT_TLA,
+       EXTINT_PFL,
+       EXTINT_DSD,
+       EXTINT_VRT,
+       EXTINT_SCP,
+       EXTINT_IUC,
+       NMI_NMI,
        NR_IRQS,
 };
 
-#endif /* __KERNEL__ */
-#endif
+#endif /* _ASM_IRQ_H */
index 026a37a..9bd049b 100644 (file)
@@ -1,7 +1,5 @@
 /*
- *  arch/s390/kernel/irq.c
- *
- *    Copyright IBM Corp. 2004,2007
+ *    Copyright IBM Corp. 2004,2010
  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  *              Thomas Spatzier (tspat@de.ibm.com)
  *
 #include <linux/proc_fs.h>
 #include <linux/profile.h>
 
+struct irq_class {
+       char *name;
+       char *desc;
+};
+
+static const struct irq_class intrclass_names[] = {
+       {.name = "EXT" },
+       {.name = "I/O" },
+       {.name = "CLK", .desc = "[EXT] Clock Comparator" },
+       {.name = "IPI", .desc = "[EXT] Signal Processor" },
+       {.name = "TMR", .desc = "[EXT] CPU Timer" },
+       {.name = "TAL", .desc = "[EXT] Timing Alert" },
+       {.name = "PFL", .desc = "[EXT] Pseudo Page Fault" },
+       {.name = "DSD", .desc = "[EXT] DASD Diag" },
+       {.name = "VRT", .desc = "[EXT] Virtio" },
+       {.name = "SCP", .desc = "[EXT] Service Call" },
+       {.name = "IUC", .desc = "[EXT] IUCV" },
+       {.name = "NMI", .desc = "[NMI] Machine Check" },
+};
+
 /*
  * show_interrupts is needed by /proc/interrupts.
  */
 int show_interrupts(struct seq_file *p, void *v)
 {
-       static const char *intrclass_names[] = { "EXT", "I/O", };
        int i = *(loff_t *) v, j;
 
        get_online_cpus();
@@ -34,15 +51,16 @@ int show_interrupts(struct seq_file *p, void *v)
        }
 
        if (i < NR_IRQS) {
-               seq_printf(p, "%s: ", intrclass_names[i]);
+               seq_printf(p, "%s: ", intrclass_names[i].name);
 #ifndef CONFIG_SMP
                seq_printf(p, "%10u ", kstat_irqs(i));
 #else
                for_each_online_cpu(j)
                        seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
 #endif
+               if (intrclass_names[i].desc)
+                       seq_printf(p, "  %s", intrclass_names[i].desc);
                 seq_putc(p, '\n');
-
         }
        put_online_cpus();
         return 0;
index 1995c17..fab8843 100644 (file)
@@ -8,6 +8,7 @@
  *              Heiko Carstens <heiko.carstens@de.ibm.com>,
  */
 
+#include <linux/kernel_stat.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/hardirq.h>
@@ -255,7 +256,7 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
        nmi_enter();
        s390_idle_check(regs, S390_lowcore.mcck_clock,
                        S390_lowcore.mcck_enter_timer);
-
+       kstat_cpu(smp_processor_id()).irqs[NMI_NMI]++;
        mci = (struct mci *) &S390_lowcore.mcck_interruption_code;
        mcck = &__get_cpu_var(cpu_mcck);
        umode = user_mode(regs);
index 94cf510..a9702df 100644 (file)
@@ -161,6 +161,7 @@ static void do_ext_call_interrupt(unsigned int ext_int_code,
 {
        unsigned long bits;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_IPI]++;
        /*
         * handle bit signal external calls
         *
index 4c9d72d..9e7b039 100644 (file)
@@ -15,6 +15,7 @@
 #define KMSG_COMPONENT "time"
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
+#include <linux/kernel_stat.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -160,6 +161,7 @@ static void clock_comparator_interrupt(unsigned int ext_int_code,
                                       unsigned int param32,
                                       unsigned long param64)
 {
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_CLK]++;
        if (S390_lowcore.clock_comparator == -1ULL)
                set_clock_comparator(S390_lowcore.clock_comparator);
 }
@@ -170,6 +172,7 @@ static void stp_timing_alert(struct stp_irq_parm *);
 static void timing_alert_interrupt(unsigned int ext_int_code,
                                   unsigned int param32, unsigned long param64)
 {
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_TLA]++;
        if (param32 & 0x00c40000)
                etr_timing_alert((struct etr_irq_parm *) &param32);
        if (param32 & 0x00038000)
index 8636dd0..1ccdf4d 100644 (file)
@@ -324,6 +324,7 @@ static void do_cpu_timer_interrupt(unsigned int ext_int_code,
        struct list_head cb_list;       /* the callback queue */
        __u64 elapsed, next;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_TMR]++;
        INIT_LIST_HEAD(&cb_list);
        vq = &__get_cpu_var(virt_cpu_timer);
 
index fe5701e..839b16d 100644 (file)
@@ -10,6 +10,7 @@
  *    Copyright (C) 1995  Linus Torvalds
  */
 
+#include <linux/kernel_stat.h>
 #include <linux/perf_event.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
@@ -543,6 +544,7 @@ static void pfault_interrupt(unsigned int ext_int_code,
        struct task_struct *tsk;
        __u16 subcode;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++;
        /*
         * Get the external interruption subcode & pfault
         * initial/completion signal bit. VM stores this 
index 266b34b..a3a5db5 100644 (file)
@@ -10,6 +10,7 @@
 
 #define KMSG_COMPONENT "dasd"
 
+#include <linux/kernel_stat.h>
 #include <linux/stddef.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -238,6 +239,7 @@ static void dasd_ext_handler(unsigned int ext_int_code,
        addr_t ip;
        int rc;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++;
        switch (ext_int_code >> 24) {
        case DASD_DIAG_CODE_31BIT:
                ip = (addr_t) param32;
index 35cc468..e65572e 100644 (file)
@@ -7,6 +7,7 @@
  *           Martin Schwidefsky <schwidefsky@de.ibm.com>
  */
 
+#include <linux/kernel_stat.h>
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/spinlock.h>
@@ -18,8 +19,9 @@
 #include <linux/suspend.h>
 #include <linux/completion.h>
 #include <linux/platform_device.h>
-#include <asm/types.h>
 #include <asm/s390_ext.h>
+#include <asm/types.h>
+#include <asm/irq.h>
 
 #include "sclp.h"
 
@@ -402,6 +404,7 @@ static void sclp_interrupt_handler(unsigned int ext_int_code,
        u32 finished_sccb;
        u32 evbuf_pending;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_SCP]++;
        spin_lock(&sclp_lock);
        finished_sccb = param32 & 0xfffffff8;
        evbuf_pending = param32 & 0x3;
@@ -824,6 +827,7 @@ static void sclp_check_handler(unsigned int ext_int_code,
 {
        u32 finished_sccb;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_SCP]++;
        finished_sccb = param32 & 0xfffffff8;
        /* Is this the interrupt we are waiting for? */
        if (finished_sccb == 0)
index 375aeea..414427d 100644 (file)
@@ -10,6 +10,7 @@
  *    Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
  */
 
+#include <linux/kernel_stat.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
 #include <linux/err.h>
@@ -25,6 +26,7 @@
 #include <asm/kvm_virtio.h>
 #include <asm/setup.h>
 #include <asm/s390_ext.h>
+#include <asm/irq.h>
 
 #define VIRTIO_SUBCODE_64 0x0D00
 
@@ -379,6 +381,7 @@ static void kvm_extint_handler(unsigned int ext_int_code,
        u16 subcode;
        u32 param;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++;
        subcode = ext_int_code >> 16;
        if ((subcode & 0xff00) != VIRTIO_SUBCODE_64)
                return;
index f7db676..1ee5dab 100644 (file)
@@ -36,6 +36,7 @@
 #define KMSG_COMPONENT "iucv"
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
+#include <linux/kernel_stat.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/spinlock.h>
@@ -1804,6 +1805,7 @@ static void iucv_external_interrupt(unsigned int ext_int_code,
        struct iucv_irq_data *p;
        struct iucv_irq_list *work;
 
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_IUC]++;
        p = iucv_irq_data[smp_processor_id()];
        if (p->ippathid >= iucv_max_pathid) {
                WARN_ON(p->ippathid >= iucv_max_pathid);