zhanisch
Posts: 4
Joined: Fri Jan 24, 2014 9:57 pm

Is there any linux kernel with RT patch that is working?

Fri Jan 24, 2014 10:17 pm

Hi,

I tried linux kernel 3.2 3.6 and 3.10 from the Raspberryi Pi repository applying RT patch.

Compiling 3.10 I got this error:
CC lib/sort.o
CC lib/parser.o
CC lib/bust_spinlocks.o
CC lib/kasprintf.o
CC lib/scatterlist.o
lib/scatterlist.c: In function ‘sg_miter_stop’:
lib/scatterlist.c:537:4: error: implicit declaration of function ‘pagefault_disabled’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[1]: *** [lib/scatterlist.o] Error 1
make: *** [lib] Error 2

Compiling linux kernel 3.2 first I got compilation error in the sound driver, but I solved it removing from the kernel config. After rebooting the system is hanging at sd/mmc driver.

Trying the kernel 3.6 the system is hanging too at network driver.

Can anyone give me a kernel version that is compilable with rt patch and it is working?

Many thanks!

zhanisch
Posts: 4
Joined: Fri Jan 24, 2014 9:57 pm

Re: Is there any linux kernel with RT patch that is working?

Sun Jan 26, 2014 10:06 am

Okay, I solved the compilation error:
I inserted at the beginning of scatterlist.c

#include <linux/sched.h>

After that I could compile it. I missed this too:

"On the RPI, edit /boot/cmdline.txt. Add this option:

Code: Select all
sdhci_bcm2708.enable_llm=0"
(From here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=39951)

But the starting up is not stable. Sometime the system is hanging, sometime is ok.

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: Is there any linux kernel with RT patch that is working?

Mon Jan 27, 2014 1:59 pm

I really have no idea about the low level issues of RT_PREEMPT on rpi, I have only patched and compiled the kernel as others have suggested.

Its a few months since I tried compiling, but it all seemed to work for me last time (rather poor RT performance though)

I think it would have been better if you posted to the original RT_PREEMPT thread: .raspberrypi.org/phpBB3/viewtopic.php?f=29&t=39951

I think there should be all the information you require on that thread?

I heard that there are some prepackaged xenomai and RT_PREEMPT kernels for raspbian, you will have to google for those yourself though.

some debian packages that may be useful :
http://packages.debian.org/source/wheezy/xenomai
http://packages.debian.org/squeeze/rt-tests

Getting the .config file correct is a large part of the task, but I think you really need to be a kernel hacker to fix the performance issues?

I am going to be giving the 3.12 kernel another try and maybe actually look at profiling and tracing it this time, I doubt I will have much success as I don't have the time to learn everything about RT_PREEMPT. If I manage to get 3.12 to run with reasonable ~100us max latency in all situations then I will post an update.

It may be worth posting a PM to some of the contributors to the original RT thread as they seem far more knowledgeable than I.

zhanisch
Posts: 4
Joined: Fri Jan 24, 2014 9:57 pm

Re: Is there any linux kernel with RT patch that is working?

Mon Jan 27, 2014 5:27 pm

Thanks for the information.

I've managed to compile the version 3.2 (but I had to remove the sound driver). In this way I got a workable RT kernel!

Here is the results:
sudo ./cyclictest -t1 -p 99 -n -i 10000 -l 10000
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 2.38 2.09 1.03 1/137 2711

T: 0 ( 2684) P:99 I:10000 C: 9999 Min: 31 Act: 49 Avg: 58 Max: 116

uname -a
Linux raspberrypi 3.2.51-rt72 #1 PREEMPT RT Mon Jan 27 06:55:15 UTC 2014 armv6l GNU/Linux

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: Is there any linux kernel with RT patch that is working?

Mon Feb 03, 2014 9:02 pm

zhanisch wrote:Thanks for the information.

T: 0 ( 2684) P:99 I:10000 C: 9999 Min: 31 Act: 49 Avg: 58 Max: 116

uname -a
Linux raspberrypi 3.2.51-rt72 #1 PREEMPT RT Mon Jan 27 06:55:15 UTC 2014 armv6l GNU/Linux
I have looked at the most recent version of 3.2 kernel from rpi kernel git (3.2.27) and it does not seem much of an improvement since lastime I tried it. There were quite a lot of patch rejects which I had to manually edit so maybe I made some mistake?

I also used a more recent patch than yours (https://www.kernel.org/pub/linux/kernel ... 7.patch.gz)

I think the max latency with your cyclictest commandline was about 120us when run on a single bash login idling, but if I open another terminal and do anything it jumps to 2000us max, average always seems around 37us. There does seem to be definite problems with keyboard events on the usb with the kernel at any moderate load.

I then notice that you have what maybe a mainline kernel version (3.2.51), where did you download the source? kernel.org tarball or some other git repo?

Also have you thoroughly tested the system while running cyclictest?

i.e. run cyclictest while running X and try switching virtual terminals, do some network transfers http/ftp/ssh, plug in and unplug some usb devices.

Also does the videocore access work or are there problems using the VCHIQ?

Nice to see someone else taking an interest in RT_PREEMPT, I hope you have more luck than I do and can offer me some help :P

Return to “Automation, sensing and robotics”