diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-10-16 05:15:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:53:29 -0400 |
commit | c0c168ca26b54a4a6ad34fc813fe00f275fbc94c (patch) | |
tree | c1137f8e540c092297d470de5a02b6452519e66b /arch | |
parent | d3c60047bdb03199b93497ac40bd531315d43a86 (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')
-rw-r--r-- | arch/x86/kernel/irq_32.c | 160 | ||||
-rw-r--r-- | arch/x86/kernel/irq_64.c | 153 |
2 files changed, 154 insertions, 159 deletions
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index ccf6c1bf7120..8d525765a6c4 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -263,22 +263,67 @@ atomic_t irq_err_count; | |||
263 | * /proc/interrupts printing: | 263 | * /proc/interrupts printing: |
264 | */ | 264 | */ |
265 | 265 | ||
266 | static int show_other_interrupts(struct seq_file *p) | ||
267 | { | ||
268 | int j; | ||
269 | |||
270 | seq_printf(p, "NMI: "); | ||
271 | for_each_online_cpu(j) | ||
272 | seq_printf(p, "%10u ", nmi_count(j)); | ||
273 | seq_printf(p, " Non-maskable interrupts\n"); | ||
274 | #ifdef CONFIG_X86_LOCAL_APIC | ||
275 | seq_printf(p, "LOC: "); | ||
276 | for_each_online_cpu(j) | ||
277 | seq_printf(p, "%10u ", per_cpu(irq_stat,j).apic_timer_irqs); | ||
278 | seq_printf(p, " Local timer interrupts\n"); | ||
279 | #endif | ||
280 | #ifdef CONFIG_SMP | ||
281 | seq_printf(p, "RES: "); | ||
282 | for_each_online_cpu(j) | ||
283 | seq_printf(p, "%10u ", per_cpu(irq_stat,j).irq_resched_count); | ||
284 | seq_printf(p, " Rescheduling interrupts\n"); | ||
285 | seq_printf(p, "CAL: "); | ||
286 | for_each_online_cpu(j) | ||
287 | seq_printf(p, "%10u ", per_cpu(irq_stat,j).irq_call_count); | ||
288 | seq_printf(p, " Function call interrupts\n"); | ||
289 | seq_printf(p, "TLB: "); | ||
290 | for_each_online_cpu(j) | ||
291 | seq_printf(p, "%10u ", per_cpu(irq_stat,j).irq_tlb_count); | ||
292 | seq_printf(p, " TLB shootdowns\n"); | ||
293 | #endif | ||
294 | #ifdef CONFIG_X86_MCE | ||
295 | seq_printf(p, "TRM: "); | ||
296 | for_each_online_cpu(j) | ||
297 | seq_printf(p, "%10u ", per_cpu(irq_stat,j).irq_thermal_count); | ||
298 | seq_printf(p, " Thermal event interrupts\n"); | ||
299 | #endif | ||
300 | #ifdef CONFIG_X86_LOCAL_APIC | ||
301 | seq_printf(p, "SPU: "); | ||
302 | for_each_online_cpu(j) | ||
303 | seq_printf(p, "%10u ", per_cpu(irq_stat,j).irq_spurious_count); | ||
304 | seq_printf(p, " Spurious interrupts\n"); | ||
305 | #endif | ||
306 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | ||
307 | #if defined(CONFIG_X86_IO_APIC) | ||
308 | seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); | ||
309 | #endif | ||
310 | return 0; | ||
311 | } | ||
312 | |||
266 | int show_interrupts(struct seq_file *p, void *v) | 313 | int show_interrupts(struct seq_file *p, void *v) |
267 | { | 314 | { |
315 | unsigned long flags, any_count = 0; | ||
268 | int i = *(loff_t *) v, j; | 316 | int i = *(loff_t *) v, j; |
269 | struct irqaction * action; | 317 | struct irqaction *action; |
270 | unsigned long flags; | 318 | struct irq_desc *desc; |
271 | unsigned int entries; | 319 | |
272 | struct irq_desc *desc = NULL; | 320 | if (i > nr_irqs) |
273 | int tail = 0; | 321 | return 0; |
274 | 322 | ||
275 | entries = nr_irqs - 1; | ||
276 | i = *(loff_t *) v; | ||
277 | if (i == nr_irqs) | 323 | if (i == nr_irqs) |
278 | tail = 1; | 324 | return show_other_interrupts(p); |
279 | else | ||
280 | desc = irq_to_desc(i); | ||
281 | 325 | ||
326 | /* print header */ | ||
282 | if (i == 0) { | 327 | if (i == 0) { |
283 | seq_printf(p, " "); | 328 | seq_printf(p, " "); |
284 | for_each_online_cpu(j) | 329 | for_each_online_cpu(j) |
@@ -286,88 +331,37 @@ int show_interrupts(struct seq_file *p, void *v) | |||
286 | seq_putc(p, '\n'); | 331 | seq_putc(p, '\n'); |
287 | } | 332 | } |
288 | 333 | ||
289 | if (i <= entries) { | 334 | desc = irq_to_desc(i); |
290 | unsigned any_count = 0; | 335 | spin_lock_irqsave(&desc->lock, flags); |
291 | |||
292 | spin_lock_irqsave(&desc->lock, flags); | ||
293 | #ifndef CONFIG_SMP | 336 | #ifndef CONFIG_SMP |
294 | any_count = kstat_irqs(i); | 337 | any_count = kstat_irqs(i); |
295 | #else | 338 | #else |
296 | for_each_online_cpu(j) | 339 | for_each_online_cpu(j) |
297 | any_count |= kstat_irqs_cpu(i, j); | 340 | any_count |= kstat_irqs_cpu(i, j); |
298 | #endif | 341 | #endif |
299 | action = desc->action; | 342 | action = desc->action; |
300 | if (!action && !any_count) | 343 | if (!action && !any_count) |
301 | goto skip; | 344 | goto out; |
302 | seq_printf(p, "%3d: ", i); | 345 | |
346 | seq_printf(p, "%3d: ", i); | ||
303 | #ifndef CONFIG_SMP | 347 | #ifndef CONFIG_SMP |
304 | seq_printf(p, "%10u ", kstat_irqs(i)); | 348 | seq_printf(p, "%10u ", kstat_irqs(i)); |
305 | #else | 349 | #else |
306 | for_each_online_cpu(j) | 350 | for_each_online_cpu(j) |
307 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); | 351 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); |
308 | #endif | 352 | #endif |
309 | seq_printf(p, " %8s", desc->chip->name); | 353 | seq_printf(p, " %8s", desc->chip->name); |
310 | seq_printf(p, "-%-8s", desc->name); | 354 | seq_printf(p, "-%-8s", desc->name); |
311 | |||
312 | if (action) { | ||
313 | seq_printf(p, " %s", action->name); | ||
314 | while ((action = action->next) != NULL) | ||
315 | seq_printf(p, ", %s", action->name); | ||
316 | } | ||
317 | 355 | ||
318 | seq_putc(p, '\n'); | 356 | if (action) { |
319 | skip: | 357 | seq_printf(p, " %s", action->name); |
320 | spin_unlock_irqrestore(&desc->lock, flags); | 358 | while ((action = action->next) != NULL) |
359 | seq_printf(p, ", %s", action->name); | ||
321 | } | 360 | } |
322 | 361 | ||
323 | if (tail) { | 362 | seq_putc(p, '\n'); |
324 | seq_printf(p, "NMI: "); | 363 | out: |
325 | for_each_online_cpu(j) | 364 | spin_unlock_irqrestore(&desc->lock, flags); |
326 | seq_printf(p, "%10u ", nmi_count(j)); | ||
327 | seq_printf(p, " Non-maskable interrupts\n"); | ||
328 | #ifdef CONFIG_X86_LOCAL_APIC | ||
329 | seq_printf(p, "LOC: "); | ||
330 | for_each_online_cpu(j) | ||
331 | seq_printf(p, "%10u ", | ||
332 | per_cpu(irq_stat,j).apic_timer_irqs); | ||
333 | seq_printf(p, " Local timer interrupts\n"); | ||
334 | #endif | ||
335 | #ifdef CONFIG_SMP | ||
336 | seq_printf(p, "RES: "); | ||
337 | for_each_online_cpu(j) | ||
338 | seq_printf(p, "%10u ", | ||
339 | per_cpu(irq_stat,j).irq_resched_count); | ||
340 | seq_printf(p, " Rescheduling interrupts\n"); | ||
341 | seq_printf(p, "CAL: "); | ||
342 | for_each_online_cpu(j) | ||
343 | seq_printf(p, "%10u ", | ||
344 | per_cpu(irq_stat,j).irq_call_count); | ||
345 | seq_printf(p, " Function call interrupts\n"); | ||
346 | seq_printf(p, "TLB: "); | ||
347 | for_each_online_cpu(j) | ||
348 | seq_printf(p, "%10u ", | ||
349 | per_cpu(irq_stat,j).irq_tlb_count); | ||
350 | seq_printf(p, " TLB shootdowns\n"); | ||
351 | #endif | ||
352 | #ifdef CONFIG_X86_MCE | ||
353 | seq_printf(p, "TRM: "); | ||
354 | for_each_online_cpu(j) | ||
355 | seq_printf(p, "%10u ", | ||
356 | per_cpu(irq_stat,j).irq_thermal_count); | ||
357 | seq_printf(p, " Thermal event interrupts\n"); | ||
358 | #endif | ||
359 | #ifdef CONFIG_X86_LOCAL_APIC | ||
360 | seq_printf(p, "SPU: "); | ||
361 | for_each_online_cpu(j) | ||
362 | seq_printf(p, "%10u ", | ||
363 | per_cpu(irq_stat,j).irq_spurious_count); | ||
364 | seq_printf(p, " Spurious interrupts\n"); | ||
365 | #endif | ||
366 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | ||
367 | #if defined(CONFIG_X86_IO_APIC) | ||
368 | seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); | ||
369 | #endif | ||
370 | } | ||
371 | return 0; | 365 | return 0; |
372 | } | 366 | } |
373 | 367 | ||
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 | ||
71 | static 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 | |||
71 | int show_interrupts(struct seq_file *p, void *v) | 116 | int 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'); | ||
123 | skip: | ||
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'); | ||
166 | out: | ||
167 | spin_unlock_irqrestore(&desc->lock, flags); | ||
167 | return 0; | 168 | return 0; |
168 | } | 169 | } |
169 | 170 | ||