Interrupt shielding

Using threaded interrupt handlers helps mitigate interrupt overhead by running some threads at a higher priority than interrupt handlers that do not impact the real-time tasks. If you are using a multi-core processor, you can take a different approach and shield one or more cores from processing interrupts completely, allowing them to be dedicated to real-time tasks instead. This works either with a normal Linux kernel or a PREEMPT_RT kernel.

Achieving this is a question of pinning the real-time threads to one CPU and the interrupt handlers to a different one. You can set the CPU affinity off a thread or process using the command line tool taskset, or you can use the sched_setaffinity(2) and pthread_setaffinity_np(3) functions.

To set the affinity of an interrupt, first note that there is a subdirectory for each interrupt number in /proc/irq/<IRQ number>. The control files for the interrupt are in there, including a CPU mask in smp_affinity. Write a bitmask to that file with a bit set for each CPU that is allowed to handle that IRQ.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.99.71