From: Sameer Pujar <spujar@nvidia.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
<alsa-devel@alsa-project.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
tiwai@suse.de, vkoul@kernel.org, broonie@kernel.org,
Gyeongtaek Lee <gt82.lee@samsung.com>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Subject: Re: [RFC PATCH v2 0/5] ASoC: soc-pcm: fix trigger race conditions with shared BE
Date: Wed, 6 Oct 2021 19:52:40 +0530 [thread overview]
Message-ID: <3683cf39-632b-50df-c65d-63779c464850@nvidia.com> (raw)
In-Reply-To: <1efa1c31-7342-05f8-5f73-95e2462d4179@linux.intel.com>
Hi Pierre,
On 10/5/2021 6:47 PM, Pierre-Louis Bossart wrote:
>
> My patches don't change anything related to a spinlock or pcm stream
> management, so not sure what could cause this rather spectacular
> failure. That hints at a fundamental configuration difference, possibly
> caused by your component chaining?
>
> Since in your case you have a 1:1 mapping between FE and BE, would you
> mind testing by backtracking, one patch at a time to see which one of
> the three last patches could cause a problem on your board?
I tested this further. It appears that things work fine till 'patch 3/5'
of yours. After I take 'patch 4/5', the print "BUG: scheduling while
atomic: aplay" started showing up and I see a hang. This failure was
seen for 2x1 mixer test itself.
The 'patch 4/5' introduces mutex_lock/unlock() in dpcm_be_dai_trigger().
This seems to be the problem, since trigger() runs in atomic context
depending on the PCM 'nonatomic' flag. I am not sure if your design sets
'nonatomic' flag by default and that is why the issue is not seen at
your end?
With below (just for testing purpose), tests ran well. I was able to run
2x1, 3x1 ... 10x1 mixer tests.
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index e5df898..2ce30d1 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2045,7 +2045,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime
*fe, int stream,
struct snd_soc_dpcm *dpcm;
int ret = 0;
- mutex_lock(&fe->card->dpcm_mutex);
+ //mutex_lock(&fe->card->dpcm_mutex);
for_each_dpcm_be(fe, stream, dpcm) {
struct snd_pcm_substream *be_substream;
@@ -2166,7 +2166,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime
*fe, int stream,
}
}
end:
- mutex_unlock(&fe->card->dpcm_mutex);
+ //mutex_unlock(&fe->card->dpcm_mutex);
if (ret < 0)
dev_err(fe->dev, "ASoC: %s() failed at %s (%d)\n",
__func__, be->dai_link->name, ret);
In fact I picked up all of your patches + above test patch, it worked fine.
Thanks,
Sameer.
next prev parent reply other threads:[~2021-10-06 14:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 22:54 [RFC PATCH v2 0/5] ASoC: soc-pcm: fix trigger race conditions with shared BE Pierre-Louis Bossart
2021-10-04 22:54 ` [RFC PATCH v2 1/5] ASoC: soc-pcm: remove snd_soc_dpcm_fe_can_update() Pierre-Louis Bossart
2021-10-04 22:54 ` [RFC PATCH v2 2/5] ASoC: soc-pcm: don't export local functions, use static Pierre-Louis Bossart
2021-10-04 22:54 ` [RFC PATCH v2 3/5] ASoC: soc-pcm: replace dpcm_lock with dpcm_mutex Pierre-Louis Bossart
2021-10-04 22:54 ` [RFC PATCH v2 4/5] ASoC: soc-pcm: protect for_each_dpcm_be() loops " Pierre-Louis Bossart
2021-10-04 22:54 ` [RFC PATCH v2 5/5] ASoC: soc-pcm: test refcount before triggering Pierre-Louis Bossart
2021-10-05 6:36 ` [RFC PATCH v2 0/5] ASoC: soc-pcm: fix trigger race conditions with shared BE Sameer Pujar
2021-10-05 13:17 ` Pierre-Louis Bossart
2021-10-06 14:22 ` Sameer Pujar [this message]
2021-10-06 19:47 ` Pierre-Louis Bossart
2021-10-07 11:06 ` Takashi Iwai
2021-10-07 13:31 ` Pierre-Louis Bossart
2021-10-07 14:59 ` Takashi Iwai
2021-10-07 15:24 ` Pierre-Louis Bossart
2021-10-07 15:44 ` Takashi Iwai
2021-10-07 18:13 ` Pierre-Louis Bossart
2021-10-07 21:11 ` Takashi Iwai
2021-10-07 21:27 ` Pierre-Louis Bossart
2021-10-08 6:13 ` Takashi Iwai
2021-10-08 14:41 ` Pierre-Louis Bossart
2021-10-08 14:51 ` Takashi Iwai
2021-10-08 15:41 ` Pierre-Louis Bossart
2021-10-08 19:09 ` Pierre-Louis Bossart
2021-10-11 20:06 ` Pierre-Louis Bossart
2021-10-12 6:34 ` Takashi Iwai
2021-10-12 10:42 ` Takashi Iwai
2021-10-12 13:45 ` Pierre-Louis Bossart
2021-10-12 15:07 ` Takashi Iwai
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=3683cf39-632b-50df-c65d-63779c464850@nvidia.com \
--to=spujar@nvidia.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=gt82.lee@samsung.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.de \
--cc=vkoul@kernel.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