public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: Vinod Koul <vinod.koul@linux.intel.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Fabio Estevam <festevam@gmail.com>,
	Wolfram Sang <w.sang@pengutronix.de>,
	linux-mtd@lists.infradead.org,
	Shawn Guo <shawn.guo@freescale.com>,
	Sam Gandhi <samgandhi9@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: Using GPMI-NAND driver on iMX28 using 3.4-rc1?
Date: Fri, 6 Apr 2012 18:34:23 +0800	[thread overview]
Message-ID: <4F7EC6AF.6000603@freescale.com> (raw)
In-Reply-To: <20120406022305.GJ7264@S2101-09.ap.freescale.net>

于 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<b32955@freescale.com>:
> ...
>>>>>> 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 :
==============================================================

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;
}

static void mxs_dma_tasklet(unsigned long data)


> misses the call to dmaengine_submit() for some case?
>
> Regards,
> Shawn
>
>>   	}
>>
>>   	if (direction == DMA_TRANS_NONE) {
>>
>> -- 

  parent reply	other threads:[~2012-04-06 10:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04  6:05 Using GPMI-NAND driver on iMX28 using 3.4-rc1? Sam Gandhi
2012-04-04  7:01 ` Wolfram Sang
2012-04-04 18:08   ` Sam Gandhi
2012-04-04 18:33     ` Wolfram Sang
2012-04-04 20:27       ` Sam Gandhi
2012-04-04 20:55         ` Fabio Estevam
2012-04-04 22:07           ` Sam Gandhi
2012-04-04 22:28             ` Fabio Estevam
2012-04-05  3:00               ` Huang Shijie
2012-04-05  6:37               ` Huang Shijie
2012-04-05 12:03                 ` Sam Gandhi
2012-04-05 12:27                   ` Vinod Koul
2012-04-05 13:02                     ` Sam Gandhi
2012-04-05 13:48                       ` Vinod Koul
2012-04-05 14:38                         ` Sam Gandhi
2012-04-06  2:23                     ` Shawn Guo
2012-04-06  2:45                       ` Huang Shijie
2012-04-06  3:45                         ` Shawn Guo
2012-04-06 10:34                       ` Huang Shijie [this message]
2012-04-06 12:49                         ` Shawn Guo
2012-04-06 13:49                         ` Sam Gandhi
2012-04-06 13:59                           ` Shawn Guo
2012-04-06 14:06                             ` Sam Gandhi
2012-04-06 14:21                               ` Shawn Guo
2012-04-06 14:53                         ` Sam Gandhi
2012-04-10  9:42                         ` Russell King - ARM Linux
2012-04-10 12:39                           ` Shawn Guo
2012-04-10 12:47                             ` Russell King - ARM Linux

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=4F7EC6AF.6000603@freescale.com \
    --to=b32955@freescale.com \
    --cc=festevam@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=samgandhi9@gmail.com \
    --cc=shawn.guo@freescale.com \
    --cc=shawn.guo@linaro.org \
    --cc=vinod.koul@linux.intel.com \
    --cc=w.sang@pengutronix.de \
    /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