From patchwork Tue Apr 12 04:42:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram X-Patchwork-Id: 699221 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3C4glAq031557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Apr 2011 04:43:09 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p3C4gkoc003293 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 11 Apr 2011 23:42:46 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id p3C4gjJj007939 for ; Mon, 11 Apr 2011 23:42:45 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 746468062A for ; Mon, 11 Apr 2011 23:42:44 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id E6E4980626 for ; Mon, 11 Apr 2011 23:42:37 -0500 (CDT) Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p3C4gYW9015374; Tue, 12 Apr 2011 10:12:35 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 8.3.106.1; Tue, 12 Apr 2011 10:12:21 +0530 Received: from psplinux050.india.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p3C4gVn0007948; Tue, 12 Apr 2011 10:12:32 +0530 (IST) Received: from psplinux050.india.ti.com (localhost [127.0.0.1]) by psplinux050.india.ti.com (8.13.1/8.13.1) with ESMTP id p3C4gV2Y010485; Tue, 12 Apr 2011 10:12:31 +0530 Received: (from a0875517@localhost) by psplinux050.india.ti.com (8.13.1/8.13.1/Submit) id p3C4gVLW010482; Tue, 12 Apr 2011 10:12:31 +0530 From: Sriramakrishnan A G To: Subject: [PATCH] net: davinci_emac: fix spinlock bug with dma channel cleanup Date: Tue, 12 Apr 2011 10:12:31 +0530 Message-ID: <1302583351-10449-1-git-send-email-srk@ti.com> X-Mailer: git-send-email 1.6.2.4 MIME-Version: 1.0 Cc: Sriramakrishnan A G , davinci-linux-open-source@linux.davincidsp.com, davem@davemloft.net X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Apr 2011 04:43:09 +0000 (UTC) The DMA cleanup function was holding the spinlock across a busy loop where it waits for HW to indicate teardown is complete. This generates a backtrace, when DEBUG_SPINLOCK is enabled. Make the locking more granular. Signed-off-by: Sriramakrishnan A G --- drivers/net/davinci_cpdma.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/davinci_cpdma.c b/drivers/net/davinci_cpdma.c index ae47f23..57fd0fc 100644 --- a/drivers/net/davinci_cpdma.c +++ b/drivers/net/davinci_cpdma.c @@ -824,6 +824,8 @@ int cpdma_chan_stop(struct cpdma_chan *chan) /* trigger teardown */ dma_reg_write(ctlr, chan->td, chan->chan_num); + spin_unlock_irqrestore(&chan->lock, flags); + /* wait for teardown complete */ timeout = jiffies + HZ/10; /* 100 msec */ while (time_before(jiffies, timeout)) { @@ -843,6 +845,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan) } while ((ret & CPDMA_DESC_TD_COMPLETE) == 0); /* remaining packets haven't been tx/rx'ed, clean them up */ + spin_lock_irqsave(&chan->lock, flags); while (chan->head) { struct cpdma_desc __iomem *desc = chan->head; dma_addr_t next_dma;