aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2017-07-06 08:29:04 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-07-06 17:16:22 -0400
commitc80081b9209713e0fe86d3def395a9fc66503c58 (patch)
tree08420ed8f4eebb47f388207602e31d8c90a94373
parent2343877fbda701599653e63f8dcc318aa1bf15ee (diff)
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
-rw-r--r--include/linux/interrupt.h11
-rw-r--r--kernel/irq/manage.c15
2 files changed, 20 insertions, 6 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 37f8e354f564..5ac6e238555e 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,
152 unsigned long flags, const char *name, void *dev_id); 152 unsigned long flags, const char *name, void *dev_id);
153 153
154extern int __must_check 154extern 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
159static inline int __must_check
155request_percpu_irq(unsigned int irq, irq_handler_t handler, 160request_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
158extern const void *free_irq(unsigned int, void *); 167extern const void *free_irq(unsigned int, void *);
159extern void free_percpu_irq(unsigned int, void __percpu *); 168extern void free_percpu_irq(unsigned int, void __percpu *);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 91e1f2390752..5624b2dd6b58 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1950,9 +1950,10 @@ int setup_percpu_irq(unsigned int irq, struct irqaction *act)
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 * @irq: Interrupt line to allocate 1954 * @irq: Interrupt line to allocate
1955 * @handler: Function to be called when the IRQ occurs. 1955 * @handler: Function to be called when the IRQ occurs.
1956 * @flags: Interrupt type flags (IRQF_TIMER only)
1956 * @devname: An ascii name for the claiming device 1957 * @devname: An ascii name for the claiming device
1957 * @dev_id: A percpu cookie passed back to the handler function 1958 * @dev_id: A percpu cookie passed back to the handler function
1958 * 1959 *
@@ -1965,8 +1966,9 @@ int setup_percpu_irq(unsigned int irq, struct irqaction *act)
1965 * the handler gets called with the interrupted CPU's instance of 1966 * the handler gets called with the interrupted CPU's instance of
1966 * that variable. 1967 * that variable.
1967 */ 1968 */
1968int request_percpu_irq(unsigned int irq, irq_handler_t handler, 1969int __request_percpu_irq(unsigned int irq, irq_handler_t handler,
1969 const char *devname, void __percpu *dev_id) 1970 unsigned long flags, const char *devname,
1971 void __percpu *dev_id)
1970{ 1972{
1971 struct irqaction *action; 1973 struct irqaction *action;
1972 struct irq_desc *desc; 1974 struct irq_desc *desc;
@@ -1980,12 +1982,15 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,
1980 !irq_settings_is_per_cpu_devid(desc)) 1982 !irq_settings_is_per_cpu_devid(desc))
1981 return -EINVAL; 1983 return -EINVAL;
1982 1984
1985 if (flags && flags != IRQF_TIMER)
1986 return -EINVAL;
1987
1983 action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 1988 action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
1984 if (!action) 1989 if (!action)
1985 return -ENOMEM; 1990 return -ENOMEM;
1986 1991
1987 action->handler = handler; 1992 action->handler = handler;
1988 action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND; 1993 action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND;
1989 action->name = devname; 1994 action->name = devname;
1990 action->percpu_dev_id = dev_id; 1995 action->percpu_dev_id = dev_id;
1991 1996
@@ -2004,7 +2009,7 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,
2004 2009
2005 return retval; 2010 return retval;
2006} 2011}
2007EXPORT_SYMBOL_GPL(request_percpu_irq); 2012EXPORT_SYMBOL_GPL(__request_percpu_irq);
2008 2013
2009/** 2014/**
2010 * irq_get_irqchip_state - returns the irqchip state of a interrupt. 2015 * irq_get_irqchip_state - returns the irqchip state of a interrupt.