From: 강신형 <s47.kang@samsung.com>
To: "kuninori.morimoto.gx@renesas.com"
<kuninori.morimoto.gx@renesas.com>, CPGS <cpgs@samsung.com>
Cc: "tiwai@suse.de" <tiwai@suse.de>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"broonie@kernel.org" <broonie@kernel.org>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"pierre-louis.bossart@linux.intel.com"
<pierre-louis.bossart@linux.intel.com>
Subject: [PATCH] ASoC: soc-compress: Reposition and add pcm_mutex
Date: Fri, 02 Dec 2022 17:00:32 +0900 [thread overview]
Message-ID: <1983025922.01669968181916.JavaMail.epsvc@epcpadp4> (raw)
In-Reply-To: CGME20221202080032epcms2p68f56a6b43d7d6a4f0d2de9295c0e4ab4@epcms2p6
[-- Attachment #1: Type: text/plain, Size: 2984 bytes --]
commit a385cc2614c17ba3002b263c0ca47dfbf6395c78 (HEAD -> fix_compr,
master)
Author: s47.kang <[1]s47.kang@samsung.com>
Date: Fri Dec 2 15:45:16 2022 +0900
ASoC: soc-compress.c: Reposition and add pcm_mutex.
If panic_on_warn is set and compress stream(DPCM) is started,
then kernel panic will occurs because card->pcm_mutex isn't held
appropriately in
soc_compr_set_params_fe, soc_compr_open_fe and soc_compr_free_fe.
So, I reposition and add pcm_mutex to resolve lockdep error.
Signed-off-by: Shinhyung Kang <[2]s47.kang@samsung.com>
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 870f13e1d389..7bce5088b455 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -149,6 +149,8 @@ static int soc_compr_open_fe(struct
snd_compr_stream *cstream)
if (ret < 0)
goto be_err;
+ mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
+
/* calculate valid and active FE <-> BE dpcms */
dpcm_process_paths(fe, stream, &list, 1);
fe->dpcm[stream].runtime = fe_substream->runtime;
@@ -184,7 +186,6 @@ static int soc_compr_open_fe(struct
snd_compr_stream *cstream)
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
- mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
snd_soc_runtime_activate(fe, stream);
mutex_unlock(&fe->card->pcm_mutex);
@@ -215,7 +216,6 @@ static int soc_compr_free_fe(struct
snd_compr_stream *cstream)
mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
snd_soc_runtime_deactivate(fe, stream);
- mutex_unlock(&fe->card->pcm_mutex);
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
@@ -234,6 +234,8 @@ static int soc_compr_free_fe(struct
snd_compr_stream *cstream)
dpcm_be_disconnect(fe, stream);
+ mutex_unlock(&fe->card->pcm_mutex);
+
fe->dpcm[stream].runtime = NULL;
snd_soc_link_compr_shutdown(cstream, 0);
@@ -409,8 +411,9 @@ static int soc_compr_set_params_fe(struct
snd_compr_stream *cstream,
ret = snd_soc_link_compr_set_params(cstream);
if (ret < 0)
goto out;
-
+ mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START);
+ mutex_unlock(&fe->card->pcm_mutex);
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
out:
[cid:cafe_image_0@s-core.co.kr]
[update?userid=s47.kang&do=bWFpbElEPTIwMjIxMjAyMDgwMDMyZXBjbXMycDY4ZjU2
YTZiNDNkN2Q2YTRmMGQyZGU5Mjk1YzBlNGFiNCZyZWNpcGllbnRBZGRyZXNzPWFsc2EtZGV
2ZWxAYWxzYS1wcm9qZWN0Lm9yZw__]
References
1. mailto:s47.kang@samsung.com
2. mailto:s47.kang@samsung.com
[-- Attachment #2: Type: image/gif, Size: 13402 bytes --]
next parent reply other threads:[~2022-12-02 8:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20221202080032epcms2p68f56a6b43d7d6a4f0d2de9295c0e4ab4@epcms2p6>
2022-12-02 8:00 ` 강신형 [this message]
2022-12-02 11:54 ` [PATCH] ASoC: soc-compress: Reposition and add pcm_mutex Mark Brown
[not found] <CGME20221205051742epcas2p4e4724276da916d308b9c1a4aaccca672@epcas2p4.samsung.com>
2022-12-05 5:17 ` 강신형
2022-12-05 13:40 ` Mark Brown
[not found] <CGME20221205074650epcas2p2bf7d43767ed34d8f8a9dcfe6e763e4e0@epcas2p2.samsung.com>
2022-12-05 7:46 ` 강신형
2022-12-05 9:48 ` Krzysztof Kozlowski
[not found] <CGME20221208051818epcas2p122a0ce58691ac70d8a77b5e922e81fea@epcas2p1.samsung.com>
2022-12-08 5:18 ` 강신형
2023-01-28 10:48 ` Mark Brown
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=1983025922.01669968181916.JavaMail.epsvc@epcpadp4 \
--to=s47.kang@samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cpgs@samsung.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.