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.

Usage of SysLink from interrupt (atomic) in Linux

We are using SysLink in a way that I think is incompatible with how it is expected to be used and are seeking guidance for options to fix this.

Here’s what we are doing.

On the ARM core in Linux we have a tunnel network driver that uses SysLink to provide network packets to the DSP. The DSP then tunnels these over a serial link. The segregation is such because the DSP is in control of the serial port – it sends its own data across it and also the network data received from the ARM over SysLink.

This works OK for UDP communications. But TCP communications fail. We’ve isolated the failure to a TCP retransmission by the Linux network stack when it has a timer interrupt fire. The timer interrupt is atomic context, and the network stack code -- eventually -- calls our driver to retransmit the packet which calls into SysLink which needs to allocate some memory so it blocks on a mutex. The blocking on the mutex causes scheduling, which causes Linux to crash because scheduling is not supposed to happen while the kernel is atomic.

Is it possible to use SysLink in such a scenario? If so, how? I am not aware of a way to prevent scheduling that won't have other disatrous effects.

  • Christopher,

    You need to create a kernel thread inside your driver which will retransmit the packet using SysLink. This kernel thread is blocked waiting for a signal to run. When you encounter a TCP retransmission and the timer interrupt runs, and it calls into your driver, instead of calling SysLink directly, you need to hand off the packet to your waiting kernel thread. Then the timer interrupt can complete without blocking. The Linux scheduler will then run your kernel thread to push the packet to the DSP using SysLink.

    There is a good discussion of this topic in the book "Linux Kernel Development" by Robert Love. Have a look at Chapter 7 - Bottom Halves and Deferring Work.

    ~Ramsey