From: Lars-Peter Clausen <lars@metafoo.de>
To: Matt Campbell <mcampbell@izotope.com>,
alsa-devel@alsa-project.org,
dmaengine <dmaengine@vger.kernel.org>
Subject: Re: race condition between dmaengine_pcm_dma_complete and snd_pcm_release
Date: Thu, 08 Oct 2015 11:02:27 +0200 [thread overview]
Message-ID: <56163123.9020106@metafoo.de> (raw)
In-Reply-To: <CAMDowVWrLOK1Ysmfe1zTujw0Ev5PjPei1RBH8t_Mve_fsfe2ww@mail.gmail.com>
On 10/06/2015 11:45 PM, Matt Campbell wrote:
> 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.html
>
> 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.
Hi,
The answer is still the same. This is an inherent issue with the DMAengine
API that needs to be fixed by adding a synchronization primitive that allows
consumers to make sure that all completion tasklets have stopped running.
Unfortunately this wasn't implemented yet, but I need this in other places
outside of ASoC and it's on my TODO list and I'll hopefully get to it in the
next 2 months.
But in your case on a single CPU system it could also be an issue with the
DMA controller driver itself not properly stopping the transfer when
dma_terminate_all() is called.
- Lars
next prev parent reply other threads:[~2015-10-08 9:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 21:45 race condition between dmaengine_pcm_dma_complete and snd_pcm_release Matt Campbell
2015-10-08 9:02 ` Lars-Peter Clausen [this message]
2015-10-08 13:38 ` Matt Campbell
2015-10-08 13:46 ` Matt Campbell
2015-10-12 12:01 ` Lars-Peter Clausen
2015-10-16 13:55 ` Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56163123.9020106@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=dmaengine@vger.kernel.org \
--cc=mcampbell@izotope.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.