This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Help With Linux Latency Issues (maybe regarding USB)

Other Parts Discussed in Thread: OMAP-L138, OMAPL138

hi there,

currently i'm facing a very annoying problem with linux and the OMAP-L138.

i'm working on a custom board with a OMAPL138 SOM-M1 module on it. i'm using the DSP and the ARM part of this processor.

DSP generates data and shares it with the ARM via CMEM (4 Buffers). on the ARM there runs linux (kernel 2.6.37 from davinci psp release 03.21.00.04). the ARM applications has 3 threads running. one of them streams the data from CMEM buffers via gadgetfs (interrupt transfer) to the host pc. every 6,6ms there has to be one buffer of data (8192 bytes) transmitted.

this setup mostly works as expected. but sometimes (the time of occurrence is unpredictable), i recognize a delay of 1,44s for the usb writer thread (measured on ARM). which of course causes massive data loss.

i try to investigate this error now for several weeks... for now i have no idea where to search further.

it looks like the writer thread does not get scheduled  or something is blocking for this long time. so i tried to play around with realtime thread priorities. with no effect.

i also deactivated any communication to/from DSP to eliminate effects from that side.

is it possible, that a module of linux can cause such a huge latency in scheduling? how can i investigate such latency problems?

any help or hint is appreciated

thank you for your help

peter 

  • Hi Peter,

    Just to help you in debugging,
    1. is there any spurious process/thread running at the time of the error ?
    May be you can take a log with "top" utility running in background.
    So if some process is taking up all the processor at that time you can detect them.

    2. Are you using some locks for protection against global resource ? is it creating problem because of some rare sequence of execution?

    3. I would doubt Linux module for latency at last, because they are generally well tested for this scenarios.

    4. Will using gdb for multithreaded application debugging help ?

    Thank you,

    Regards,
    Ankur

  • hi ankur,

    first of all... thank you for your help...

    i already used top and ps to check running processes and threads.

    beside my threads i didn't recognize any abnormality... although i think with these tools its difficult to track... because you only get a snapshot of one moment and its hard to get exactly the moment of this latency...

    i also already checked for locks and race conditions before... in my  own program code i can exclude this source of error... but i don't know exactly what the driver modules do...

    because of its complexity i didn't try gdb at the moment...

    is it possible, that the usb host (pc) stalls the gadgetfs write function for any reason?

    thank you for your help 

    peter

     

  • Hi Peter,

    Is host Linux machine ? Or is it another board, if so what kind of file system is used  ?
    Did you write (host pc)application for receiving this 8k chunks ?

    I am not sure about gadgetfs write function,
    But if write is getting stall for some resons, i would check following..
    1. Is data buffer is being "synced" after transferring some amout of data.
    2. Is your host pc application does sync?
    3. Do you see possibility of out of memory issuse at host pc ?

    Regards,
    Ankur