From patchwork Fri Nov 9 07:00:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 1719081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 677B0DF264 for ; Fri, 9 Nov 2012 07:02:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TWiZl-0002b8-Ta; Fri, 09 Nov 2012 07:00:25 +0000 Received: from smtp2-v.fe.bosch.de ([139.15.237.6]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TWiZf-0002aq-Ep for linux-arm-kernel@lists.infradead.org; Fri, 09 Nov 2012 07:00:21 +0000 Received: from vsmta14.fe.internet.bosch.com (unknown [10.4.98.54]) by imta24.fe.bosch.de (Postfix) with ESMTP id 07BC2B00215 for ; Fri, 9 Nov 2012 08:00:17 +0100 (CET) Received: from localhost (vsgw1.fe.internet.bosch.com [10.4.98.15]) by vsmta14.fe.internet.bosch.com (Postfix) with SMTP id 787141B40A42 for ; Fri, 9 Nov 2012 07:59:43 +0100 (CET) Received: from FE-HUB1000.de.bosch.com (10.4.103.107) by si-hub07.de.bosch.com (10.3.153.132) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 9 Nov 2012 08:00:29 +0100 Received: from hi-z5661.hi.de.bosch.com (10.34.218.58) by FE-HUB1000.de.bosch.com (10.4.103.107) with Microsoft SMTP Server id 14.2.318.4; Fri, 9 Nov 2012 08:00:10 +0100 Received: from localhost.localdomain (localhost [127.0.0.1]) by hi-z5661.hi.de.bosch.com (Postfix) with ESMTP id C3BA14048F; Fri, 9 Nov 2012 08:00:10 +0100 (CET) From: Dirk Behme To: Subject: [PATCH] dmaengine: imx-dma: fix missing irq disable in tasklet Date: Fri, 9 Nov 2012 08:00:04 +0100 Message-ID: <1352444404-11423-1-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121109_020019_637183_C1EB40DB X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [139.15.237.6 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Vinod Koul , Andreas Pape , Javier Martin , Sascha Hauer X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Andreas Pape Interrupt handler uses spinlock, too. To avoid deadlock tasklet must disable IRQ. Signed-off-by: Andreas Pape CC: Vinod Koul CC: Javier Martin CC: Sascha Hauer --- 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,