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.

2 Answers 2

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

1
  • According to that link, down in that thread, this problem was related to "FIQ exception handler that the driver of the Synopsis DWC host USB controller is using by default" and is now resolved. The original patch is introduced here, and a more recent rebased version is here. Still not in the main RPi kernel as of today.
    – tanius
    Feb 24, 2018 at 17:01
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

10
  • Thanks Alexey for your input. I would like to add note that I ran the script that I mentioned before. I ran this script only with no other applications and I got this freezing situation. In addition that this script doesn't need any building procedures, it is just writing the time in a file. Do u think that I miss any building here?
    – moibrahim
    Mar 1, 2016 at 12:14
  • @moibrahim rebuild a GCC and all the libraries for GCC(mpfr,gmp,mpc,cloog,isl), rebuild binutils, bash and coreutils(for date command), let's take a look what it will bring us Mar 1, 2016 at 12:20
  • i tried this before and still freezing. I can send u kernel file if u want to check at ur side
    – moibrahim
    Mar 1, 2016 at 12:29
  • @moibrahim so you have recompiled all the things on your RPi - and it still freezes?! Mar 1, 2016 at 12:31
  • yes it freezes and giving no response, I have to unplug the power if i want to restart the system
    – moibrahim
    Mar 1, 2016 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.