genirq: Allow to pass the IRQF_TIMER flag with percpu irq request

The irq timings infrastructure tracks when interrupts occur in order to
statistically predict te next interrupt event.

There is no point to track timer interrupts and try to predict them because
the next expiration time is already known. This can be avoided via the
IRQF_TIMER flag which is passed by timer drivers in request_irq(). It marks
the interrupt as timer based which alloes to ignore these interrupts in the
timings code.

Per CPU interrupts which are requested via request_percpu_+irq() have no
flag argument, so marking per cpu timer interrupts is not possible and they
get tracked pointlessly.

Add __request_percpu_irq() as a variant of request_percpu_irq() with a
flags argument and make request_percpu_irq() an inline wrapper passing
flags = 0.

The flag parameter is restricted to IRQF_TIMER as all other IRQF_ flags
make no sense for per cpu interrupts.

The next step is to convert all existing users of request_percpu_irq() and
then remove the wrapper and the underscores.

[ tglx: Massaged changelog ]

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: peterz@infradead.org
Cc: nicolas.pitre@linaro.org
Cc: vincent.guittot@linaro.org
Cc: rafael@kernel.org
Link: http://lkml.kernel.org/r/1499344144-3964-1-git-send-email-daniel.lezcano@linaro.org

authored by

Daniel Lezcano and committed by
Thomas Gleixner
c80081b9 2343877f

+20 -6
+10 -1
include/linux/interrupt.h
··· 152 152 unsigned long flags, const char *name, void *dev_id); 153 153 154 154 extern int __must_check 155 + __request_percpu_irq(unsigned int irq, irq_handler_t handler, 156 + unsigned long flags, const char *devname, 157 + void __percpu *percpu_dev_id); 158 + 159 + static inline int __must_check 155 160 request_percpu_irq(unsigned int irq, irq_handler_t handler, 156 - const char *devname, void __percpu *percpu_dev_id); 161 + const char *devname, void __percpu *percpu_dev_id) 162 + { 163 + return __request_percpu_irq(irq, handler, 0, 164 + devname, percpu_dev_id); 165 + } 157 166 158 167 extern const void *free_irq(unsigned int, void *); 159 168 extern void free_percpu_irq(unsigned int, void __percpu *);
+10 -5
kernel/irq/manage.c
··· 1950 1950 } 1951 1951 1952 1952 /** 1953 - * request_percpu_irq - allocate a percpu interrupt line 1953 + * __request_percpu_irq - allocate a percpu interrupt line 1954 1954 * @irq: Interrupt line to allocate 1955 1955 * @handler: Function to be called when the IRQ occurs. 1956 + * @flags: Interrupt type flags (IRQF_TIMER only) 1956 1957 * @devname: An ascii name for the claiming device 1957 1958 * @dev_id: A percpu cookie passed back to the handler function 1958 1959 * ··· 1966 1965 * the handler gets called with the interrupted CPU's instance of 1967 1966 * that variable. 1968 1967 */ 1969 - int request_percpu_irq(unsigned int irq, irq_handler_t handler, 1970 - const char *devname, void __percpu *dev_id) 1968 + int __request_percpu_irq(unsigned int irq, irq_handler_t handler, 1969 + unsigned long flags, const char *devname, 1970 + void __percpu *dev_id) 1971 1971 { 1972 1972 struct irqaction *action; 1973 1973 struct irq_desc *desc; ··· 1982 1980 !irq_settings_is_per_cpu_devid(desc)) 1983 1981 return -EINVAL; 1984 1982 1983 + if (flags && flags != IRQF_TIMER) 1984 + return -EINVAL; 1985 + 1985 1986 action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 1986 1987 if (!action) 1987 1988 return -ENOMEM; 1988 1989 1989 1990 action->handler = handler; 1990 - action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND; 1991 + action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND; 1991 1992 action->name = devname; 1992 1993 action->percpu_dev_id = dev_id; 1993 1994 ··· 2009 2004 2010 2005 return retval; 2011 2006 } 2012 - EXPORT_SYMBOL_GPL(request_percpu_irq); 2007 + EXPORT_SYMBOL_GPL(__request_percpu_irq); 2013 2008 2014 2009 /** 2015 2010 * irq_get_irqchip_state - returns the irqchip state of a interrupt.