I got LinuxCNC 2.5 to run on an x86 with Xenomai kernel threads, by replacing RTAI calls by their Xenomai equivalents.
Initial results look promising. This is still unpolished and not ready for a merge yet - I'm publishing this at this stage to enable feedback. - Michael ---README.Xenomai from http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/xenomai-integration-mah-kernel -- LinuxCNC on Xenomai ------------------- This is a development snapshot of LinuxCNC running on Xenomai 3.2.21 with kernel threads; note that eventually also the Xenomai user thread branch will be merged as this is the proposed route by the Xenomai road map. Status ------ As of now, this has been tried on x86 only. ARM and others might need some work on header files (some inline assembly) and the rtapi_math_i386.h code needs to be ported to ARM, or replaced by library routines from src/rtapi/xeno_math. Build requisites: ----------------- You need: - a machine running Ubuntu 10.04 lts - a 3.2.21 kernel with Xenomai 2.6.1 patches applied (see below for packages) - the Xenomai 2.6.1 userland support package configured with --enable-dlopen-skins - a grub configuration which grants Xenomai permissions to your userid It is ok to install on a LinuxCNC CD installed machine; the kernel and the Xenomai userland support packages will be 'ships in the night" with respect to the RTAI installation. You can build under RTAI; to run it, of course you need to boot the 3.2.21 xenomai kernel. Package download: ----------------- you will need from http://static.mah.priv.at/public/xenomai-debs/: libxenomai-dev_2.6.1_i386.deb libxenomai1_2.6.1_i386.deb linux-headers-3.2.21-xenomai+_0.1_i386.deb linux-image-3.2.21-xenomai+_0.1_i386.deb xenomai-runtime_2.6.1_i386.deb Install these packages as root with 'dpkg -i *.deb'. if you want to build yourself, eg to explore kernel options, try these repos: Kernel: ------- http://git.mah.priv.at/gitweb/linuxcnc-kernel.git/shortlog/refs/heads/linuxcnc-3.2.21-xenomai-x86 see files under linuxcnc: http://git.mah.priv.at/gitweb/linuxcnc-kernel.git/tree/93403bfda8fc98061f8adceac605203ae4424626:/linuxcnc Xenomai userland support: ------------------------- http://git.mah.priv.at/gitweb/xenomai-linuxcnc.git/shortlog/refs/heads/linuxcnc-v2.6.1 again, see files under linuxcnc: http://git.mah.priv.at/gitweb/xenomai-linuxcnc.git/tree/79a0c12f7f56b9f777a56eb40ef09b9a26c2b96b:/linuxcnc Grub configuration: ------------------- This branch supports binding the RT thread(s) to an isolated CPU. If you have a multi-core CPU, like an Atom DW525, add "isolcpus=1" to the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub, then run 'update-grub' as root. Building: --------- Fetch the xenomai-integration-mah-kernel from git.mah.priv.at like so: $ git remote add mah git://git.mah.priv.at/emc2-dev.git $ git fetch mah $ git branch --track xenomai-integration-mah-kernel mah/xenomai-integration-mah-kernel $ git checkout xenomai-integration-mah-kernel $ cd emc2-dev/src $ sh autogen.sh $ ./configure --with-threads=xenomai-kernel If you compile under RTAI, you need to point configure to kernel config file like so: $ ./configure --with-threads=xenomai-kernel --with-kernel=/boot/config-3.2.21-xenomai+ Then make, and sudo make setuid. Running: -------- latency-test and various config work as usual. I tried a mesa 5i25 config which seems to work fine. Observing status: ----------------- Xenomai has some /proc support. To see the shared memory segments: mah@atom$ cat /proc/xenomai/heap TOTAL USED PAGESZ NAME 8192 80 4096 global sem heap 259584 64 512 main heap 129536 32768 512 stack pool 12288 12288 4096 rt_heap: rtapi_master <--- rtapi_data 262144 262144 4096 rt_heap: shm-1 <--- the HAL segment 8192 0 4096 private sem heap [1492] 8192 0 4096 private sem heap [1495] While running latency-test: mah@atom$ cat /proc/xenomai/stat CPU PID MSW CSW PF STAT %CPU NAME 0 0 0 0 0 00500080 96.4 ROOT/0 1 0 0 39745053 0 00500080 95.6 ROOT/1 1 0 0 39042570 0 00100084 4.1 fast <--- HAL thread name 1 0 0 976053 0 00100084 0.1 slow <--- HAL thread name 0 0 0 40051620 0 00000000 3.5 IRQ2312: [timer] /proc/rtapi/status has three extra counters for realtime delays: mah@atom$ cat /proc/rtapi/status ******* RTAPI STATUS ******** RT Modules = 3 UL Modules = 4 Tasks = 2/64 Shared memory = 1/32 FIFOs = 0/32 Semaphores = 0/64 Interrupts = 0 RT task CPU = 1 <---- isolcpus at work: RT thread on CPU #1 Timer status = Running Timer period = 25000 nSec Wait errors = 0 <---- how many times the scheduling deadline was missed Last overrun = 0 <---- last # of overruns reported Total overruns = 0 <---- total # of overruns reported Message level = 1 Issues ------ - kernel options have not been explored thoroughly, e.g more specific CPU support. - latency: on my Atom board I get very good figures EXCEPT a random overrun,esp when networking is involved On RTAI, the latency-test figures are roughly 11/17 usec with Xenomai, I have around 9/12usec except for an occasional spike at ca 50usec in the RT thread - Precise: this builds in principle; the kernel math module (src/rtap/xeno_math) needs work to export the math symbols properly under precise - 2.6.38.8 xenomai kernel: build + run is ok, but modules are marked as '[permanent]' and cannot be unloaded; this needs tracking down. This does not happen on the 3.2.21 kernel. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
