Re: [PATCH V6] irq: Track the interrupt timings

From: Thomas Gleixner
Date: Fri Jun 17 2016 - 09:48:42 EST


On Tue, 14 Jun 2016, Daniel Lezcano wrote:
> +/**
> + * irqtiming_get_next - return the next irq timing
> + *
> + * @irq: a pointer to an integer representing the interrupt number
> + *
> + * This function allows to browse safely the interrupt descriptors in order
> + * to retrieve the interrupts timings. The parameter gives the interrupt
> + * number to begin with and will return the interrupt timings for the next
> + * allocated irq. This approach gives us the possibility to go through the
> + * different interrupts without having to handle the sparse irq.
> + *
> + * The function changes @irq to the next allocated irq + 1, it should be
> + * passed back again and again until NULL is returned. Usually this function
> + * is called the first time with @irq = 0.
> + *
> + * Returns a struct irq_timings, NULL if we reach the end of the interrupts
> + * list.
> + */
> +struct irq_timings *irq_timings_get_next(int *irq)
> +{
> + struct irq_desc *desc;
> + int next;
> +
> +again:
> + /* Do a racy lookup of the next allocated irq */
> + next = irq_get_next_irq(*irq);
> + if (next >= nr_irqs)
> + return NULL;
> +
> + *irq = next + 1;
> +
> + /*
> + * Now lookup the descriptor. It's RCU protected. This

Please mention in the function description above that this function
must be called inside of a rcu_read() locked section.

Thanks,

tglx