User Tools

Site Tools


realtime:documentation:technical_details:threadirq

Threaded interrupt handler

In mainline Linux the interrupt service routine is processed in hard interrupt context with hardware interrupts disabled. Hardware interrupts disabled implies that preemption and soft interrupts are also disabled. Interrupt handlers are processed in context of the interrupt service routine with hard interrupts disabled as well. The kernel command line option `threadirqs` changes the the interrupt handlers to run in a threaded context. The scheduler policy of the thread is set to SCHED_FIFO with a default priority of 50.

All interrupt handlers marked with the IRQF_NO_THREAD flag will not be threaded and run with hard interrupts disabled. This flag is used for example by Inter-Processor Interrupts (IPIs). Interrupt handlers set up with the IRQF_TIMER or IRQF_PER_CPU flag are marked as IRQF_NO_THREAD implicitly.

The PREEMPT_RT patch forces the `threadirqs` command line option. There is a small difference between the behavior of threaded interrupts in the mainline and PREEMPT_RT implementations, illustrated in the following table:

Mainline PREEMPT_RT
hard interrupts disabled
soft interrupts disabled
preemption disabled

References:

realtime/documentation/technical_details/threadirq.txt · Last modified: 2023/10/01 18:48 by costa.shul