From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752965AbdFVJck (ORCPT ); Thu, 22 Jun 2017 05:32:40 -0400 Received: from foss.arm.com ([217.140.101.70]:35094 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751191AbdFVJcj (ORCPT ); Thu, 22 Jun 2017 05:32:39 -0400 Date: Thu, 22 Jun 2017 10:31:46 +0100 From: Mark Rutland To: Daniel Lezcano Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Jens Axboe , Hannes Reinecke , Bjorn Helgaas Subject: Re: [PATCH 1/3] irq: Allow to pass the IRQF_TIMER flag with percpu irq request Message-ID: <20170622093146.GA25967@leverpostej> References: <20170620212657.GB1812@mai> <1497994139-19816-1-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1497994139-19816-1-git-send-email-daniel.lezcano@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Tue, Jun 20, 2017 at 11:28:55PM +0200, Daniel Lezcano wrote: > In the next changes, we track when the interrupts occur in order to > statistically compute when is supposed to happen the next interrupt. > > In all the interruptions, it does not make sense to store the timer interrupt > occurences and try to predict the next interrupt as we know the expiration > time. > > The request_irq() has a irq flags parameter and the timer drivers use it to > pass the IRQF_TIMER flag, letting us know the interrupt is coming from a timer. > Based on this flag, we can discard these interrupts when tracking them. > > But, the API request_percpu_irq does not allow to pass a flag, hence specifying > if the interrupt type is a timer. > > Add a function __request_percpu_irq() where we can specify the flags. The > request_percpu_irq() function is changed to be a wrapper to > __request_percpu_irq() passing a zero flag parameter. > > For now, in order to prevent a misusage of this parameter, only the IRQF_TIMER > flag (or zero) is a valid parameter to be passed to the > __request_percpu_irq() function. > > Signed-off-by: Daniel Lezcano > Cc: Mark Rutland Sorry for leading you round the garden path on the naming. FWIW: Acked-by: Mark Rutland Thanks, Mark. > --- > Changelog: > > V11: > - Drop the changes in the timer drivers and rename the function > request_percpu_irq_flags to __request_percpu_irq. > V10: > - Drop the change for arch arm virtual timer > https://lkml.org/lkml/2017/4/25/184 > V9: > - Clarified the patch description > - Fixed EXPORT_SYMBOL_GPL(request_percpu_irq_flags) > > Signed-off-by: Daniel Lezcano > --- > include/linux/interrupt.h | 11 ++++++++++- > kernel/irq/manage.c | 15 ++++++++++----- > 2 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h > index a6fba48..d4ae50e 100644 > --- a/include/linux/interrupt.h > +++ b/include/linux/interrupt.h > @@ -152,8 +152,17 @@ request_any_context_irq(unsigned int irq, irq_handler_t handler, > unsigned long flags, const char *name, void *dev_id); > > extern int __must_check > +__request_percpu_irq(unsigned int irq, irq_handler_t handler, > + unsigned long flags, const char *devname, > + void __percpu *percpu_dev_id); > + > +static inline int __must_check > request_percpu_irq(unsigned int irq, irq_handler_t handler, > - const char *devname, void __percpu *percpu_dev_id); > + const char *devname, void __percpu *percpu_dev_id) > +{ > + return __request_percpu_irq(irq, handler, 0, > + devname, percpu_dev_id); > +} > > extern const void *free_irq(unsigned int, void *); > extern void free_percpu_irq(unsigned int, void __percpu *); > diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c > index 4c34696..5424cfb 100644 > --- a/kernel/irq/manage.c > +++ b/kernel/irq/manage.c > @@ -1974,9 +1974,10 @@ int setup_percpu_irq(unsigned int irq, struct irqaction *act) > } > > /** > - * request_percpu_irq - allocate a percpu interrupt line > + * __request_percpu_irq - allocate a percpu interrupt line > * @irq: Interrupt line to allocate > * @handler: Function to be called when the IRQ occurs. > + * @flags: Interrupt type flags (IRQF_TIMER only) > * @devname: An ascii name for the claiming device > * @dev_id: A percpu cookie passed back to the handler function > * > @@ -1989,8 +1990,9 @@ int setup_percpu_irq(unsigned int irq, struct irqaction *act) > * the handler gets called with the interrupted CPU's instance of > * that variable. > */ > -int request_percpu_irq(unsigned int irq, irq_handler_t handler, > - const char *devname, void __percpu *dev_id) > +int __request_percpu_irq(unsigned int irq, irq_handler_t handler, > + unsigned long flags, const char *devname, > + void __percpu *dev_id) > { > struct irqaction *action; > struct irq_desc *desc; > @@ -2004,12 +2006,15 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler, > !irq_settings_is_per_cpu_devid(desc)) > return -EINVAL; > > + if (flags && flags != IRQF_TIMER) > + return -EINVAL; > + > action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); > if (!action) > return -ENOMEM; > > action->handler = handler; > - action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND; > + action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND; > action->name = devname; > action->percpu_dev_id = dev_id; > > @@ -2030,7 +2035,7 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler, > > return retval; > } > -EXPORT_SYMBOL_GPL(request_percpu_irq); > +EXPORT_SYMBOL_GPL(__request_percpu_irq); > > /** > * irq_get_irqchip_state - returns the irqchip state of a interrupt. > -- > 2.7.4 >