Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c86845ed authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt
Browse files

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: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent fda9d861
Loading
Loading
Loading
Loading
+46 −33
Original line number Original line Diff line number Diff line
@@ -183,30 +183,46 @@ notrace void raw_local_irq_restore(unsigned long en)
EXPORT_SYMBOL(raw_local_irq_restore);
EXPORT_SYMBOL(raw_local_irq_restore);
#endif /* CONFIG_PPC64 */
#endif /* CONFIG_PPC64 */


int show_interrupts(struct seq_file *p, void *v)
static int show_other_interrupts(struct seq_file *p, int prec)
{
{
	int i = *(loff_t *)v, j;
	int j;
	struct irqaction *action;
	struct irq_desc *desc;
	unsigned long flags;


	if (i == 0) {
		seq_puts(p, "           ");
		for_each_online_cpu(j)
			seq_printf(p, "CPU%d       ", j);
		seq_putc(p, '\n');
	} else if (i == nr_irqs) {
#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
	if (tau_initialized) {
	if (tau_initialized) {
			seq_puts(p, "TAU: ");
		seq_printf(p, "%*s: ", prec, "TAU");
		for_each_online_cpu(j)
		for_each_online_cpu(j)
			seq_printf(p, "%10u ", tau_interrupts(j));
			seq_printf(p, "%10u ", tau_interrupts(j));
		seq_puts(p, "  PowerPC             Thermal Assist (cpu temp)\n");
		seq_puts(p, "  PowerPC             Thermal Assist (cpu temp)\n");
	}
	}
#endif /* CONFIG_PPC32 && CONFIG_TAU_INT */
#endif /* CONFIG_PPC32 && CONFIG_TAU_INT */
		seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);


	seq_printf(p, "%*s: %10u\n", prec, "BAD", ppc_spurious_interrupts);

	return 0;
}

int show_interrupts(struct seq_file *p, void *v)
{
	unsigned long flags, any_count = 0;
	int i = *(loff_t *) v, j, prec;
	struct irqaction *action;
	struct irq_desc *desc;

	if (i > nr_irqs)
		return 0;
		return 0;

	for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
		j *= 10;

	if (i == nr_irqs)
		return show_other_interrupts(p, prec);

	/* print header */
	if (i == 0) {
		seq_printf(p, "%*s", prec + 8, "");
		for_each_online_cpu(j)
			seq_printf(p, "CPU%-8d", j);
		seq_putc(p, '\n');
	}
	}


	desc = irq_to_desc(i);
	desc = irq_to_desc(i);
@@ -214,34 +230,31 @@ int show_interrupts(struct seq_file *p, void *v)
		return 0;
		return 0;


	raw_spin_lock_irqsave(&desc->lock, flags);
	raw_spin_lock_irqsave(&desc->lock, flags);

	for_each_online_cpu(j)
		any_count |= kstat_irqs_cpu(i, j);
	action = desc->action;
	action = desc->action;
	if (!action || !action->handler)
	if (!action && !any_count)
		goto skip;
		goto out;


	seq_printf(p, "%3d: ", i);
	seq_printf(p, "%*d: ", prec, i);
#ifdef CONFIG_SMP
	for_each_online_cpu(j)
	for_each_online_cpu(j)
		seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
		seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
#else
	seq_printf(p, "%10u ", kstat_irqs(i));
#endif /* CONFIG_SMP */


	if (desc->chip)
	if (desc->chip)
		seq_printf(p, " %s ", desc->chip->name);
		seq_printf(p, "  %-16s", desc->chip->name);
	else
	else
		seq_puts(p, "  None      ");
		seq_printf(p, "  %-16s", "None");
	seq_printf(p, " %-8s", (desc->status & IRQ_LEVEL) ? "Level" : "Edge");


	seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge  ");
	if (action) {
		seq_printf(p, "     %s", action->name);
		seq_printf(p, "     %s", action->name);

		while ((action = action->next) != NULL)
	for (action = action->next; action; action = action->next)
			seq_printf(p, ", %s", action->name);
			seq_printf(p, ", %s", action->name);
	seq_putc(p, '\n');
	}


skip:
	seq_putc(p, '\n');
out:
	raw_spin_unlock_irqrestore(&desc->lock, flags);
	raw_spin_unlock_irqrestore(&desc->lock, flags);

	return 0;
	return 0;
}
}