bfin: remove inline keyword
[xenomai-head.git] / TROUBLESHOOTING
blob52c60b177981cad797ed6cca7a6aab56e871e9c7
1 Troubleshooting guide
3 -------------------------------------------------------------------------------
5 Table of Contents
7  
8 1. Kernel configuration
9 2. Xenomai or I-pipe error in the kernel log
11     2.1. Kernel stops after "Uncompressing Linux… done, booting the kernel."
12     2.2. Kernel stops with an OOPS
13     2.3. Kernel boots but does not print any message
14     2.4. Xenomai: compiled for TSC, but CPU has no TSC
15     2.5. Xenomai has detected a CPU frequency of 0
16     2.6. I-pipe: could not find timer for cpu #x
17     2.7. Xenomai: Local APIC absent or disabled!
18     2.8. Xenomai: SMI-enabled chipset found, but SMI workaround disabled
19     2.9. Xenomai: system init failed, code -19
21         2.9.1. On x86
22         2.9.2. On AMD x86_64
23         2.9.3. On ARM
24         2.9.4. On other supported platforms
25         2.9.5. On a new I-pipe port
27     2.10. Xenomai: system init failed, code -22
29 3. Problems when running the latency test
31     3.1. Xenomai: binding failed: Operation not permitted
32     3.2. Xenomai: --enable-x86-sep needs NPTL and Linux 2.6.x or higher
33     3.3. latency: failed to open benchmark device
34     3.4. Hardware tsc is not a fast wrapping one
35     3.5. Xenomai: incompatible ABI revision level
36     3.6. Xenomai: incompatible feature set
38         3.6.1. missing="kuser_tsc"
39         3.6.2. missing="sep"
40         3.6.3. missing="smp/nosmp"
41         3.6.4. missing="tsc"
43     3.7. Xenomai: kernel/user tsc emulation mismatch
44     3.8. Xenomai: native skin or CONFIG_XENO_OPT_PERVASIVE disabled
45     3.9. latency: not found
46     3.10. Xenomai: watchdog triggered (period too short?)
47     3.11. Xenomai: Your board/configuration does not allow tsc emulation
48     3.12. the latency test hangs
49     3.13. the latency test shows high latencies
50     3.14. ARM tsc emulation issues
52 4. switchtest fails with "pthread_create: Resource temporarily unavailable"
53 5. Known Bugs and Limitations
55     5.1. 2.6.2/x86
57 6. Problem with my code (not Xenomai code)
59     6.1. "Warning: <service> is deprecated" while compiling kernel code
60     6.2. "Xenomai: process memory not locked (missing mlockall?)" at startup
61     6.3. High latencies when transitioning from primary to secondary mode
62     6.4. Any Xenomai service fails with code -38 (ENOSYS)
63     6.5. My application reserves a lot of memory
65 -------------------------------------------------------------------------------
67 This file is a troubleshooting guide about various known issues regarding
68 Xenomai.
70 The latest version is available at this address: 
71 "http://www.xenomai.org/documentation/xenomai-2.6/html/TROUBLESHOOTING/".
73 For questions, corrections and improvements, write to the mailing list: 
74 "xenomai@xenomai.org".
77 1. Kernel configuration
78 -----------------------
80 When configuring the Linux kernel, some options should be avoided.
82 CONFIG_CPU_FREQ
83     This allows the CPU frequency to be modulated with workload, but many CPUs
84     change the TSC counting frequency also, which makes it useless for accurate
85     timing when the CPU clock can change. Also some CPUs can take several
86     milliseconds to ramp up to full speed.
87 CONFIG_CPU_IDLE
88     Allows the CPU to enter deep sleep states, increasing the time it takes to
89     get out of these sleep states, hence the latency of an idle system. Also,
90     on some CPU, entering these deep sleep states causes the timers used by
91     Xenomai to stop functioning.
92 CONFIG_CC_STACKPROTECTOR
93     This option must be disabled on all platforms except x86_64: it requires
94     changes to the context switches currently only implemented for x86_64.
95 CONFIG_KGDB
96     This option can not be enabled with current versions of the I-pipe patch.
98 For x86 specific options see also this page: 
99 "http://www.xenomai.org/index.php/Configuring_x86_kernels".
102 2. Xenomai or I-pipe error in the kernel log
103 --------------------------------------------
105 If the Xenomai and I-pipe messages do not appear in the kernel log as:
107 I-pipe: head domain Xenomai registered.
108 Xenomai: hal/<arch> started.
109 Xenomai: scheduling class idle registered.
110 Xenomai: scheduling class rt registered.
111 Xenomai: real-time nucleus v2.6.1 (Light Years Away) loaded.
112 Xenomai: debug mode enabled.
113 Xenomai: starting native API services.
114 Xenomai: starting POSIX services.
115 Xenomai: starting RTDM services.
117 Where <arch> is the architecture you use, check the following sections, they
118 describe the usual error messages you may encounter.
121 2.1. Kernel stops after "Uncompressing Linux… done, booting the kernel."
122 ------------------------------------------------------------------------
124 This means that the kernel crashes before the console is enabled. You should
125 enable the CONFIG_EARLY_PRINTK option. For some architectures (blackfin, x86,
126 arm), enabling this option also requires passing the earlyprintk parameter on
127 the kernel command line. See Documentation/kernel-parameters.txt for possible
128 values.
130 For the ARM architecture, you have to enable CONFIG_DEBUG_KERNEL and
131 CONFIG_DEBUG_LL in order to be able to enable CONFIG_EARLY_PRINTK.
134 2.2. Kernel stops with an OOPS
135 ------------------------------
137 Please make sure that you have followed the "Kernel configuration" section.
138 Then, try capturing the oops text (using a serial console or netconsole) post
139 the oops to the xenomai mailing list: "xenomai@xenomai.org", with the kernel
140 configuration you used to compile the failing kernel.
143 2.3. Kernel boots but does not print any message
144 ------------------------------------------------
146 Your distribution may be configured to pass the quiet option on the kernel
147 command line. In this case, the kernel does not print all the log messages,
148 however, they are still available using the dmesg command.
151 2.4. Xenomai: compiled for TSC, but CPU has no TSC
152 --------------------------------------------------
154 You selected a CPU which as a TSC ("Pentium classic", and above), but the CPU
155 on which you run the kernel has no TSC. This issue was resolved in the I-pipe
156 core for Linux 3.4, but for prior versions, you need to select a CPU without a
157 TSC when configuring the kernel, and recompile the kernel.
160 2.5. Xenomai has detected a CPU frequency of 0
161 ----------------------------------------------
163 This happens when running in emulators. In such a case, Xenomai can not run as
164 it needs to know the clock frequency.
166 This may also happen when using I-pipe core patch for Linux 3.2, compiled for a
167 CPU with a TSC, but running on a CPU without a TSC, as in the "Xenomai:
168 compiled for TSC case.
171 2.6. I-pipe: could not find timer for cpu #x
172 --------------------------------------------
174 See code -19.
177 2.7. Xenomai: Local APIC absent or disabled!
178 --------------------------------------------
180 See code -19.
183 2.8. Xenomai: SMI-enabled chipset found, but SMI workaround disabled
184 --------------------------------------------------------------------
186 First you should run the latency test under some load and see if you experience
187 any pathological latency ("pathological" meaning more than, say, 100
188 micro-seconds). If you do not observe any such latency, then this warning is
189 harmless, and if you find it annoying, you may add the parameter "xeno_hal.smi=
190 -1" on the kernel command line. You can skip the rest of this section.
192 If you observe any high latency then you have a problem with SMI, and this
193 warning was intended for you. But the Xenomai patched kernel parameters allow
194 you to enable two workarounds which may help you. These workarounds are enabled
195 by adding the parameter "xeno_hal.smi=1" on the kernel command line.
197 The first workaround which you should try is to disable all SMI sources. In
198 order to do this, simply boot with the parameter "xeno_hal.smi=1" on the kernel
199 command line. This option is the most reliable workaround, because when
200 enabled, no SMI can interfere with hardware interrupt management behind your
201 back and cause high latencies. Once this workaround enabled, you should run the
202 latency test again, verify that your high latency disappeared but most
203 importantly, verify that every peripheral you intend to use with Xenomai is
204 working properly.
206 If everything is working properly, then try and stress-test the system, and
207 check for overheating. If the motherboard sensors do not allow to check
208 temperature, and you get an unexplained reboot in the middle of the
209 stress-test, chances are that you have an overheating issue, otherwise, you are
210 done with the SMI workaround.
212 [Important] Important
213             if your system is over-heating you should not disable the SMI
214             globally as the SMI are probably needed for controlling the cooling
215             of your system, so disabling them globally may damage your system.
216             Try the next section. Otherwise, you are done with SMI.
218 If some peripheral is not working properly, then it probably needs SMI, in
219 which case you can not simply disable SMI globally, you will need to disable
220 all SMI sources on your system except the SMI needed by your peripheral. The
221 same goes if the system overheat, you have to find a way to keep the SMI source
222 which is controlling the thermal control enabled. This is a much less reliable
223 choice, since you have to know all SMI sources to disable them, one by one. In
224 order to choose this second workaround, check in the documentation for the
225 Intel chipset you use, for the documentation of the SMI_EN register. Then set
226 the "xeno_hal.smi_mask" parameter on the kernel command line with a value where
227 all bits set to 0 will be disabled when Xenomai starts.
229 You should then run the latency test again and verify that you do not observe
230 any high latency and that all your peripherals are functioning correctly. If
231 when running the latency test again, your peripheral is working properly and
232 you still observe high latencies, then you are out of luck, the peripheral you
233 want is likely to be the cause of such latencies.
236 2.9. Xenomai: system init failed, code -19
237 ------------------------------------------
239 The most probable reason is that Xenomai could not find a timer.
241 Check that you have not enabled one of the options in the "Kernel
242 configuration" section.
245 2.9.1. On x86
246 -------------
248 You will most likely also see the following message:
250 Xenomai: Local APIC absent or disabled!
251 Disable APIC support or pass "lapic" as bootparam.
253 Xenomai sends this message if the kernel configuration Xenomai was compiled
254 against enables the local APIC support (CONFIG_X86_LOCAL_APIC), but the
255 processor status gathered at boot time by the kernel says that no local APIC
256 support is available. There are two options for fixing this issue:
258   * either your CPU really has no local APIC hw, then you need to rebuild a
259     kernel with LAPIC support disabled, before rebuilding Xenomai against the
260     latter;
261   * or it does have a local APIC but the kernel boot parameters did not specify
262     to activate it using the "lapic" option. The latter is required since
263     2.6.9-rc4 for boxen which APIC hardware is disabled by default by the BIOS.
264     You may want to look at the file Documentation/kernel-parameters.txt from
265     the Linux source tree, for more information about this parameter.
268 2.9.2. On AMD x86_64
269 --------------------
271 You will most likely also see the following message:
273 I-pipe: cannot use LAPIC as a tick device
274 I-pipe: disable C1E power state in your BIOS
276 Xenomai sends this message if C1E option is enabled in a BIOS. To fix this
277 issue please disable C1E support in the BIOS. In some Award BIOS this option is
278 located in the Advanced BIOS Features→ menu (AMD C1E Support).
280 [Important] Important
281             Disabling AMD K8 Cool&Quiet option in a BIOS does not solve the
282             problem.
285 2.9.3. On ARM
286 -------------
288 If you see the following message:
290 Xenomai: hal/arm: hardware FPU support enabled but not available
292 It means that you enabled CONFIG_VFP and CONFIG_XENO_HW_FPU in the kernel
293 configuration, but the processor on which you are running the kernel has no
294 support for VFP. In that case, you have to recompile the kernel with
295 CONFIG_XENO_HW_FPU disabled.
298 2.9.4. On other supported platforms
299 -----------------------------------
301 As on x86, on other platforms where Xenomai shares the timer with Linux, the
302 timer is only used if it was not shut down by Linux. So you should check the
303 log for messages about disabled timers. You can also check /proc/timer_list to
304 see which timers are enabled. For instance, Xenomai on SMP systems requires
305 per-cpu local timers, so the local timers should be enabled. In case of doubt,
306 post a message to the xenomai mailing list: "xenomai@xenomai.org", sending:
308   * your kernel configuration
309   * the contents of /proc/timer_list run on the exact kernel which has the
310     issue
311   * the complete kernel boot log.
314 2.9.5. On a new I-pipe port
315 ---------------------------
317 You will most likely also see the following message:
319 I-pipe: could not find timer for cpu #x
321 Starting with the I-pipe patch for Linux 3.2, the timers provided by the I-pipe
322 patch to Xenomai are registered at run-time. So, you may lack a struct
323 ipipe_timer definition, and its registration with ipipe_timer_register() or
324 with the ipipe_timer member of the struct clock_event_device structure.
326 For an example on the ARM platform see this page: 
327 "http://www.xenomai.org/index.php/I-pipe-core:ArmPorting#The_general_case".
330 2.10. Xenomai: system init failed, code -22
331 -------------------------------------------
333 On the ppc64 platform, check whether CONFIG_PPC_64K_PAGES is defined in your
334 kernel configuration. If so, then you likely need to raise all Xenomai
335 parameters defining the size of internal heaps, such as
336 CONFIG_XENO_OPT_SYS_HEAPSZ, CONFIG_XENO_OPT_GLOBAL_SEM_HEAPSZ,
337 CONFIG_XENO_OPT_SEM_HEAPSZ and CONFIG_XENO_OPT_SYS_STACKPOOLSZ, so that (size /
338 64k) > 2. The default values for these parameters are currently based on the
339 assumption that PAGE_SIZE = 4k.
342 3. Problems when running the latency test
343 -----------------------------------------
345 The first test to run to see if Xenomai is running correctly on your platform
346 is the latency test. The following sections describe the usual reasons for this
347 test not to run correctly.
350 3.1. Xenomai: binding failed: Operation not permitted
351 -----------------------------------------------------
353 This error message means that you are trying to run the latency test as a
354 non-root user. Using Xenomai services requires root privileges (more precisely
355 CAP_SYS_NICE). However, you can allow a specific group to access Xenomai
356 services, by following the instructions on this page: 
357 "http://xenomai.org/index.php/Non-root_RT".
360 3.2. Xenomai: --enable-x86-sep needs NPTL and Linux 2.6.x or higher
361 -------------------------------------------------------------------
363 On the x86 architecture, the configure script option --enable-x86-sep allows
364 Xenomai to use the SYSENTER/SYSEXIT mechanism for issuing system calls.
366 However, this mechanism requires support from the libc. Currently, we know the
367 glibc with NPTL has this support, other libraries will cause Xenomai
368 applications to fail with this error message.
371 3.3. latency: failed to open benchmark device
372 ---------------------------------------------
374 You have launched latency -t 1 or latency -t 2 which both require the kernel to
375 have been compiled with the CONFIG_XENO_DRIVERS_TIMERBENCH option enabled.
378 3.4. Hardware tsc is not a fast wrapping one
379 --------------------------------------------
381 See the "ARM tsc emulation issues" section.
384 3.5. Xenomai: incompatible ABI revision level
385 ---------------------------------------------
387 Each Xenomai branch (2.1, 2.2, 2.3, 2.4, 2.5, 2.6,…) defines a kernel/user ABI,
388 so that it is possible to mix kernels and user-space supports of different
389 versions in the same branch. So, for instance, after having build a system with
390 a kernel and user-space support using Xenomai 2.6.0, it is possible to update
391 the user-space support to Xenomai 2.6.1 without changing the kernel.
393 However, it is not possible to mix kernel and user-space supports of different
394 branches.
396 A common reason for this error is when you run a kernel compiled with Xenomai
397 2.6.1 support on a system where you have a user-space installed by your Debian
398 based Linux distribution (notably Ubuntu) from the 2.5 branch, this can not
399 work, the two branches use different ABIs. See README.INSTALL for details on
400 how to compile a user-space support, or to build a new xenomai-runtime Debian
401 package.
403 If you compiled and installed the correct Xenomai user-space support, there are
404 probably files on your system remaining from a previous installation.
407 3.6. Xenomai: incompatible feature set
408 --------------------------------------
410 Since kernel-space support and user-space support are compiled separately, each
411 Xenomai application checks, at startup, whether the kernel and user-space
412 supports have been configured with compatible options. If you see this message,
413 it means they have not. See README.INSTALL for further details. The following
414 sections detail the most frequent reasons for this message.
417 3.6.1. missing="kuser_tsc"
418 --------------------------
420 See the "ARM tsc emulation issues" section.
423 3.6.2. missing="sep"
424 --------------------
426 On the x86 architecture, the configure script option --enable-x86-sep allows
427 Xenomai to use the SYSENTER/SYSEXIT mechanism for issuing system calls.
429 However, this mechanism requires a recent kernel (2.6 or higher).
432 3.6.3. missing="smp/nosmp"
433 --------------------------
435 On some SMP-capable architectures, for kernel-space and user-space supports to
436 be compatible, both should be compiled with the same setting for SMP.
438 SMP support in kernel-space is enabled with the CONFIG_SMP option.
440 For these architectures, SMP support in user-space is enabled by passing
441 --enable-smp to the configure script, and disabled by passing --disable-smp
442 (SMP is enabled by default on some platforms).
444 Other SMP-capable architectures may run userland code built with --enable-smp
445 or --disable-smp over the same kernel indifferently, at no noticeable
446 performance cost. These architectures never receive such SMP-related error.
449 3.6.4. missing="tsc"
450 --------------------
452 This error is specific to the x86 architecture. You enabled tsc in user-space
453 by passing the --enable-x86-tsc option, but you selected a processor when
454 configuring the kernel which has no tsc.
456 So, if your processor has a tsc (all Intel processors starting with some
457 Pentium and Pentium Pro have a tsc), you probably mis-configured your kernel
458 and should select the exact processor you are using in the kernel configuration
459 and recompile it.
461 If your processor does not have a tsc, you should not pass the --enable-x86-tsc
462 option to the configure script.
465 3.7. Xenomai: kernel/user tsc emulation mismatch
466 ------------------------------------------------
468 See the "ARM tsc emulation issues" section.
471 3.8. Xenomai: native skin or CONFIG_XENO_OPT_PERVASIVE disabled
472 ---------------------------------------------------------------
474 Possible reasons for this error are:
476   * you booted a kernel without Xenomai or I-pipe support, a kernel with I-pipe
477     and Xenomai support should have a /proc/ipipe/version and /proc/xenomai/
478     version files;
479   * the kernel you booted does not have the CONFIG_XENO_SKIN_NATIVE and
480     CONFIG_XENO_OPT_PERVASIVE options enabled;
481   * Xenomai failed to start, check the "Xenomai or I-pipe error in the kernel
482     log" section;
483   * you are trying to run Xenomai user-space support compiled for x86_32 on an
484     x86_64 kernel.
487 3.9. latency: not found
488 -----------------------
490 On the ARM platform this message happens when there is a mismatch between
491 kernel and user for the EABI setting: for instance you compiled the user-space
492 support with a toolchain generating OABI code, and are trying to run the result
493 on a kernel with CONFIG_AEABI but without CONFIG_OABI_COMPAT. Or vice versa,
494 when running user-space compiled with an EABI toolchain on a kernel without
495 CONFIG_AEABI.
498 3.10. Xenomai: watchdog triggered (period too short?)
499 -----------------------------------------------------
501 Xenomai watchdog has stopped the latency test because it was using all the CPU
502 in primary mode. This is likely due to a too short period, re-run the latency
503 test passing a longer period using the -p option.
506 3.11. Xenomai: Your board/configuration does not allow tsc emulation
507 --------------------------------------------------------------------
509 See the "ARM tsc emulation issues" section.
512 3.12. the latency test hangs
513 ----------------------------
515 The most common reason for this issues is a too short period passed with the -p
516 option, try increasing the period. If you enable the watchdog (option
517 CONFIG_XENO_OPT_WATCHDOG, in your kernel configuration), you should see the
518 "Xenomai: watchdog triggered (period too short?)" message.
521 3.13. the latency test shows high latencies
522 -------------------------------------------
524 The latency test runs, but you are seeing high latencies.
526   * make sure that you carefully followed the "Kernel configuration" section.
527   * make sure that you do not have an issue with SMIs, see the section about
528     SMIs.
529   * if you have some legacy USB switch at BIOS configuration level, try
530     disabling it.
531   * if you do not have this option at BIOS configuration level, it does not
532     necessarily mean that there is no support for it, thus no potential for
533     high latencies; this support might just be forcibly enabled at boot time.
534     To solve this, in case your machine has some USB controller hardware, make
535     sure to enable the corresponding host controller driver support in your
536     kernel configuration. For instance, UHCI-compliant hardware needs
537     CONFIG_USB_UHCI_HCD. As part of its init chores, the driver should reset
538     the host controller properly, kicking out the BIOS off the concerned
539     hardware, and deactivate the USB legacy mode if set in the same move.
540   * if you observe high latencies while running X-window, try disabling
541     hardware acceleration in the X-window server file. With recent versions of
542     X-window, try using the fbdev driver. Install it (Debian package named 
543     xserver-xorg-video-fbdev for instance), then modifiy the Device section to
544     use this driver in /etc/X11/xorg.conf, as in:
546 Section "Device"
547         Identifier  "Card0"
548         Driver      "fbdev"
549 EndSection
551 With olders versions of X-window, keep the existing driver, but add the
552 following line to the Device section:
554         Option "NoAccel"
557 3.14. ARM tsc emulation issues
558 ------------------------------
560 In order to allow applications to measure short durations with as little
561 overhead as possible, Xenomai uses a 64 bits high resolution counter. On x86,
562 the counter used for this purpose is the time-stamp counter, aka "tsc".
564 ARM processors generally do not have a 64 bits high resolution counter
565 available in user-space, so this counter is emulated by reading whatever high
566 resolution counter is available on the processor, and used as clock source in
567 kernel-space, and extend it to 64 bits by using data shared with the kernel. If
568 Xenomai libraries are compiled without emulated tsc support, system calls are
569 used, which have a much higher overhead than the emulated tsc code.
571 In recent versions of the I-pipe patch, SOCs generally select the
572 CONFIG_IPIPE_ARM_KUSER_TSC option, which means that the code for reading this
573 counter is provided by the kernel at a predetermined address (in the vector
574 page, a page which is mapped at the same address in every process) and is the
575 code used if you do not pass the --enable-arm-tsc or --disable-arm-tsc option
576 to configure, or pass --enable-arm-tsc=kuser.
578 This default should be fine with recent patches and most ARM SOCs.
580 However, if you see the following message:
582 Xenomai: incompatible feature set
583 (userland requires "kuser_tsc...", kernel provides..., missing="kuser_tsc")
585 It means that you are either using an old patch, or that the SOC you are using
586 does not select the CONFIG_IPIPE_ARM_KUSER_TSC option.
588 So you should resort to what Xenomai did before branch 2.6: select the tsc
589 emulation code when compiling Xenomai user-space support by using the
590 --enable-arm-tsc option. The parameter passed to this option is the name of the
591 SOC or SOC family for which you are compiling Xenomai. Typing:
593 /patch/to/xenomai/configure --help
595 will return the list of valid values for this option.
597 If after having enabled this option and recompiled, you see the following
598 message when starting the latency test:
600 Xenomai: kernel/user tsc emulation mismatch
604 Hardware tsc is not a fast wrapping one
606 It means that you selected the wrong SOC or SOC family, reconfigure Xenomai
607 user-space support by passing the right parameter to --enable-arm-tsc and
608 recompile.
610 The following message:
612 Xenomai: Your board/configuration does not allow tsc emulation
614 means that the kernel-space support for the SOC you are using does not provide
615 support for tsc emulation in user-space. In that case, you should recompile
616 Xenomai user-space support passing the --disable-arm-tsc option.
618 4. switchtest fails with "pthread_create: Resource temporarily
619 unavailable"
621 The switchtest test creates many kernel threads, this means that the options
622 CONFIG_XENO_OPT_SYS_HEAPSZ and CONFIG_XENO_OPT_SYS_STACKPOOLSZ, in your kernel
623 configuration, should be configured to large enough values. Try increasing them
624 and recompiling the kernel.
627 5. Known Bugs and Limitations
628 -----------------------------
631 5.1. 2.6.2/x86
632 --------------
634 2.6.2 (like any previous Xenomai release) does not handle the extended
635 processor state (xsave/xrstor) yet.
637 2.6.2 automatically disables this CPU feature at boot when the host kernel
638 detects it, so no action is to be taken by the user. However, this feature
639 shall be disabled manually for older Xenomai releases, by passing the "noxsave"
640 parameter on the kernel command line (see Documentation/kernel-parameters.txt).
642 Failing to do so, running with extended processor state support enabled on
643 these Xenomai releases beget random execution errors in userland, typically
644 when the switchtest program runs in the background, due to incorrect FPU
645 management in real-time mode.
648 6. Problem with my code (not Xenomai code)
649 ------------------------------------------
652 6.1. "Warning: <service> is deprecated" while compiling kernel code
653 -------------------------------------------------------------------
655 Where <service> is a thread creation service, one of:
657   * cre_tsk
658   * pthread_create
659   * rt_task_create
660   * sc_tecreate or sc_tcreate
661   * taskSpawn or taskInit
662   * t_create
664 Starting with Xenomai 3, the skins will not export their interface to kernel
665 modules anymore, at the notable exception of the RTDM device driver API, which
666 by essence must be used from kernel space for writing real-time device drivers.
667 Those warnings are there to remind you that application code should run in
668 user-space context instead.
670 The reason for this is fully explained in the project Roadmap document, see
671 "What Will Change With Xenomai 3": 
672 "http://www.xenomai.org/index.php/Xenomai:Roadmap#What_Will_Change_With_Xenomai_3".
674 You may switch those warnings off by enabling the
675 CONFIG_XENO_OPT_NOWARN_DEPRECATED option in your kernel configuration, but
676 nevertheless, you have been WARNED.
679 6.2. "Xenomai: process memory not locked (missing mlockall?)" at startup
680 ------------------------------------------------------------------------
682 In order to avoid unwanted transitions to secondary domain, an application
683 using Xenomai services should call, before any Xenomai service:
685 mlockall(MCL_CURRENT | MCL_FUTURE);
687 Even if your system has no swap, the Linux kernel may "swap out" some pages,
688 for instance the program pages which are known to exist on flash or on disk,
689 causing page faults (and a secondary mode switch for xenomai threads running in
690 primary mode) when the program tries to access this page.
692 So, Xenomai libraries abort when an application which has not called mlockall
693 is detected.
695 Note that some skins allow mlockall to be called automatically by Xenomai
696 libraries startup, this is enabled when configuring Xenomai user-space support
697 with the configure script.
699 See configure --help.
702 6.3. High latencies when transitioning from primary to secondary mode
703 ---------------------------------------------------------------------
705 Such transition requires to wake up the Linux task underlying your real-time
706 thread when running in secondary mode, since the latter needs to leave the
707 Xenomai domain for executing under the control of the regular Linux scheduler.
708 Therefore, it all depends on the Linux kernel granularity, i.e. its ability to
709 reach the next rescheduling point as soon as such wakeup has been requested.
710 Additionally, the task wakeup request is performed from a virtual interrupt
711 handler which has to be run from the Linux domain upon request from the Xenomai
712 domain, so the time required to handle and dispatch this interrupt outside of
713 any critical kernel section also needs to be accounted for. Even if the kernel
714 granularity improves at each new release, there are still a few catches:
716   * Although the use of DMA might induce additional interrupt latency due to
717     bus bandwidth saturation, disabling it for disk I/O is a bad idea when
718     using mixed real-time modes. This is due to the fact that using PIO often
719     leads to lengthy non-preemptible sections of kernel code being run from
720     e.g. IDE drivers, from which pending real-time mode transitions could be
721     delayed. In the same vein, make sure that your IDE driver runs in unmasked
722     IRQ mode. In any case, a quick check using the "hdparm" tool will help:
724 # hdparm -v /dev/hda
726 /dev/hda:
727  ...
728  unmaskirq    =  1 (on)
729  using_dma    =  1 (on)
730  ...
732   * Even if your application does not directly request disk I/O, remember that
733     the kernel routinely performs housekeeping duties which do, like filesystem
734     journal updates or VM commits to the backing store, so latencies due to
735     improper disk settings may well trigger apparently randomly. Of course, if
736     your application only operates in primary mode during all of its time
737     critical duties, i.e. never request Linux syscalls, it will not be
738     adversely affected by DMA deactivation or IDE masking, since it will remain
739     in the Xenomai domain, and activities from such domain can preempt any
740     activity from the Linux domain, including disk drivers.
743 6.4. Any Xenomai service fails with code -38 (ENOSYS)
744 -----------------------------------------------------
746 Possible reasons for this error are:
748   * you booted a kernel without Xenomai or I-pipe support, a kernel with I-pipe
749     and Xenomai support should have a /proc/ipipe/version and /proc/xenomai/
750     version files;
751   * the kernel you booted does not have the CONFIG_XENO_SKIN_* option enabled
752     for the skin you use, or CONFIG_XENO_OPT_PERVASIVE is disabled;
753   * Xenomai failed to start, check the "Xenomai or I-pipe error in the kernel
754     log" section;
755   * you are trying to run Xenomai user-space support compiled for x86_32 on an
756     x86_64 kernel.
759 6.5. My application reserves a lot of memory
760 --------------------------------------------
762 Your user-space application unexpectedly reserves a lot of virtual memory, as
763 reported by "top" or /proc/<pid>/maps. Sometimes OOM situations even appear
764 during runtime on systems with limited memory.
766 The Xenomai tasks are underlaid by native POSIX threads, for which a huge
767 default amount of stack space memory is reserved by the native POSIX support,
768 usually 8MiB per thread, so the overall allocated space is about
769 8MiB * +nr_threads+, which are likely to be locked using the mlockall()
770 service, which in turn even commits such space to RAM.
772 Unfortunately, this behaviour cannot be controlled by the "stacksize" parameter
773 passed to the various thread creation routines, i.e. the latter is about
774 limiting the addressable stack space on a per-thread basis, but does not affect
775 the amount of stack memory initially reserved by the POSIX library. A
776 work-around consists of setting a lower user-limit for initial stack
777 allocation, like calling:
779 ulimit -s <initial-size-in-kbytes>
781 in your parent shell before running your application (defaults to 8192).