Decided to run some of my motion control applications on the board (I bought around 30 of the board ). For that I need an RT Kernel which allows preemption in the kernel code to minimize latency. Despite lacking any support from the vendor, I managed to patch the latest 3.10.99 kernel to 3.10.100-rt110 and tested the latency. The figures are not really good but still usable:
Without background stress:
➜ rt-tests git:(master) ✗ sudo ./cyclictest -a -t -n -p99
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.38 0.64 0.81 1/145 19377
T: 0 (17893) P:99 I:1000 C: 125668 Min: 0 Act: 19 Avg: 14 Max: 158
T: 1 (17894) P:99 I:1500 C: 83778 Min: 0 Act: 19 Avg: 14 Max: 150
T: 2 (17895) P:99 I:2000 C: 62834 Min: 0 Act: 19 Avg: 14 Max: 117
T: 3 (17896) P:99 I:2500 C: 50267 Min: 0 Act: 19 Avg: 14 Max: 86
System under high load by stress -c 4 -i 1 -m 1 --vm-bytes 128M -t 100s
➜ rt-tests git:(master) ✗ sudo ./cyclictest -p 99 -t 4 -n -a
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 7.77 3.95 2.01 9/160 23279
T: 0 (21233) P:99 I:1000 C: 285193 Min: 0 Act: 16 Avg: 15 Max: 342
T: 1 (21234) P:99 I:1500 C: 190122 Min: 0 Act: 16 Avg: 16 Max: 320
T: 2 (21235) P:99 I:2000 C: 142596 Min: 0 Act: 16 Avg: 17 Max: 254
T: 3 (21236) P:99 I:2500 C: 114077 Min: 0 Act: 16 Avg: 15 Max: 190
You can see the latency is well below 400us, which is well suitable for normal control purposes.
The code lies here: https://github.com/ProfFan/bubblegum96-linux-rt
Lazy man’s precompiled kernel : MEGA
Build the kernel by:
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make bubblegum_linux_defconfig
make oldconfig
Now choose 4 - Basic Preempt at the prompt. Quickly skip all others. Then just
make -j8 Image
make modules
For folks who wants to manually patch the kernel, here are my notes.
Happy hacking!