From patchwork Fri Apr 6 10:34:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 151163 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8AFDCB7047 for ; Fri, 6 Apr 2012 20:34:30 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SG6S7-0003c1-Sa; Fri, 06 Apr 2012 10:31:35 +0000 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14] helo=tx2outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SG6Rz-0003bk-7a; Fri, 06 Apr 2012 10:31:31 +0000 Received: from mail167-tx2-R.bigfish.com (10.9.14.237) by TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id 14.1.225.23; Fri, 6 Apr 2012 10:31:22 +0000 Received: from mail167-tx2 (localhost [127.0.0.1]) by mail167-tx2-R.bigfish.com (Postfix) with ESMTP id 020901203C3; Fri, 6 Apr 2012 10:31:22 +0000 (UTC) X-SpamScore: -10 X-BigFish: VS-10(zzbb2dIc89bh936eK1432N98dKzz1202h1082kzz8275bhz2dh2a8h668h839h93fhd25h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail167-tx2 (localhost.localdomain [127.0.0.1]) by mail167-tx2 (MessageSwitch) id 1333708280179698_17483; Fri, 6 Apr 2012 10:31:20 +0000 (UTC) Received: from TX2EHSMHS022.bigfish.com (unknown [10.9.14.236]) by mail167-tx2.bigfish.com (Postfix) with ESMTP id 1B25C1A004A; Fri, 6 Apr 2012 10:31:20 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS022.bigfish.com (10.9.99.122) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 6 Apr 2012 10:31:19 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.1.355.3; Fri, 6 Apr 2012 05:31:19 -0500 Received: from localhost.localdomain (udp161149uds.ap.freescale.net [10.192.242.25]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q36AV2DA001328; Fri, 6 Apr 2012 03:31:05 -0700 Message-ID: <4F7EC6AF.6000603@freescale.com> Date: Fri, 6 Apr 2012 18:34:23 +0800 From: Huang Shijie User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 MIME-Version: 1.0 To: Shawn Guo Subject: Re: Using GPMI-NAND driver on iMX28 using 3.4-rc1? References: <20120404070157.GB24930@pengutronix.de> <20120404183314.GF17187@pengutronix.de> <4F7D3DB8.6080009@freescale.com> <1333628861.31825.22.camel@vkoul-udesk3> <20120406022305.GJ7264@S2101-09.ap.freescale.net> In-Reply-To: <20120406022305.GJ7264@S2101-09.ap.freescale.net> X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [65.55.88.14 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Vinod Koul , Russell King - ARM Linux , Fabio Estevam , Wolfram Sang , linux-mtd@lists.infradead.org, Shawn Guo , Sam Gandhi , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 于 2012年04月06日 10:23, Shawn Guo 写道: > On Thu, Apr 05, 2012 at 05:57:41PM +0530, Vinod Koul wrote: >> On Thu, 2012-04-05 at 05:03 -0700, Sam Gandhi wrote: >>> 2012/4/4 Huang Shijie: > ... >>>>>> flash_erase /dev/mtd1 0 0 >>>>>> Erasing 1------------[ cut here ]------------ >>>>>> kernel BUG at /home/sam/linux/drivers/dma/dmaengine.h:53! >>>> the mxs-dma has added some patches about the cookie. >>>> The bug is in the dmaengine.h. >>>> >>>> So let more people know this bug. >>>> > I'm still trying to understand why I did run into the BUG_ON when I > test it with mxs mmc and sound drivers. > > ... > >> This means you are trying to mark a cookie complete when it is already >> marked so!, hence dmaengine screams. >> The bug is is mxs-dma. >> Let me know if below fixes it (assuming you are not using cyclic API, >> that would need fixup as well) >> >> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c >> index c81ef7e..5ddd84e 100644 >> --- a/drivers/dma/mxs-dma.c >> +++ b/drivers/dma/mxs-dma.c >> @@ -399,6 +399,10 @@ static struct dma_async_tx_descriptor >> *mxs_dma_prep_slave_sg( >> ccw->bits&= ~CCW_DEC_SEM; >> } else { >> idx = 0; >> + /* assign cookie here, >> + * hopefully for above case we dont need it >> + */ >> + dma_cookie_assign(&mxs_chan->desc); > Isn't it done in mxs_dma_tx_submit() already? The gpmi driver somehow It's maybe too late to assign the DMA cookie after mxs_dma_enable_chan() in mxs_dma_tx_submit(). The interrupt may arise before the dma_cookie_assign() finishes. Why mmc/audio do not have this bug? their interrupt arise too slow. I tested the following code : static void mxs_dma_tasklet(unsigned long data) > misses the call to dmaengine_submit() for some case? > > Regards, > Shawn > >> } >> >> if (direction == DMA_TRANS_NONE) { >> >> -- ============================================================== diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 5978113..0f5b09a 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -202,10 +202,12 @@ static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_cha static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) { struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan); + dma_cookie_t c; + c = dma_cookie_assign(tx); mxs_dma_enable_chan(mxs_chan); - return dma_cookie_assign(tx); + return c; }