RFC genirq: add infrastructure for threaded interrupt handlers
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest5 patches 40 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | genirq: make irqreturn_t an enuminclude/ include/ | +12 | 0 replies | |
| 2/5 | genirq: add a quick check handlerinclude/ include/ kernel/ +1 more | +43 | 7 replies | |
| 3/5 | genirq: add threaded interrupt handler supportinclude/ include/ kernel/ +1 more | +94 | 1 reply | |
| 4/5 | genirq: add a helper to check whether the irq thread should runinclude/ kernel/ | +6 | 0 replies | |
| 5/5 | genirq: make irq threading robustinclude/ include/ kernel/ +2 more | +58 | 2 replies |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Ingo Molnar |
|---|---|
| 1/5 | R-b |
| 2/5 | R-b |
| 3/5 | R-b |
| 4/5 | R-b |
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [RFC patch 0/5] genirq: add infrastructure for threaded interrupt handlers
This patch series implements support for threaded irq handlers for the generic IRQ layer.
Threaded interrupt handlers are not only interesting in the preempt-rt context. Threaded interrupt handlers can help to address common problems in the interrupt handling code:
- move long running handlers out of the hard interrupt context
- avoid complex hardirq -> tasklet/softirq interaction and locking problems by integration of this functionality into the threaded handler code
- improved debugability of the kernel: faulty handlers do not take down the system.
- allows prioritizing of the handlers which share an interrupt line
The implementation provides an opt-in mechanism to convert drivers to the threaded interrupt handler model contrary to the preempt-rt patch where the threaded handlers are enabled by a brute force switch. The brute force switch is suboptimal as it does not change the interrupt handler -> tasklet/softirq interaction problems, but was the only way which was possible for the limited man power of the preempt-rt developers.
Converting an interrupt to threaded makes only sense when the handler code takes advantage of it by integrating tasklet/softirq functionality and simplifying the locking.
When a driver wants to use threaded interrupt handlers it needs to provide a quick check handler function, which checks whether the interrupt was originated from the device or not.
In case it was originated from the device the quick check handler must disable the interrupt at the device level and return IRQ_WAKE_THREAD. The generic interrupt handling core then sets the IRQF_RUNTHREAD in the irqaction of the handler and wakes the associated thread.
The irqaction is referenced in the threads task_struct so handlers can check for newly arrived interrupts in action flags. Aside of that the reference is used to prevent further referencing of the thread in the interrupt code in the case of segfault to make sure that the system (minus the now dead interrupt handler) survives and debug information can be retrieved. In the best case the driver can be restarted, but dont expect that as a given.
I hope to have a real converted driver (aside of the dummy module used for testing) ready real soon - as far as bugs/regressions stay out of my way for a while. :)
Comments, reviews, flames as usual.
Thanks,
tglx