aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2010-01-31 15:33:18 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-02-16 22:02:48 -0500
commitc86845ede8b643ca025aec277dec1892d0ccac01 (patch)
treef8c79ef42af9866f37de9287535f6c801cab8b36 /arch/powerpc
parentfda9d86100e0b412d0c8a16abe0651c8c8e39e81 (diff)
powerpc: Rework /proc/interrupts
On a large machine I noticed the columns of /proc/interrupts failed to line up with the header after CPU9. At sufficiently large numbers of CPUs it becomes impossible to line up the CPU number with the counts. While fixing this I noticed x86 has a number of updates that we may as well pull in. On PowerPC we currently omit an interrupt completely if there is no active handler, whereas on x86 it is printed if there is a non zero count. The x86 code also spaces the first column correctly based on nr_irqs. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/irq.c79
1 files changed, 46 insertions, 33 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index c6ac5583672a..b9cbb4570048 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -183,30 +183,46 @@ notrace void raw_local_irq_restore(unsigned long en)
183EXPORT_SYMBOL(raw_local_irq_restore); 183EXPORT_SYMBOL(raw_local_irq_restore);
184#endif /* CONFIG_PPC64 */ 184#endif /* CONFIG_PPC64 */
185 185
186static int show_other_interrupts(struct seq_file *p, int prec)
187{
188 int j;
189
190#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
191 if (tau_initialized) {
192 seq_printf(p, "%*s: ", prec, "TAU");
193 for_each_online_cpu(j)
194 seq_printf(p, "%10u ", tau_interrupts(j));
195 seq_puts(p, " PowerPC Thermal Assist (cpu temp)\n");
196 }
197#endif /* CONFIG_PPC32 && CONFIG_TAU_INT */
198
199 seq_printf(p, "%*s: %10u\n", prec, "BAD", ppc_spurious_interrupts);
200
201 return 0;
202}
203
186int show_interrupts(struct seq_file *p, void *v) 204int show_interrupts(struct seq_file *p, void *v)
187{ 205{
188 int i = *(loff_t *)v, j; 206 unsigned long flags, any_count = 0;
207 int i = *(loff_t *) v, j, prec;
189 struct irqaction *action; 208 struct irqaction *action;
190 struct irq_desc *desc; 209 struct irq_desc *desc;
191 unsigned long flags;
192 210
211 if (i > nr_irqs)
212 return 0;
213
214 for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
215 j *= 10;
216
217 if (i == nr_irqs)
218 return show_other_interrupts(p, prec);
219
220 /* print header */
193 if (i == 0) { 221 if (i == 0) {
194 seq_puts(p, " "); 222 seq_printf(p, "%*s", prec + 8, "");
195 for_each_online_cpu(j) 223 for_each_online_cpu(j)
196 seq_printf(p, "CPU%d ", j); 224 seq_printf(p, "CPU%-8d", j);
197 seq_putc(p, '\n'); 225 seq_putc(p, '\n');
198 } else if (i == nr_irqs) {
199#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
200 if (tau_initialized){
201 seq_puts(p, "TAU: ");
202 for_each_online_cpu(j)
203 seq_printf(p, "%10u ", tau_interrupts(j));
204 seq_puts(p, " PowerPC Thermal Assist (cpu temp)\n");
205 }
206#endif /* CONFIG_PPC32 && CONFIG_TAU_INT*/
207 seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
208
209 return 0;
210 } 226 }
211 227
212 desc = irq_to_desc(i); 228 desc = irq_to_desc(i);
@@ -214,34 +230,31 @@ int show_interrupts(struct seq_file *p, void *v)
214 return 0; 230 return 0;
215 231
216 raw_spin_lock_irqsave(&desc->lock, flags); 232 raw_spin_lock_irqsave(&desc->lock, flags);
217 233 for_each_online_cpu(j)
234 any_count |= kstat_irqs_cpu(i, j);
218 action = desc->action; 235 action = desc->action;
219 if (!action || !action->handler) 236 if (!action && !any_count)
220 goto skip; 237 goto out;
221 238
222 seq_printf(p, "%3d: ", i); 239 seq_printf(p, "%*d: ", prec, i);
223#ifdef CONFIG_SMP
224 for_each_online_cpu(j) 240 for_each_online_cpu(j)
225 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 241 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
226#else
227 seq_printf(p, "%10u ", kstat_irqs(i));
228#endif /* CONFIG_SMP */
229 242
230 if (desc->chip) 243 if (desc->chip)
231 seq_printf(p, " %s ", desc->chip->name); 244 seq_printf(p, " %-16s", desc->chip->name);
232 else 245 else
233 seq_puts(p, " None "); 246 seq_printf(p, " %-16s", "None");
247 seq_printf(p, " %-8s", (desc->status & IRQ_LEVEL) ? "Level" : "Edge");
234 248
235 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge "); 249 if (action) {
236 seq_printf(p, " %s", action->name); 250 seq_printf(p, " %s", action->name);
251 while ((action = action->next) != NULL)
252 seq_printf(p, ", %s", action->name);
253 }
237 254
238 for (action = action->next; action; action = action->next)
239 seq_printf(p, ", %s", action->name);
240 seq_putc(p, '\n'); 255 seq_putc(p, '\n');
241 256out:
242skip:
243 raw_spin_unlock_irqrestore(&desc->lock, flags); 257 raw_spin_unlock_irqrestore(&desc->lock, flags);
244
245 return 0; 258 return 0;
246} 259}
247 260