* [PATCH] genirq: warn on inconstent flags and flow handler
@ 2014-06-13 16:36 Florian Fainelli
2014-07-01 18:56 ` Florian Fainelli
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2014-06-13 16:36 UTC (permalink / raw)
To: linux-kernel; +Cc: tglx, jason, computersforpeace, Florian Fainelli
It is currently possible for a generic irq chip driver to set IRQ_LEVEL
and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
such a case does not make sense, and will actually prevent e.g: the
software resend logic from kicking, and potential other problems too.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Thomas,
This is the change I mentioned to you on the #mipslinux IRC channel,
let me know if you feel like this should be somewhere else, AFAICT
this should not slow things down.
Thanks!
kernel/irq/chip.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index a2b28a2fd7b1..939ae1283ec9 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -749,8 +749,13 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
irqd_set(&desc->irq_data, IRQD_PER_CPU);
if (irq_settings_can_move_pcntxt(desc))
irqd_set(&desc->irq_data, IRQD_MOVE_PCNTXT);
- if (irq_settings_is_level(desc))
+ if (irq_settings_is_level(desc)) {
+ /* Setting IRQD_LEVEL does not make sense on non-level
+ * sensitive interrupts
+ */
+ WARN_ON(desc->handle_irq != handle_level_irq);
irqd_set(&desc->irq_data, IRQD_LEVEL);
+ }
irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] genirq: warn on inconstent flags and flow handler
2014-06-13 16:36 [PATCH] genirq: warn on inconstent flags and flow handler Florian Fainelli
@ 2014-07-01 18:56 ` Florian Fainelli
0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2014-07-01 18:56 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Gleixner, Jason Cooper, Brian Norris, Florian Fainelli
2014-06-13 9:36 GMT-07:00 Florian Fainelli <f.fainelli@gmail.com>:
> It is currently possible for a generic irq chip driver to set IRQ_LEVEL
> and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
> such a case does not make sense, and will actually prevent e.g: the
> software resend logic from kicking, and potential other problems too.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Thomas,
>
> This is the change I mentioned to you on the #mipslinux IRC channel,
> let me know if you feel like this should be somewhere else, AFAICT
> this should not slow things down.
Thomas, Jason, is this something you are willing to accept?
irq_modify_status() should not be called in a hot-path as far as I
audited the code, but let me know if you prefer another solution (like
propagating an error code from irq_modify_status()).
Thanks!
>
> Thanks!
>
> kernel/irq/chip.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index a2b28a2fd7b1..939ae1283ec9 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -749,8 +749,13 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
> irqd_set(&desc->irq_data, IRQD_PER_CPU);
> if (irq_settings_can_move_pcntxt(desc))
> irqd_set(&desc->irq_data, IRQD_MOVE_PCNTXT);
> - if (irq_settings_is_level(desc))
> + if (irq_settings_is_level(desc)) {
> + /* Setting IRQD_LEVEL does not make sense on non-level
> + * sensitive interrupts
> + */
> + WARN_ON(desc->handle_irq != handle_level_irq);
> irqd_set(&desc->irq_data, IRQD_LEVEL);
> + }
>
> irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
>
> --
> 1.9.1
>
--
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-01 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 16:36 [PATCH] genirq: warn on inconstent flags and flow handler Florian Fainelli
2014-07-01 18:56 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).