Frequently Asked Questions

From RTwiki
(Difference between revisions)
Jump to: navigation, search
(Lose the explicit section numbering, since it makes it harder to reorganize the sections later. Also, add question marks to all of the questions.)
(More reorganizations to wikify the FAQ; again, eliminate question numbering, since it will make it harder to move things around)
Line 1: Line 1:
 
==Intro==
 
==Intro==
  
===Title===
+
This page contains a list of frequently asked questions about the real-time support in the Linux Kernel
FAQ for realtime support in Linux Kernel
+
  
===Authors===
 
  
Questions are given by:
+
===Acknowledgements===
  
[[User:jaswinderlinuxrt | Jaswinder Singh]]
+
Authors of this FAQ include:  
  
Answers are given by:
+
* [[User:jaswinderlinuxrt | Jaswinder Singh]]
 
+
* [[User:Lfu | Luotao Fu]] (l.fu AT pengutronix DOT de), Pengutronix e.K., Kernel Development Group <br>
[[User:Lfu | Luotao Fu]] (l.fu AT pengutronix DOT de), Pengutronix e.K., Kernel Development Group <br>
+
* [[User:Rschwebel | Robert Schwebel]] (r.schwebel AT pengutronix DOT de), Pengutronix e.K., Kernel Development Group<br>
[[User:Rschwebel | Robert Schwebel]] (r.schwebel AT pengutronix DOT de), Pengutronix e.K., Kernel Development Group<br>
+
* [[User:Remy | Remy Bohmer]]<br>
[[User:Remy | Remy Bohmer]]<br>
+
* [[User:jaswinderlinuxrt | Jaswinder Singh]]
[[User:jaswinderlinuxrt | Jaswinder Singh]]
+
* [[User:Tytso | Theodore Ts'o]]
  
 +
=== Table of Contents ===
  
 +
__TOC__
  
 
==Realtime Support ==
 
==Realtime Support ==
  
'''Q1:''' ''What is realtime support''
+
=== What is realtime support? ===
  
'''A1:'''
+
TBA
  
'''Q2:''' ''How does realtime work?''
+
=== How does realtime work? ===
  
'''A2:''' The RT-Preempt patch converts Linux into a fully preemptible kernel. The magic is done with:
+
The RT-Preempt patch converts Linux into a fully preemptible kernel. The magic is done with:
 
* Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes:  
 
* Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes:  
 
* 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)  
 
* 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)  
Line 36: Line 36:
 
more information: [[RT PREEMPT HOWTO]]
 
more information: [[RT PREEMPT HOWTO]]
  
'''Q3:''' ''What is the procedure to add realtime support?''
+
=== What is the procedure to add realtime support? ===
  
'''A3:''' Download latest realtime preemption patch from http://www.kernel.org/pub/linux/kernel/projects/rt/ then get related vanilla kernel from http://kernel.org/ then patch, configure and compile
+
Download latest realtime preemption patch from http://www.kernel.org/pub/linux/kernel/projects/rt/ then get related vanilla kernel from http://kernel.org/ then patch, configure and compile
  
  
 
==Architecture==
 
==Architecture==
'''Q1:''' ''Which Architecture are supporting realtime and who is maintainer?''
 
  
'''A1:'''
+
=== Which Architecture are supporting realtime and who is maintainer? ===
  
 
{| class="wikitable"  
 
{| class="wikitable"  
Line 104: Line 103:
  
  
'''Q2:''' ''What is the procedure to support realtime in new architecture?''
+
=== What is the procedure to support realtime in new architecture? ===
  
'''A2:'''
+
TBA
  
==Mailing list==
+
== Mailing list ==
'''Q1:''' ''realtime mailing list and archives''
+
  
'''A1:''' http://www.mail-archive.com/linux-rt-users@vger.kernel.org/
+
=== realtime mailing list and archives ===
  
'''Q2:''' ''If I have some doubts or problems regarding realtime, do I need to send mail in realtime mailing list or linux kernel mailing list or both?''
+
http://www.mail-archive.com/linux-rt-users@vger.kernel.org/
  
'''A2:'''
+
=== If I have some doubts or problems regarding realtime, do I need to send mail in realtime mailing list or linux kernel mailing list or both? ===
 +
 
 +
TBA
  
  
 
== Realtime Patches questions==
 
== Realtime Patches questions==
  
'''Q1:''' ''Why I need to download realtime patches, If realtime support is in Linux kernel?''
+
=== Why I need to download realtime patches, If realtime support is in Linux kernel? ===
  
'''A1:'''
+
TBA
  
'''Q2:''' ''Where can I download latest realtime patches?''
+
=== Where can I download latest realtime patches? ===
  
'''A2:''' http://www.kernel.org/pub/linux/kernel/projects/rt/
+
http://www.kernel.org/pub/linux/kernel/projects/rt/
  
'''Q3:''' ''Where can I post my realtime patches?''
+
=== Where can I post my realtime patches? ===
  
'''A3:''' Please send patches for the CONFIG_PREEMPT_RT Patch Set to LKML and put Ingo Molnar and Thomas Gleixner on CC.  
+
Please send patches for the CONFIG_PREEMPT_RT Patch Set to LKML and put Ingo Molnar and Thomas Gleixner on CC.  
  
 
Please do not send clocksource and clockevents related patches against the -rt patch. Make sure they apply against the latest -hrt-dyntick patch. -hrt-dyntick might be a bit ahead of -rt at times, but the -rt patch pulls -hrt-dyntick on a regular base.
 
Please do not send clocksource and clockevents related patches against the -rt patch. Make sure they apply against the latest -hrt-dyntick patch. -hrt-dyntick might be a bit ahead of -rt at times, but the -rt patch pulls -hrt-dyntick on a regular base.
Line 139: Line 139:
 
==Configuring/compiling questions==
 
==Configuring/compiling questions==
  
'''Q1:''' ''How to enable/disable realtime support?''
+
=== How to enable/disable realtime support? ===
  
'''A1:'''
+
TBA
  
'''Q2:''' ''Change realtime support run time or statically?''
+
=== Change realtime support run time or statically? ===
  
'''A2:'''
+
=== Required parameters for configuring realtime kernel? ===
  
'''Q3:''' ''Required parameters for configuring realtime kernel?''
+
TBA
  
'''A3:'''
+
=== Optional parameters for configuring realtime kernel, but they effect realtime performance? ===
  
'''Q4:''' ''Optional parameters for configuring realtime kernel, but they effect realtime performance?''
+
TBA
 
+
'''A4:'''
+
  
  
 
==Realtime samples/Performance questions==
 
==Realtime samples/Performance questions==
  
'''Q1:''' ''What effects by realtime support and how much and samples to test it and who maintains these samples?''
+
=== What effects by realtime support and how much and samples to test it and who maintains these samples? ===
 
+
''a. scheduling, task switching time''
+
 
+
''b. Interrupt latency''
+
 
+
''c. Interprocess communication''
+
 
+
''d. Filesystem''
+
 
+
''e. Device drivers''
+
 
+
''f. Network''
+
 
+
''g. X-Windows''
+
 
+
'''A1:'''
+
  
 
{| class="wikitable"  
 
{| class="wikitable"  
Line 198: Line 180:
 
== Realtime Applications questions==
 
== Realtime Applications questions==
  
'''Q1:''' ''List of realtime APIs?''
+
=== List of realtime APIs? ===
  
'''A1:'''
+
TBA
  
'''Q2:''' ''How to write realtime applications?''
+
=== How to write realtime applications? ===
  
'''A2:'''
+
TBA
  
'''Q3:''' ''Which programming languages are suitable for writing realtime applications?''
+
=== Which programming languages are suitable for writing realtime applications? ===
 +
 
 +
It depends on your latency requirements, but usually these are advisable:
  
'''A3:''' It depends on your latency requirements, but usually these are advisable:
 
 
* C is preferred;
 
* C is preferred;
 
* C++ is possible if some constraints are taken into account (see Q4)
 
* C++ is possible if some constraints are taken into account (see Q4)
  
'''Q4:''' ''Keep following things in mind while writing realtime applications?''
+
=== What are important things to keep in mind while writing realtime applications? ===
 +
 
 +
Taking care of the following during the initial startup phase:
  
'''A4:''' Taking care of the following during the initial startup phase:
 
 
* Call directly from the main() entry the mlockall() call.  
 
* Call directly from the main() entry the mlockall() call.  
 
* Create all threads at startup time of the application, and touch each page of the entire stack of each thread. Never start threads dynamically during RT show time, this will ruin RT behavior.  
 
* Create all threads at startup time of the application, and touch each page of the entire stack of each thread. Never start threads dynamically during RT show time, this will ruin RT behavior.  
Line 222: Line 206:
 
more information: [[HOWTO: Build an RT-application]]
 
more information: [[HOWTO: Build an RT-application]]
  
'''Q5:''' ''Do I need to recompile my applications to get realtime performance?''
+
=== Do I need to recompile my applications to get realtime performance? ===
  
'''A5:''' Recompile is not necessary. Userland does not notice any difference if it is running on RT or not, except for a much better RT-responsiveness, only changing the kernel is enough.
+
Recompile is not necessary. Userland does not notice any difference if it is running on RT or not, except for a much better RT-responsiveness, only changing the kernel is enough.
<BR>But, usually, locking bugs in userland applications become much more visible due the more dynamic and fine grained scheduling of the kernel. These are not new bugs, but bugs already existing in the applications, which only become visible on RT (Notice that these bugs are also likely to occur on SMP systems).  
+
 
<BR>Also:
+
But, usually, locking bugs in userland applications become much more visible due the more dynamic and fine grained scheduling of the kernel. These are not new bugs, but bugs already existing in the applications, which only become visible on RT (Notice that these bugs are also likely to occur on SMP systems).  
 +
 
 +
>Also:
 
* A bad designed application on non-RT will never behave realtime on RT. See also Q4.  
 
* A bad designed application on non-RT will never behave realtime on RT. See also Q4.  
 
* Never protect shared/global data in userland processes with semaphores (yes, many people do that...), but use PTHREAD_PRIO_INHERIT mutexes instead. (PTHREAD_PRIO_INHERIT mutexes are only supported in Glibc 2.5 and higher. uClibc based filesystems do not support this)
 
* Never protect shared/global data in userland processes with semaphores (yes, many people do that...), but use PTHREAD_PRIO_INHERIT mutexes instead. (PTHREAD_PRIO_INHERIT mutexes are only supported in Glibc 2.5 and higher. uClibc based filesystems do not support this)
Line 232: Line 218:
 
==Maintainers questions==
 
==Maintainers questions==
  
'''Q1:''' ''Who are the Maintainers of realtime kernel patch?''
+
=== Who are the Maintainers of realtime kernel patch? ===
 
+
'''A1:'''
+

Revision as of 20:03, 29 September 2007

Intro

This page contains a list of frequently asked questions about the real-time support in the Linux Kernel


Acknowledgements

Authors of this FAQ include:

Table of Contents

Contents


Realtime Support

What is realtime support?

TBA

How does realtime work?

The RT-Preempt patch converts Linux into a fully preemptible kernel. The magic is done with:

  • Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes:
  • 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)
  • Implementing priority inheritance for in-kernel spinlocks and semaphores. For more information on priority inversion and priority inheritance please consult Introduction to Priority Inversion
  • 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 userspace process. However it is also possible to register an IRQ in kernel context.
  • Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to userspace POSIX timers with high resolution.

more information: RT PREEMPT HOWTO

What is the procedure to add realtime support?

Download latest realtime preemption patch from http://www.kernel.org/pub/linux/kernel/projects/rt/ then get related vanilla kernel from http://kernel.org/ then patch, configure and compile


Architecture

Which Architecture are supporting realtime and who is maintainer?

Processor Supported Contact(s)
alpha
arm Yes
arm26
avr32
blackfin
cris
frv
h8300
i386 Yes
ia64
m32r
m86k No
m68knommu No
mips
parisc
powerpc Yes
ppc
s390
sh
sh64
sparc
sparc64
um
v850
x86_64 Yes
xtensa


What is the procedure to support realtime in new architecture?

TBA

Mailing list

realtime mailing list and archives

http://www.mail-archive.com/linux-rt-users@vger.kernel.org/

If I have some doubts or problems regarding realtime, do I need to send mail in realtime mailing list or linux kernel mailing list or both?

TBA


Realtime Patches questions

Why I need to download realtime patches, If realtime support is in Linux kernel?

TBA

Where can I download latest realtime patches?

http://www.kernel.org/pub/linux/kernel/projects/rt/

Where can I post my realtime patches?

Please send patches for the CONFIG_PREEMPT_RT Patch Set to LKML and put Ingo Molnar and Thomas Gleixner on CC.

Please do not send clocksource and clockevents related patches against the -rt patch. Make sure they apply against the latest -hrt-dyntick patch. -hrt-dyntick might be a bit ahead of -rt at times, but the -rt patch pulls -hrt-dyntick on a regular base.

more information: CONFIG_PREEMPT_RT Patch


Configuring/compiling questions

How to enable/disable realtime support?

TBA

Change realtime support run time or statically?

Required parameters for configuring realtime kernel?

TBA

Optional parameters for configuring realtime kernel, but they effect realtime performance?

TBA


Realtime samples/Performance questions

What effects by realtime support and how much and samples to test it and who maintains these samples?

Area Effected by Realtime(%) Samples Contact(s)
scheduling
Interrupt latency
IPC
Filesystem
Device drivers
Network
X-Windows


Realtime Applications questions

List of realtime APIs?

TBA

How to write realtime applications?

TBA

Which programming languages are suitable for writing realtime applications?

It depends on your latency requirements, but usually these are advisable:

  • C is preferred;
  • C++ is possible if some constraints are taken into account (see Q4)

What are important things to keep in mind while writing realtime applications?

Taking care of the following during the initial startup phase:

  • Call directly from the main() entry the mlockall() call.
  • Create all threads at startup time of the application, and touch each page of the entire stack of each thread. Never start threads dynamically during RT show time, this will ruin RT behavior.
  • Never use system calls that are known to generate pagefaults, such as fopen(). (Opening of files does the mmap() system call, which generates a page-fault).
  • Do not use 'compile time static arrays' without initializing them directly after startup, before RT show time.

more information: HOWTO: Build an RT-application

Do I need to recompile my applications to get realtime performance?

Recompile is not necessary. Userland does not notice any difference if it is running on RT or not, except for a much better RT-responsiveness, only changing the kernel is enough.

But, usually, locking bugs in userland applications become much more visible due the more dynamic and fine grained scheduling of the kernel. These are not new bugs, but bugs already existing in the applications, which only become visible on RT (Notice that these bugs are also likely to occur on SMP systems).

>Also:

  • A bad designed application on non-RT will never behave realtime on RT. See also Q4.
  • Never protect shared/global data in userland processes with semaphores (yes, many people do that...), but use PTHREAD_PRIO_INHERIT mutexes instead. (PTHREAD_PRIO_INHERIT mutexes are only supported in Glibc 2.5 and higher. uClibc based filesystems do not support this)

Maintainers questions

Who are the Maintainers of realtime kernel patch?

Personal tools