diff options
| author | Marc Zyngier <marc.zyngier@arm.com> | 2014-08-26 06:03:16 -0400 |
|---|---|---|
| committer | Jason Cooper <jason@lakedaemon.net> | 2014-09-03 08:57:27 -0400 |
| commit | 76ba59f8366f2d9282cb5bda9de75b4b68cbe55f (patch) | |
| tree | 567c5a7b10fb8f7a1e597a8cc83c0afe92dbce50 /include/linux | |
| parent | 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff) | |
genirq: Add irq_domain-aware core IRQ handler
Calling irq_find_mapping from outside a irq_{enter,exit} section is
unsafe and produces ugly messages if CONFIG_PROVE_RCU is enabled:
If coming from the idle state, the rcu_read_lock call in irq_find_mapping
will generate an unpleasant warning:
<quote>
===============================
[ INFO: suspicious RCU usage. ]
3.16.0-rc1+ #135 Not tainted
-------------------------------
include/linux/rcupdate.h:871 rcu_read_lock() used illegally while idle!
other info that might help us debug this:
RCU used illegally from idle CPU!
rcu_scheduler_active = 1, debug_locks = 0
RCU used illegally from extended quiescent state!
1 lock held by swapper/0/0:
#0: (rcu_read_lock){......}, at: [<ffffffc00010206c>]
irq_find_mapping+0x4c/0x198
</quote>
As this issue is fairly widespread and involves at least three
different architectures, a possible solution is to add a new
handle_domain_irq entry point into the generic IRQ code that
the interrupt controller code can call.
This new function takes an irq_domain, and calls into irq_find_domain
inside the irq_{enter,exit} block. An additional "lookup" parameter is
used to allow non-domain architecture code to be replaced by this as well.
Interrupt controllers can then be updated to use the new mechanism.
This code is sitting behind a new CONFIG_HANDLE_DOMAIN_IRQ, as not all
architectures implement set_irq_regs (yes, mn10300, I'm looking at you...).
Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Link: https://lkml.kernel.org/r/1409047421-27649-2-git-send-email-marc.zyngier@arm.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/irqdesc.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 472c021a2d4f..ff24667cd86c 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h | |||
| @@ -12,6 +12,8 @@ struct irq_affinity_notify; | |||
| 12 | struct proc_dir_entry; | 12 | struct proc_dir_entry; |
| 13 | struct module; | 13 | struct module; |
| 14 | struct irq_desc; | 14 | struct irq_desc; |
| 15 | struct irq_domain; | ||
| 16 | struct pt_regs; | ||
| 15 | 17 | ||
| 16 | /** | 18 | /** |
| 17 | * struct irq_desc - interrupt descriptor | 19 | * struct irq_desc - interrupt descriptor |
| @@ -118,6 +120,23 @@ static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *de | |||
| 118 | 120 | ||
| 119 | int generic_handle_irq(unsigned int irq); | 121 | int generic_handle_irq(unsigned int irq); |
| 120 | 122 | ||
| 123 | #ifdef CONFIG_HANDLE_DOMAIN_IRQ | ||
| 124 | /* | ||
| 125 | * Convert a HW interrupt number to a logical one using a IRQ domain, | ||
| 126 | * and handle the result interrupt number. Return -EINVAL if | ||
| 127 | * conversion failed. Providing a NULL domain indicates that the | ||
| 128 | * conversion has already been done. | ||
| 129 | */ | ||
| 130 | int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, | ||
| 131 | bool lookup, struct pt_regs *regs); | ||
| 132 | |||
| 133 | static inline int handle_domain_irq(struct irq_domain *domain, | ||
| 134 | unsigned int hwirq, struct pt_regs *regs) | ||
| 135 | { | ||
| 136 | return __handle_domain_irq(domain, hwirq, true, regs); | ||
| 137 | } | ||
| 138 | #endif | ||
| 139 | |||
| 121 | /* Test to see if a driver has successfully requested an irq */ | 140 | /* Test to see if a driver has successfully requested an irq */ |
| 122 | static inline int irq_has_action(unsigned int irq) | 141 | static inline int irq_has_action(unsigned int irq) |
| 123 | { | 142 | { |
