Commit ec8eab1e authored by Takashi Iwai's avatar Takashi Iwai Committed by Matthias Männich
Browse files

UPSTREAM: ASoC: soc-pcm: Fix and cleanup DPCM locking



[ Upstream commit b7898396 ]

The existing locking for DPCM has several issues
a) a confusing mix of card->mutex and card->pcm_mutex.
b) a dpcm_lock spinlock added inconsistently and on paths that could
be recursively taken. The use of irqsave/irqrestore was also overkill.

The suggested model is:

1) The pcm_mutex is the top-most protection of BE links in the FE. The
pcm_mutex is applied always on either the top PCM callbacks or the
external call from DAPM, not taken in the internal functions.

2) the FE stream lock is taken in higher levels before invoking
dpcm_be_dai_trigger()

3) when adding and deleting a BE, both the pcm_mutex and FE stream
lock are taken.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
[clarification of commit message by plbossart]
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-4-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Fixes: aa9ff6a4 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: default avatarYixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-4-yixuanjiang@google.com


Change-Id: Iae88cee86073874889591ea0619609d6d4103645
Signed-off-by: default avatarYixuan Jiang <yixuanjiang@google.com>
parent 06e574fc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment