From: Vinod Koul <vkoul@kernel.org>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] ALSA: compress: fix partial_drain completion state
Date: Mon, 29 Jun 2020 10:46:59 +0530 [thread overview]
Message-ID: <20200629051659.GB376808@vkoul-mobl> (raw)
In-Reply-To: <20200626103549.GB71940@ediswmail.ad.cirrus.com>
On 26-06-20, 10:35, Charles Keepax wrote:
> > - stream->runtime->state = SNDRV_PCM_STATE_SETUP;
> > + mutex_lock(&stream->device->lock);
> > + /* for partial_drain case we are back to running state on success */
> > + if (stream->partial_drain) {
> > + stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
> > + stream->partial_drain = false; /* clear this flag as well */
> > + } else {
> > + stream->runtime->state = SNDRV_PCM_STATE_SETUP;
> > + }
> > + mutex_unlock(&stream->device->lock);
>
> You have added locking here in snd_compr_drain_notify but....
> >
> > wake_up(&stream->runtime->sleep);
> > }
> > diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> > index e618580feac4..1c4b2cf450a0 100644
> > --- a/sound/core/compress_offload.c
> > +++ b/sound/core/compress_offload.c
> > @@ -803,6 +803,9 @@ static int snd_compr_stop(struct snd_compr_stream *stream)
> >
> > retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP);
> > if (!retval) {
> > + /* clear flags and stop any drain wait */
> > + stream->partial_drain = false;
> > + stream->metadata_set = false;
> > snd_compr_drain_notify(stream);
>
> that can be called from snd_compr_stop here which is already
> holding the lock resulting in deadlock.
Thanks Charles, right somehow my testing missed this, have verified that
it is the case.
I will remove the locks here, and we should add a comment to note this..
Thanks
--
~Vinod
prev parent reply other threads:[~2020-06-29 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 15:46 [PATCH v3 0/3] ALSA: compress: Document stream states and fix gapless SM Vinod Koul
2020-06-25 15:46 ` [PATCH v3 1/3] ALSA: compress: document the compress audio state machine Vinod Koul
2020-06-26 10:45 ` Charles Keepax
2020-06-25 15:46 ` [PATCH v3 2/3] ALSA: compress: document the compress gapless " Vinod Koul
2020-06-25 15:46 ` [PATCH v3 3/3] ALSA: compress: fix partial_drain completion state Vinod Koul
2020-06-26 10:35 ` Charles Keepax
2020-06-29 5:16 ` Vinod Koul [this message]
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=20200629051659.GB376808@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.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 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).