genirq: Handle force threading of irqs with primary and thread handler
PATCH 1/1 genirq: Handle force threading of irqs with primary and thread handler
Force threading of interrupts does not deal with interrupts which are requested with a primary and a threaded handler. The current policy is to leave them alone and let the primary handler run in interrupt context, but we set the ONESHOT flag for those interrupts as well.
Kohji Okuno debugged a problem with the SDHCI driver where the interrupt thread waits for a hardware interrupt to trigger, which cant work well because the hardware interrupt is masked due to the ONESHOT flag being set. He proposed to set the ONESHOT flag only if the interrupt does not provide a thread handler.
Though that does not work either because these interrupts can be shared. So the other interrupt would rightfully get the ONESHOT flag set and therefor the same situation would happen again.
To deal with this proper, we need to force thread the primary handler of such interrupts as well. That means that the primary interrupt handler is treated as any other primary interrupt handler which is not marked IRQF_NO_THREAD. The threaded handler becomes a separate thread so the SDHCI flow logic can be handled gracefully.
The same issue was reported against 4.1-rt.
---
This requires to revert commit: d04ea10ba1ea 'mmc: sdhci: don't provide hard irq handler'
include/linux/interrupt.h | 2 kernel/irq/manage.c | 160 +++++++++++++++++++++++++++++++++------------- 2 files changed, 120 insertions(+), 42 deletions(-)
include/linux/interrupt.h +2 -0
@@ -104,6 +104,7 @@ typedef irqreturn_t (*irq_handler_t)(int* @flags: flags (see IRQF_* above) * @thread_fn: interrupt handler function for threaded interrupts * @thread: thread pointer for threaded interrupts +* @secondary: pointer to secondary irqaction (force threading) * @thread_flags: flags related to @thread * @thread_mask: bitmask for keeping track of @thread activity * @dir: pointer to the proc/irq/NN/name entry
@@ -115,6 +116,7 @@ struct irqaction {struct irqaction *next;irq_handler_t thread_fn;struct task_struct *thread; +struct irqaction *secondary;unsigned int irq;unsigned int flags;unsigned long thread_flags;
kernel/irq/manage.c +118 -42
256 lines not on this page · raw message
Quoted 28 lines · Thomas Gleixner
Force threading of interrupts does not deal with interrupts which are requested with a primary and a threaded handler. The current policy is to leave them alone and let the primary handler run in interrupt context, but we set the ONESHOT flag for those interrupts as well.
Kohji Okuno debugged a problem with the SDHCI driver where the interrupt thread waits for a hardware interrupt to trigger, which cant work well because the hardware interrupt is masked due to the ONESHOT flag being set. He proposed to set the ONESHOT flag only if the interrupt does not provide a thread handler.
Though that does not work either because these interrupts can be shared. So the other interrupt would rightfully get the ONESHOT flag set and therefor the same situation would happen again.
To deal with this proper, we need to force thread the primary handler of such interrupts as well. That means that the primary interrupt handler is treated as any other primary interrupt handler which is not marked
IRQF_NO_THREAD. The threaded handler becomes a separate thread so the SDHCI flow logic can be handled gracefully.The same issue was reported against 4.1-rt.
Reported-by Kohji Okuno <[email protected]>Reported-By Michal Šmucr <[email protected]>Reported-by Nathan Sullivan <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Cc Sebastian Andrzej Siewior <[email protected]>
Quoted 5 lines
---
This requires to revert commit:
d04ea10ba1ea'mmc: sdhci: don't provide hard irq handler'
Tested on an Intel Bay Trail system with ath6kl SDIO wireless, works fine.
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html