aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/irq_64.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-10-16 05:15:28 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:53:29 -0400
commitc0c168ca26b54a4a6ad34fc813fe00f275fbc94c (patch)
treec1137f8e540c092297d470de5a02b6452519e66b /arch/x86/kernel/irq_64.c
parentd3c60047bdb03199b93497ac40bd531315d43a86 (diff)
x86: cleanup show_interrupts
The sparseirq patches introduced some more ugliness in show_interrupts(). Clean it up all together and make the code easier to read by splitting out the "tail" function which prints the special interrupts. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/irq_64.c')
-rw-r--r--arch/x86/kernel/irq_64.c153
1 files changed, 77 insertions, 76 deletions
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 21f53b911113..4f374294f292 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -68,22 +68,65 @@ static inline void stack_overflow_check(struct pt_regs *regs)
68 * Generic, controller-independent functions: 68 * Generic, controller-independent functions:
69 */ 69 */
70 70
71static int show_other_interrupts(struct seq_file *p)
72{
73 int j;
74
75 seq_printf(p, "NMI: ");
76 for_each_online_cpu(j)
77 seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
78 seq_printf(p, " Non-maskable interrupts\n");
79 seq_printf(p, "LOC: ");
80 for_each_online_cpu(j)
81 seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
82 seq_printf(p, " Local timer interrupts\n");
83#ifdef CONFIG_SMP
84 seq_printf(p, "RES: ");
85 for_each_online_cpu(j)
86 seq_printf(p, "%10u ", cpu_pda(j)->irq_resched_count);
87 seq_printf(p, " Rescheduling interrupts\n");
88 seq_printf(p, "CAL: ");
89 for_each_online_cpu(j)
90 seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count);
91 seq_printf(p, " Function call interrupts\n");
92 seq_printf(p, "TLB: ");
93 for_each_online_cpu(j)
94 seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count);
95 seq_printf(p, " TLB shootdowns\n");
96#endif
97#ifdef CONFIG_X86_MCE
98 seq_printf(p, "TRM: ");
99 for_each_online_cpu(j)
100 seq_printf(p, "%10u ", cpu_pda(j)->irq_thermal_count);
101 seq_printf(p, " Thermal event interrupts\n");
102 seq_printf(p, "THR: ");
103 for_each_online_cpu(j)
104 seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count);
105 seq_printf(p, " Threshold APIC interrupts\n");
106#endif
107 seq_printf(p, "SPU: ");
108 for_each_online_cpu(j)
109 seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count);
110 seq_printf(p, " Spurious interrupts\n");
111 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
112
113 return 0;
114}
115
71int show_interrupts(struct seq_file *p, void *v) 116int show_interrupts(struct seq_file *p, void *v)
72{ 117{
73 int i, j; 118 unsigned long flags, any_count = 0;
74 struct irqaction * action; 119 int i = *(loff_t *) v, j;
75 unsigned long flags; 120 struct irqaction *action;
76 unsigned int entries; 121 struct irq_desc *desc;
77 struct irq_desc *desc = NULL; 122
78 int tail = 0; 123 if (i > nr_irqs)
79 124 return 0;
80 entries = nr_irqs - 1; 125
81 i = *(loff_t *) v;
82 if (i == nr_irqs) 126 if (i == nr_irqs)
83 tail = 1; 127 return show_other_interrupts(p);
84 else
85 desc = irq_to_desc(i);
86 128
129 /* print header */
87 if (i == 0) { 130 if (i == 0) {
88 seq_printf(p, " "); 131 seq_printf(p, " ");
89 for_each_online_cpu(j) 132 for_each_online_cpu(j)
@@ -91,79 +134,37 @@ int show_interrupts(struct seq_file *p, void *v)
91 seq_putc(p, '\n'); 134 seq_putc(p, '\n');
92 } 135 }
93 136
94 if (i <= entries) { 137 desc = irq_to_desc(i);
95 unsigned any_count = 0; 138 spin_lock_irqsave(&desc->lock, flags);
96
97 spin_lock_irqsave(&desc->lock, flags);
98#ifndef CONFIG_SMP 139#ifndef CONFIG_SMP
99 any_count = kstat_irqs(i); 140 any_count = kstat_irqs(i);
100#else 141#else
101 for_each_online_cpu(j) 142 for_each_online_cpu(j)
102 any_count |= kstat_irqs_cpu(i, j); 143 any_count |= kstat_irqs_cpu(i, j);
103#endif 144#endif
104 action = desc->action; 145 action = desc->action;
105 if (!action && !any_count) 146 if (!action && !any_count)
106 goto skip; 147 goto out;
107 seq_printf(p, "%3d: ", i); 148
149 seq_printf(p, "%3d: ", i);
108#ifndef CONFIG_SMP 150#ifndef CONFIG_SMP
109 seq_printf(p, "%10u ", kstat_irqs(i)); 151 seq_printf(p, "%10u ", kstat_irqs(i));
110#else 152#else
111 for_each_online_cpu(j) 153 for_each_online_cpu(j)
112 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 154 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
113#endif 155#endif
114 seq_printf(p, " %8s", desc->chip->name); 156 seq_printf(p, " %8s", desc->chip->name);
115 seq_printf(p, "-%-8s", desc->name); 157 seq_printf(p, "-%-8s", desc->name);
116 158
117 if (action) { 159 if (action) {
118 seq_printf(p, " %s", action->name); 160 seq_printf(p, " %s", action->name);
119 while ((action = action->next) != NULL) 161 while ((action = action->next) != NULL)
120 seq_printf(p, ", %s", action->name); 162 seq_printf(p, ", %s", action->name);
121 }
122 seq_putc(p, '\n');
123skip:
124 spin_unlock_irqrestore(&desc->lock, flags);
125 }
126
127 if (tail) {
128 seq_printf(p, "NMI: ");
129 for_each_online_cpu(j)
130 seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
131 seq_printf(p, " Non-maskable interrupts\n");
132 seq_printf(p, "LOC: ");
133 for_each_online_cpu(j)
134 seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
135 seq_printf(p, " Local timer interrupts\n");
136#ifdef CONFIG_SMP
137 seq_printf(p, "RES: ");
138 for_each_online_cpu(j)
139 seq_printf(p, "%10u ", cpu_pda(j)->irq_resched_count);
140 seq_printf(p, " Rescheduling interrupts\n");
141 seq_printf(p, "CAL: ");
142 for_each_online_cpu(j)
143 seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count);
144 seq_printf(p, " Function call interrupts\n");
145 seq_printf(p, "TLB: ");
146 for_each_online_cpu(j)
147 seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count);
148 seq_printf(p, " TLB shootdowns\n");
149#endif
150#ifdef CONFIG_X86_MCE
151 seq_printf(p, "TRM: ");
152 for_each_online_cpu(j)
153 seq_printf(p, "%10u ", cpu_pda(j)->irq_thermal_count);
154 seq_printf(p, " Thermal event interrupts\n");
155 seq_printf(p, "THR: ");
156 for_each_online_cpu(j)
157 seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count);
158 seq_printf(p, " Threshold APIC interrupts\n");
159#endif
160 seq_printf(p, "SPU: ");
161 for_each_online_cpu(j)
162 seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count);
163 seq_printf(p, " Spurious interrupts\n");
164 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
165 } 163 }
166 164
165 seq_putc(p, '\n');
166out:
167 spin_unlock_irqrestore(&desc->lock, flags);
167 return 0; 168 return 0;
168} 169}
169 170