Hi All,
I've been trying to track down a kernel crash I've been getting when closing ALSA devices. There is a race condition between the bottom half interrupt handler for the DMA system (dmaengine_pcm_dma_complete in pcm_dmaengine.c) and the releasing of the sub-stream resources it receives as an argument (when snd_pcm_release is called). An older thread from 2013 discussed this to a good extent so I wont go into the details here. I've been unable to track down either a patch to fix this or even a good solution that I could implement. I've spent a couple days trying to think of an elegant solution and come up with nothing so far. Any input would be appreciated.
Link to original thread: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067111.htm...
It's worth nothing that the original thread points out how this can arise on multi-core systems. In my case I'm on a single core system, but with the real-time patch enabled and the userspace ALSA thread running at a higher priority than the kernel's tasklet thread which can reproduce this almost 100% of the time.
~Matt