LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Sameer Pujar <spujar@nvidia.com>,
broonie@kernel.org, lgirdwood@gmail.com, robh+dt@kernel.org,
thierry.reding@gmail.com, jonathanh@nvidia.com,
catalin.marinas@arm.com, will@kernel.org, perex@perex.cz,
tiwai@suse.com, kuninori.morimoto.gx@renesas.com
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
sharadg@nvidia.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 01/13] ASoC: soc-pcm: Don't reconnect an already active BE
Date: Tue, 28 Sep 2021 16:25:40 -0500 [thread overview]
Message-ID: <be6290d1-0682-3d93-98a6-ad0be3ca42c1@linux.intel.com> (raw)
In-Reply-To: <1630056839-6562-2-git-send-email-spujar@nvidia.com>
On 8/27/21 4:33 AM, Sameer Pujar wrote:
> In some cases, multiple FE components have the same BE component in their
> respective DPCM paths. One such example would be a mixer component, which
> can receive two or more inputs and sends a mixed output. In such cases,
> to avoid reconfiguration of already active DAI (mixer output DAI in this
> case), check the BE stream state to filter out the redundancy.
>
> In summary, allow connection of BE if the respective current stream state
> is either NEW or CLOSED.
This patch breaks our SOF CI tests, ironically in all cases where we
have a mixer with a 'Deep buffer' port! The tests with multiple streams
all fail with this error:
[ 124.366400] Port0 Deep Buffer: ASoC: no backend DAIs enabled for
Port0 Deep Buffer
[ 124.366406] Port0 Deep Buffer: ASoC: dpcm_fe_dai_prepare() failed (-22)
Reverting this patch restore the mixer functionality.
I see multiple problems with this patch:
At a high-level, there's at least a race condition where this BE state
is checked without any protection. That was already a problem that I
highlighted in a recent RFC and still working on, when we have multiple
FEs we can have START/STOP triggers happening concurrently and it's
necessary to serialize these triggers when checking the state, and this
patch increases the 'surface' for this race condition.
But in addition we'd need to agree on what an 'active BE' is. Why can't
we connect a second stream while the first one is already in HW_PARAMS
or PAUSED or STOP? It's perfectly legal in ALSA/ASoC to have multiple
HW_PARAMS calls, and when we reach STOP we have to do a prepare again.
And more fundamentally, the ability to add a second FE on a 'active' BE
in START state is a basic requirement for a mixer, e.g. to play a
notification on one FE while listening to music on another. What needs
to happen is only to make sure that the FE and BE are compatible in
terms of HW_PARAMS and not sending a second TRIGGER_STOP, only checking
the BE NEW or CLOSE state is way too restrictive.
I will agree this sort of mixer use cases is not well supported in
soc-pcm.c, but let's not make it worse than it was before this patch,
shall we?
I can send a revert with the explanations in the commit message if there
is a consensus that this patch needs to be revisited.
[1] https://github.com/thesofproject/linux/pull/3177
[2] https://sof-ci.01.org/linuxpr/PR3177/build6440/devicetest/
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> ---
> sound/soc/soc-pcm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 48f71bb..e30cb5a 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -1395,6 +1395,10 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
> if (!fe->dpcm[stream].runtime && !fe->fe_compr)
> continue;
>
> + if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) &&
> + (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
> + continue;
> +
> /* newly connected FE and BE */
> err = dpcm_be_connect(fe, be, stream);
> if (err < 0) {
>
next prev parent reply other threads:[~2021-09-28 21:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 9:33 [PATCH 00/13] Extend AHUB audio support for Tegra210 and later Sameer Pujar
2021-08-27 9:33 ` [PATCH 01/13] ASoC: soc-pcm: Don't reconnect an already active BE Sameer Pujar
2021-09-28 21:25 ` Pierre-Louis Bossart [this message]
2021-09-29 7:43 ` Sameer Pujar
[not found] ` <2f96f1aa-74f2-8ea8-3f43-e4da97400fde@linux.intel.com>
2021-09-29 14:52 ` Pierre-Louis Bossart
2021-09-30 7:57 ` Sameer Pujar
2021-09-30 14:34 ` Pierre-Louis Bossart
2021-09-30 15:35 ` Sameer Pujar
2021-09-30 16:13 ` Pierre-Louis Bossart
2021-09-30 19:00 ` Pierre-Louis Bossart
2021-10-04 4:38 ` Sameer Pujar
2021-08-27 9:33 ` [PATCH 02/13] ASoC: simple-card-utils: Increase maximum DAI links limit to 512 Sameer Pujar
2021-08-27 9:33 ` [PATCH 03/13] ASoC: audio-graph: Fixup CPU endpoint hw_params in a BE<->BE link Sameer Pujar
2021-08-27 9:33 ` [PATCH 04/13] ASoC: dt-bindings: tegra: Few more Tegra210 AHUB modules Sameer Pujar
2021-08-31 20:21 ` Rob Herring
2021-09-01 7:09 ` Sameer Pujar
2021-08-27 9:33 ` [PATCH 05/13] ASoC: tegra: Add routes for few " Sameer Pujar
2021-08-27 9:33 ` [PATCH 06/13] ASoC: tegra: Add Tegra210 based MVC driver Sameer Pujar
2021-09-03 18:13 ` Mark Brown
[not found] ` <7b248062-9a62-524c-4c96-295685e211b1@nvidia.com>
[not found] ` <86fc49a3-4cac-78c7-2c0c-eaee8e49d387@nvidia.com>
2021-09-09 14:20 ` Mark Brown
[not found] ` <29c785d0-cc70-7cce-c205-77059c11e0e1@nvidia.com>
2021-09-13 14:23 ` Mark Brown
2021-08-27 9:33 ` [PATCH 07/13] ASoC: tegra: Add Tegra210 based SFC driver Sameer Pujar
2021-08-27 9:33 ` [PATCH 08/13] ASoC: tegra: Add Tegra210 based AMX driver Sameer Pujar
2021-08-27 9:33 ` [PATCH 09/13] ASoC: tegra: Add Tegra210 based ADX driver Sameer Pujar
2021-08-27 9:33 ` [PATCH 10/13] ASoC: tegra: Add Tegra210 based Mixer driver Sameer Pujar
2021-08-27 9:33 ` [PATCH 11/13] arm64: defconfig: Enable few Tegra210 based AHUB drivers Sameer Pujar
2021-08-27 9:33 ` [PATCH 12/13] arm64: tegra: Add few AHUB devices for Tegra210 and later Sameer Pujar
2021-08-27 9:33 ` [PATCH 13/13] arm64: tegra: Extend APE audio support on Jetson platforms Sameer Pujar
2021-09-08 4:56 ` [PATCH 00/13] Extend AHUB audio support for Tegra210 and later Sameer Pujar
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=be6290d1-0682-3d93-98a6-ad0be3ca42c1@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=sharadg@nvidia.com \
--cc=spujar@nvidia.com \
--cc=thierry.reding@gmail.com \
--cc=tiwai@suse.com \
--cc=will@kernel.org \
--subject='Re: [PATCH 01/13] ASoC: soc-pcm: Don'\''t reconnect an already active BE' \
/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
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).