aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/irq.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2009-03-12 08:45:15 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-12 21:36:52 -0400
commit7a81d9a7da03d2f27840d659f97ef140d032f609 (patch)
tree02ccb690196a4b3f3dd7f4f5c7cae15ad32ece29 /arch/x86/kernel/irq.c
parent1f442d70c84aa798e243e721eba728a98434cd86 (diff)
x86: smarten /proc/interrupts output
Impact: change /proc/interrupts output ABI With the number of interrupts on large systems growing, assumptions on the width an interrupt number requires when converted to a decimal string turn invalid. Therefore, calculate the maximum number of digits dynamically. Signed-off-by: Jan Beulich <jbeulich@novell.com> LKML-Reference: <49B911EB.76E4.0078.0@novell.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/irq.c')
-rw-r--r--arch/x86/kernel/irq.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index b864341dcc45..b8ac3b6cf776 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -45,16 +45,16 @@ void ack_bad_irq(unsigned int irq)
45/* 45/*
46 * /proc/interrupts printing: 46 * /proc/interrupts printing:
47 */ 47 */
48static int show_other_interrupts(struct seq_file *p) 48static int show_other_interrupts(struct seq_file *p, int prec)
49{ 49{
50 int j; 50 int j;
51 51
52 seq_printf(p, "NMI: "); 52 seq_printf(p, "%*s: ", prec, "NMI");
53 for_each_online_cpu(j) 53 for_each_online_cpu(j)
54 seq_printf(p, "%10u ", irq_stats(j)->__nmi_count); 54 seq_printf(p, "%10u ", irq_stats(j)->__nmi_count);
55 seq_printf(p, " Non-maskable interrupts\n"); 55 seq_printf(p, " Non-maskable interrupts\n");
56#ifdef CONFIG_X86_LOCAL_APIC 56#ifdef CONFIG_X86_LOCAL_APIC
57 seq_printf(p, "LOC: "); 57 seq_printf(p, "%*s: ", prec, "LOC");
58 for_each_online_cpu(j) 58 for_each_online_cpu(j)
59 seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs); 59 seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs);
60 seq_printf(p, " Local timer interrupts\n"); 60 seq_printf(p, " Local timer interrupts\n");
@@ -66,40 +66,40 @@ static int show_other_interrupts(struct seq_file *p)
66 seq_printf(p, " Platform interrupts\n"); 66 seq_printf(p, " Platform interrupts\n");
67 } 67 }
68#ifdef CONFIG_SMP 68#ifdef CONFIG_SMP
69 seq_printf(p, "RES: "); 69 seq_printf(p, "%*s: ", prec, "RES");
70 for_each_online_cpu(j) 70 for_each_online_cpu(j)
71 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count); 71 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
72 seq_printf(p, " Rescheduling interrupts\n"); 72 seq_printf(p, " Rescheduling interrupts\n");
73 seq_printf(p, "CAL: "); 73 seq_printf(p, "%*s: ", prec, "CAL");
74 for_each_online_cpu(j) 74 for_each_online_cpu(j)
75 seq_printf(p, "%10u ", irq_stats(j)->irq_call_count); 75 seq_printf(p, "%10u ", irq_stats(j)->irq_call_count);
76 seq_printf(p, " Function call interrupts\n"); 76 seq_printf(p, " Function call interrupts\n");
77 seq_printf(p, "TLB: "); 77 seq_printf(p, "%*s: ", prec, "TLB");
78 for_each_online_cpu(j) 78 for_each_online_cpu(j)
79 seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count); 79 seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count);
80 seq_printf(p, " TLB shootdowns\n"); 80 seq_printf(p, " TLB shootdowns\n");
81#endif 81#endif
82#ifdef CONFIG_X86_MCE 82#ifdef CONFIG_X86_MCE
83 seq_printf(p, "TRM: "); 83 seq_printf(p, "%*s: ", prec, "TRM");
84 for_each_online_cpu(j) 84 for_each_online_cpu(j)
85 seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count); 85 seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count);
86 seq_printf(p, " Thermal event interrupts\n"); 86 seq_printf(p, " Thermal event interrupts\n");
87# ifdef CONFIG_X86_64 87# ifdef CONFIG_X86_64
88 seq_printf(p, "THR: "); 88 seq_printf(p, "%*s: ", prec, "THR");
89 for_each_online_cpu(j) 89 for_each_online_cpu(j)
90 seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count); 90 seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count);
91 seq_printf(p, " Threshold APIC interrupts\n"); 91 seq_printf(p, " Threshold APIC interrupts\n");
92# endif 92# endif
93#endif 93#endif
94#ifdef CONFIG_X86_LOCAL_APIC 94#ifdef CONFIG_X86_LOCAL_APIC
95 seq_printf(p, "SPU: "); 95 seq_printf(p, "%*s: ", prec, "SPU");
96 for_each_online_cpu(j) 96 for_each_online_cpu(j)
97 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); 97 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count);
98 seq_printf(p, " Spurious interrupts\n"); 98 seq_printf(p, " Spurious interrupts\n");
99#endif 99#endif
100 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 100 seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
101#if defined(CONFIG_X86_IO_APIC) 101#if defined(CONFIG_X86_IO_APIC)
102 seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); 102 seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
103#endif 103#endif
104 return 0; 104 return 0;
105} 105}
@@ -107,19 +107,22 @@ static int show_other_interrupts(struct seq_file *p)
107int show_interrupts(struct seq_file *p, void *v) 107int show_interrupts(struct seq_file *p, void *v)
108{ 108{
109 unsigned long flags, any_count = 0; 109 unsigned long flags, any_count = 0;
110 int i = *(loff_t *) v, j; 110 int i = *(loff_t *) v, j, prec;
111 struct irqaction *action; 111 struct irqaction *action;
112 struct irq_desc *desc; 112 struct irq_desc *desc;
113 113
114 if (i > nr_irqs) 114 if (i > nr_irqs)
115 return 0; 115 return 0;
116 116
117 for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
118 j *= 10;
119
117 if (i == nr_irqs) 120 if (i == nr_irqs)
118 return show_other_interrupts(p); 121 return show_other_interrupts(p, prec);
119 122
120 /* print header */ 123 /* print header */
121 if (i == 0) { 124 if (i == 0) {
122 seq_printf(p, " "); 125 seq_printf(p, "%*s", prec + 8, "");
123 for_each_online_cpu(j) 126 for_each_online_cpu(j)
124 seq_printf(p, "CPU%-8d", j); 127 seq_printf(p, "CPU%-8d", j);
125 seq_putc(p, '\n'); 128 seq_putc(p, '\n');
@@ -140,7 +143,7 @@ int show_interrupts(struct seq_file *p, void *v)
140 if (!action && !any_count) 143 if (!action && !any_count)
141 goto out; 144 goto out;
142 145
143 seq_printf(p, "%3d: ", i); 146 seq_printf(p, "%*d: ", prec, i);
144#ifndef CONFIG_SMP 147#ifndef CONFIG_SMP
145 seq_printf(p, "%10u ", kstat_irqs(i)); 148 seq_printf(p, "%10u ", kstat_irqs(i));
146#else 149#else