From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932638AbcFQNsi (ORCPT ); Fri, 17 Jun 2016 09:48:38 -0400 Received: from www.linutronix.de ([62.245.132.108]:51314 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753126AbcFQNsg (ORCPT ); Fri, 17 Jun 2016 09:48:36 -0400 Date: Fri, 17 Jun 2016 15:46:36 +0200 (CEST) From: Thomas Gleixner To: Daniel Lezcano cc: nicolas.pitre@linaro.org, shreyas@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, peterz@infradead.org, rafael@kernel.org, vincent.guittot@linaro.org Subject: Re: [PATCH V6] irq: Track the interrupt timings In-Reply-To: <1465935043-4844-1-git-send-email-daniel.lezcano@linaro.org> Message-ID: References: <1465935043-4844-1-git-send-email-daniel.lezcano@linaro.org> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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