public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Javier Martin <javier.martin@vista-silicon.com>
Cc: linux-mmc@vger.kernel.org, viresh.linux@gmail.com,
	g.liakhovetski@gmx.de, vinod.koul@linux.intel.com,
	cjb@laptop.org, fabio.estevam@freescale.com, gcembed@gmail.com
Subject: Re: [PATCH] mmc: mxcmmc: fix bug that may block a data transfer forever.
Date: Thu, 6 Sep 2012 12:32:32 +0200	[thread overview]
Message-ID: <20120906103232.GS26594@pengutronix.de> (raw)
In-Reply-To: <1346917248-6685-1-git-send-email-javier.martin@vista-silicon.com>

On Thu, Sep 06, 2012 at 09:40:48AM +0200, Javier Martin wrote:
> The problem can be easily reproduced using a script that loops
> copying a file in an SD card to another place in the same SD card
> and its related to read transfers. This only happens with DMA enabled.
> 
> This is related to the fact that, when reading, an MMC irq signals
> the fact that all data from the SD card has been copied to the
> internal buffers. However, it doesn't signal whether the DMA transfer
> that is in charge of moving data from these internal buffers to RAM
> has finished or not. Thus, calling dmaengine_terminate_all() in the
> MMC irq routine can cancel an ongoing DMA transfer leaving some data
> in the internal buffers that produces an accumulative effect which,
> in the end, blocks a read data transfer forever.

Doesn't that mean that in case of a DMA read we just have to wait for
the DMA callback instead of the MMC irq? Something like:

static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd,
		unsigned int cmdat)
{
	...

	if (mxcmci_use_dma(host)) {
		if (host->dma_dir == DMA_FROM_DEVICE)
			setup_dma_callback();
		else
			int_cntr |= INT_WRITE_OP_DONE_EN;
	}

	...
}

That would be a cleaner solution I think.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

      reply	other threads:[~2012-09-06 10:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06  7:40 [PATCH] mmc: mxcmmc: fix bug that may block a data transfer forever Javier Martin
2012-09-06 10:32 ` Sascha Hauer [this message]

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=20120906103232.GS26594@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=cjb@laptop.org \
    --cc=fabio.estevam@freescale.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=gcembed@gmail.com \
    --cc=javier.martin@vista-silicon.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=vinod.koul@linux.intel.com \
    --cc=viresh.linux@gmail.com \
    /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