aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/irq_32.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_32.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_32.c')
-rw-r--r--arch/x86/kernel/irq_32.c160
1 files changed, 77 insertions, 83 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
266static 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
266int show_interrupts(struct seq_file *p, void *v) 313int 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) {
319skip: 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: "); 363out:
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