All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call
@ 2016-10-21 13:18 ` Charles Keepax
  2016-10-21 13:31   ` Krzysztof Kozlowski
  2016-10-21 14:20   ` Sylwester Nawrocki
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Keepax @ 2016-10-21 13:18 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, sbkim73, patches, lgirdwood, krzk, s.nawrocki

Unfortunately, I seem to have missed a case where an IRQ safe spinlock was
required, in samsung_i2s_dai_remove, when I fixed up the other calls in
this patch:

316fa9e09ad7 ("ASoC: samsung: Use IRQ safe spin lock calls")

This causes a lockdep warning when unbinding and rebinding the audio card:

[  104.357664]        CPU0                    CPU1
[  104.362174]        ----                    ----
[  104.366692]   lock(&(&pri_dai->spinlock)->rlock);
[  104.371372]                                local_irq_disable();
[  104.377283]                                lock(&(&substream->self_group.lock)->rlock);
[  104.385259]                                lock(&(&pri_dai->spinlock)->rlock);
[  104.392469]   <Interrupt>
[  104.395072]     lock(&(&substream->self_group.lock)->rlock);
[  104.400710]
[  104.400710]  *** DEADLOCK ***

Fixes: ce8bcdbb61d9 ("ASoC: samsung: i2s: Protect more registers with a spinlock")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/samsung/i2s.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 7e32cf4..588aa01 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1029,12 +1029,13 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
 static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
 {
 	struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai);
+	unsigned long flags;
 
 	if (!is_secondary(i2s)) {
 		if (i2s->quirks & QUIRK_NEED_RSTCLR) {
-			spin_lock(i2s->lock);
+			spin_lock_irqsave(i2s->lock, flags);
 			writel(0, i2s->addr + I2SCON);
-			spin_unlock(i2s->lock);
+			spin_unlock_irqrestore(i2s->lock, flags);
 		}
 	}
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call
  2016-10-21 13:18 ` [PATCH] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call Charles Keepax
@ 2016-10-21 13:31   ` Krzysztof Kozlowski
  2016-10-21 14:20   ` Sylwester Nawrocki
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2016-10-21 13:31 UTC (permalink / raw)
  To: Charles Keepax
  Cc: alsa-devel, sbkim73, patches, lgirdwood, krzk, broonie, s.nawrocki

On Fri, Oct 21, 2016 at 02:18:48PM +0100, Charles Keepax wrote:
> Unfortunately, I seem to have missed a case where an IRQ safe spinlock was
> required, in samsung_i2s_dai_remove, when I fixed up the other calls in
> this patch:
> 
> 316fa9e09ad7 ("ASoC: samsung: Use IRQ safe spin lock calls")
> 
> This causes a lockdep warning when unbinding and rebinding the audio card:
> 
> [  104.357664]        CPU0                    CPU1
> [  104.362174]        ----                    ----
> [  104.366692]   lock(&(&pri_dai->spinlock)->rlock);
> [  104.371372]                                local_irq_disable();
> [  104.377283]                                lock(&(&substream->self_group.lock)->rlock);
> [  104.385259]                                lock(&(&pri_dai->spinlock)->rlock);
> [  104.392469]   <Interrupt>
> [  104.395072]     lock(&(&substream->self_group.lock)->rlock);
> [  104.400710]
> [  104.400710]  *** DEADLOCK ***
> 
> Fixes: ce8bcdbb61d9 ("ASoC: samsung: i2s: Protect more registers with a spinlock")
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  sound/soc/samsung/i2s.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call
  2016-10-21 13:18 ` [PATCH] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call Charles Keepax
  2016-10-21 13:31   ` Krzysztof Kozlowski
@ 2016-10-21 14:20   ` Sylwester Nawrocki
  1 sibling, 0 replies; 3+ messages in thread
From: Sylwester Nawrocki @ 2016-10-21 14:20 UTC (permalink / raw)
  To: Charles Keepax, broonie; +Cc: sbkim73, alsa-devel, patches, lgirdwood, krzk

On 10/21/2016 03:18 PM, Charles Keepax wrote:
> Unfortunately, I seem to have missed a case where an IRQ safe spinlock was
> required, in samsung_i2s_dai_remove, when I fixed up the other calls in
> this patch:
> 
> 316fa9e09ad7 ("ASoC: samsung: Use IRQ safe spin lock calls")
> 
> This causes a lockdep warning when unbinding and rebinding the audio card:
> 
> [  104.357664]        CPU0                    CPU1
> [  104.362174]        ----                    ----
> [  104.366692]   lock(&(&pri_dai->spinlock)->rlock);
> [  104.371372]                                local_irq_disable();
> [  104.377283]                                lock(&(&substream->self_group.lock)->rlock);
> [  104.385259]                                lock(&(&pri_dai->spinlock)->rlock);
> [  104.392469]   <Interrupt>
> [  104.395072]     lock(&(&substream->self_group.lock)->rlock);
> [  104.400710]
> [  104.400710]  *** DEADLOCK ***
> 
> Fixes: ce8bcdbb61d9 ("ASoC: samsung: i2s: Protect more registers with a spinlock")
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-21 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20161021131846eucas1p27e73aba30a83a17e121c571259cbc7c3@eucas1p2.samsung.com>
2016-10-21 13:18 ` [PATCH] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call Charles Keepax
2016-10-21 13:31   ` Krzysztof Kozlowski
2016-10-21 14:20   ` Sylwester Nawrocki

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.