genirq: warn on inconstent flags and flow handler
PATCH 1/1 genirq: warn on inconstent flags and flow handler
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.
---
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(-)
kernel/irq/chip.c +6 -1
@@ -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));
Signature · 1 line
1.9.1
2014-06-13 9:36 GMT-07:00 Florian Fainelli <[email protected]>:
Quoted 5 lines
It is currently possible for a generic irq chip driver to set
IRQ_LEVELand have its irq flow handler behandle_edge_irq. SettingIRQ_LEVELin such a case does not make sense, and will actually prevent e.g: the software resend logic from kicking, and potential other problems too.
Quoted 7 lines
Signed-off-by Florian Fainelli <[email protected]>---
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!
Quoted 28 lines
Thanks!
kernel/irq/chip.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)kernel/irq/chip.c +6
-2@@ -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
Signature · 1 line
Florian