Skip to contentSkip to conversation

ASoC: soc-compress: lock pcm_mutex to resolve lockdep error

PATCH In review 이경택 2 participants 3 messages Mar 26, 2020 – Mar 30, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20200326084608epcas2p32239121f201613573e7dd86c3172a29f@epcas2p3.samsung.com

이경택

author
#1 lore raw

PATCH 1/1 ASoC: soc-compress: lock pcm_mutex to resolve lockdep error

snd_soc_runtime_activate() and snd_soc_runtime_deactivate()

require pcm_mutex lock.

---

sound/soc/soc-compress.c | 4 ++++

1 file changed, 4 insertions(+)
sound/soc/soc-compress.c +0 -0

index 392a1c5b15d3..42d416ac7e9b 100644

--- a/sound/soc/soc-compress.c

+++ b/sound/soc/soc-compress.c

@@ -207,7 +207,9 @@ 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->pcm_mutex, fe->pcm_subclass);

         snd_soc_runtime_activate(fe, stream);

+ mutex_unlock(&fe->pcm_mutex);

          mutex_unlock(&fe->card->mutex);

@@ -285,7 +287,9 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)

         else

                    stream = SNDRV_PCM_STREAM_CAPTURE;

+ mutex_lock_nested(&fe->pcm_mutex, fe->pcm_subclass);

         snd_soc_runtime_deactivate(fe, stream);

+ mutex_unlock(&fe->pcm_mutex);

          fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
Signature · 1 line
2.21.0
author
#2 lore raw

sound/soc/soc-compress.c static int soc_compr_open_fe(struct snd_compr_stream

Quoted 36 lines · Gyeongtaek Lee

Hi,

I'd like to send a patch to fix a problem in soc-compress with DPCM. soc_compr_open_fe() and soc_compr_free_fe() call snd_soc_runtime_activate() and snd_soc_runtime_deactivate() but don't lock card->pcm_mutex. It can cause lockdep error, because snd_soc_runtime_activate/deactivate() checks whether pcm_mutex is held using lockdep_assert_held(). I'd like to send a patch which adds mutex_lock/unlock()
before and after of the snd_soc_runtime_activate/deactivate() call. If there is anything should be changed in my patch or email, please let me know it.
I'll really appreciate it.

Gyeongtaek Lee (1):
ASoC: soc-compress: lock pcm_mutex to resolve lockdep error

sound/soc/soc-compress.c | 4 ++++

1 file changed, 4 insertions(+)

base-commit: 76ccd234269bd05debdbc12c96eafe62dd9a6180
---

snd_soc_runtime_activate() and snd_soc_runtime_deactivate() require pcm_mutex lock.

---
sound/soc/soc-compress.c | 4 ++++

1 file changed, 4 insertions(+)
sound/soc/soc-compress.c +0 -0
index 392a1c5b15d3..42d416ac7e9b 100644
@@ -207,7 +207,9 @@ static int soc_compr_open_fe(struct snd_compr_stream

*cstream)

sound/soc/soc-compress.c static int soc_compr_free_fe(struct snd_compr_stream

Quoted 10 lines
sound/soc/soc-compress.c +2 -0
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
 	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
 
+	mutex_lock_nested(&fe->pcm_mutex, fe->pcm_subclass);
 	snd_soc_runtime_activate(fe, stream);
+	mutex_unlock(&fe->pcm_mutex);
 
 	mutex_unlock(&fe->card->mutex);
 
@@ -285,7 +287,9 @@ static int soc_compr_free_fe(struct snd_compr_stream

*cstream)

Quoted 12 lines
sound/soc/soc-compress.c +2 -0
 	else
 		stream = SNDRV_PCM_STREAM_CAPTURE;
 
+	mutex_lock_nested(&fe->pcm_mutex, fe->pcm_subclass);
 	snd_soc_runtime_deactivate(fe, stream);
+	mutex_unlock(&fe->pcm_mutex);
 
 	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
 
Signature · 1 line
2.21.0

Hi,

Resending patch with removing tab expansion.

Lee

maintainer
#3 lore raw
Quoted 9 lines · �̰���

sound/soc/soc-compress.c

Quoted 9 lines

snd_soc_runtime_activate() and snd_soc_runtime_deactivate() require pcm_mutex lock.

---
sound/soc/soc-compress.c | 4 ++++

1 file changed, 4 insertions(+)
sound/soc/soc-compress.c +0 -0

I can't do anything with this patch as it's quoted, please resend. Please also remember to CC Vinod, the compressed audio maintainer.