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.

Linux scheduler: how to prioritize application after a hardware ISR?

Hi!

I have dvsdk 3.10.xx.xx on the dm6467T.  I am having a problem getting my application to respond quick enough to an ISR callback in the driver.  What are my options to optimize the linux scheduler to be more like a real time OS? 

Here is my scenario: 

I am using a TSIF driver with an automatic DMA in to CMEM.  This works fine.  In fact, perfect - it is fast enough and keeps up with 60mHz that the TSIF RX module can handle.

However, in my application, I am using the wait_for_completion_interruptible kernel functions.  This function is designed to set a flag that the application checks and that the ISR sets.  When the DMA completes in my driver, it triggers an ISR which sets this shared flag.   The application is waiting for the flag to kick of the encoder on the DSP. 

Sounds ok - except that the linux scheduler doesn't "come around" to my application quick enough!!!  When the application checks the flag and it is not set, it releases the CPU to other threads and by the time it comes back to this thread, I might have missed two ISRs!

Another point is that I have 10 threads running and each thread is expected to get an ISR about every 125ms becuase the DMA is sequenctially filling each thread's buffer.  I can't beleive that the linux scheduler is not coming around to each thread every 125ms.  That seems ridiculous for something that is supposed to be an embedded system.  The threads are not doing any memcpys becuase it is being done by the DMA.  All these routines do is wait_for_completion_interruptible and kick off the encoder on the DSP.  And the encoders are supposed to be able to do 60fps (for 720p)!  I am just asking for 10fps.

Is there a way to better sychronize the application and the ISR?   Can I address the application from the driver instead of the application polling the flag?  are the examples of this that I can follow?  What configurations are available to change and test with?  Are there kernel options?  I tried a few things with thread priority but that doesn't seem to help much.  I hope you have some ideas!

Also, if this is not possible - I am out of ideas!  Is it possible to call Codec Engine functions from a driver???  Can I setup the codecs from user space and just "kick them off" from driver space?  What are my options here?

Thanks,

Brandy