From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH] pcm: direct: Fix deadlock in poll_descriptors
Date: Mon, 16 Jan 2017 16:26:30 +0100 [thread overview]
Message-ID: <20170116152630.4448-1-tiwai@suse.de> (raw)
The recent change in PCM direct plugins to check XRUN in
poll_descriptors callback caused a regression; as consequence, the
whole playback hangs up.
The culprit is a mutex dead lock by the call in snd_pcm_state() inside
the new snd_pcm_direct_poll_descriptors(). The poll_descriptors code
path is protected with pcm mutex, thus an unlocked version
(__snd_pcm_state()) has to be used inside the callback instead.
Fixes: 789ee39727a1 ("pcm: direct: check state before enter poll on timer")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_direct.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
index f4d7c3f2f284..e4bef7860d01 100644
--- a/src/pcm/pcm_direct.c
+++ b/src/pcm/pcm_direct.c
@@ -676,7 +676,8 @@ int snd_pcm_direct_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
}
/* this will also evaluate slave state and enter xrun if necessary */
- switch (snd_pcm_state(pcm)) {
+ /* using __snd_pcm_state() since this function is called inside lock */
+ switch (__snd_pcm_state(pcm)) {
case SND_PCM_STATE_XRUN:
return -EPIPE;
default:
--
2.11.0
reply other threads:[~2017-01-16 15:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20170116152630.4448-1-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).