Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: dirk.behme@de.bosch.com (Dirk Behme)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] dmaengine: imx-dma: fix missing irq disable in tasklet
Date: Fri, 9 Nov 2012 08:00:04 +0100	[thread overview]
Message-ID: <1352444404-11423-1-git-send-email-dirk.behme@de.bosch.com> (raw)

From: Andreas Pape <external.Andreas.Pape@de.bosch.com>

Interrupt handler uses spinlock, too.
To avoid deadlock tasklet must disable IRQ.

Signed-off-by: Andreas Pape <external.Andreas.Pape@de.bosch.com>
CC: Vinod Koul <vinod.koul@linux.intel.com>
CC: Javier Martin <javier.martin@vista-silicon.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
---

I'm no DMA expert, so sorry if it's wrong ;)

And btw.: While looking at this code, we wonder if imxdma_xfer_desc() can
get the spin lock recursively, e.g. from imxdma_tasklet()? Or what ensures
that the lock is always taken from an other DMA engine than the one already
holding the lock? 

 drivers/dma/imx-dma.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 7d9554c..bce30e8 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -562,8 +562,9 @@ static void imxdma_tasklet(unsigned long data)
 	struct imxdma_channel *imxdmac = (void *)data;
 	struct imxdma_engine *imxdma = imxdmac->imxdma;
 	struct imxdma_desc *desc;
+	unsigned long flags;
 
-	spin_lock(&imxdma->lock);
+	spin_lock_irqsave(&imxdma->lock, flags);
 
 	if (list_empty(&imxdmac->ld_active)) {
 		/* Someone might have called terminate all */
@@ -600,7 +601,7 @@ static void imxdma_tasklet(unsigned long data)
 				 __func__, imxdmac->channel);
 	}
 out:
-	spin_unlock(&imxdma->lock);
+	spin_unlock_irqrestore(&imxdma->lock, flags);
 }
 
 static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
-- 
1.7.0.4

                 reply	other threads:[~2012-11-09  7:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1352444404-11423-1-git-send-email-dirk.behme@de.bosch.com \
    --to=dirk.behme@de.bosch.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox