4

I have patched PREEMPT-RT for Raspbian Linux kernel. It works fine for normal operations (web browsing or short time programs) the following is the output of uname -a of my Rapsberry Pi 2 after patching

Screenshot of uname -a output

My problem is this systems is freezing for some code that I am running. I tried to make a simple code to calculate how long the Raspberry Pi 2 can stay without freezing. I used the following code

#!/bin/bash

cd ~/Scripts/running_time

export start_time=$(date +'%Y/%m/%d___%H:%M:%S') 
printf $start_time > up_time

while true
do

printf 'start time %s \n end at %s' $start_time, $(date +'%Y/%m/%d___%H:%M:%S') > up_time
sleep 1

done

What I got is it freezes after about 4 hours. I have other code and it freezes after 1 hour and sometimes after 10 minutes.

I have monitored system performance remotely using ssh with htop, the following is observed at last moment before freezing:

RAM consumption: total memory consumption about 120 M

running script load: only 6 M 

So for me:

  • Raspbian without the PREEMPT-RT patch is working without freezing.

  • Raspbian with the PREEMPT-RT patch without any running applications is working without freezing.

  • Raspbian with the PREEMPT-RT patch running applications is freezing.

I hope someone has suggestions or explanations for solving this issue please.


UPDATE: 16.10.2016

I have worked on solving this problem for almost 1 year. Simply I wasn't able to solve it. But I will try to describe what actions I had taken maybe I can shorten sometime for people who are suffering from the same problem:

  1. for applying the PREEMPT-RT patch, please use this link http://www.frank-durr.de/?p=203 as it is the best resource explaining how to apply the PRREMPT-RT.

  2. you are free to execute sudo apt-get update. it doesn't matter.

  3. to predict if your linux going to freeze or not, use ltp test suite

    wget http://downloads.sourceforge.net/ltp/ltp-full-20150420.tar.bz2
    

    there you can build realtime test cases:

    tar xvf ltp-full-20150420.tar.bz2
    cd ltp-full-20150420
    ./configure --with-realtime-testsuite
    cd testcases/realtime
    make
    

    then execute a test called pthread_kill_latency (sudo ./run.sh -t func/pthread_kill_latency -l 25) usually the linux will freeze in first 5 running.

  4. When freezing, switch off your power then switch it on again, open log message nano /var/log/syslog maybe you can find a clue what happend before freezing immediately.

That is all my conclusion. I had to stop searching for that problem. If someone found a solution, I will be grateful if he/she shares with us here.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
moibrahim
  • 199
  • 1
  • 2
  • 10

2 Answers2

3

If somebody finds this via search engines:

Re-compiling anything won't help at all, don't waste your time on that.

It's simply an issue with the Kernel and/or the Raspberry Pi firmware.

See here: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=159170

0

It's simple =) The apps that causing a freeze condition you're experiencing are installed from binary distributions(packages via apt-get, binary downloads, etc) - recompile all the stuff with your kernel headers and sources to properly utilize your RT patch in your software. This will stop this kind of truble : it also happens by the same mechanism in case of compatibility implications between kernel/modules, kernel/software etc. If you will still have such problems after a FULL rebuild - write here so I'll be able to help you further

Alexey Vesnin
  • 926
  • 10
  • 17