Monday, April 20, 2015

How to convert Linux Kernel to Real Time Linux Kernel

1) Get the RT patch from https://www.kernel.org/pub/linux/kernel/projects/rt/
2) Apply to Base Kernel downloaded from GIT
3) Enable CONFIG_PREEMPT_FULL

Start using RT Kernel functionality .


The RT-Preempt patch converts Linux into a fully preemptible kernel.
---------------------------------------------------------------------------------------------------------------
1) Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes.

2)Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t).

3)Implementing priority inheritance for in-kernel spinlocks and semaphores. For more information on priority inversion and priority inheritance please consult Introduction to Priority Inversion.

4)Converting interrupt handlers into preemptible kernel threads: The RT-Preempt patch treats soft interrupt handlers in kernel thread context, which is represented by a task_struct like a common user space process. However it is also possible to register an IRQ in kernel context.

5)Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to user space POSIX timers with high resolution.



References:
how to apply RT patch : https://www.osadl.org/Realtime-Preempt-Kernel.kernel-rt.0.html
RT benchmarking info :  https://rt.wiki.kernel.org/index.php/Main_Page
Benchmark info at bottom of page: https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
https://rt.wiki.kernel.org/index.php/Frequently_Asked_Questions
http://events.linuxfoundation.org/sites/events/files/slides/Four%20Ways%20to%20Improve%20Embedded%20Linux%20Performance%20-%20KLF%202013.pdf

This site has very good info about how to check RT latency and how to fix  Latency issue http://people.redhat.com/williams/latency-howto/rt-latency-howto.txt

No comments:

Post a Comment