omap hsmmc: prevent race between dma and hsmmc callback
Subsystems (2)
PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback
It is observed that sometimes the MMC Transfer Complete (TC) is not received when DMA completion callback is processed (or takes too long to process)
This patch moves the releasing of DMA channel from dma callback to the mmc transfer complete handler.
This is observed consistently when descriptor loading is used (see the rest of the series)
--- drivers/mmc/host/omap_hsmmc.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/mmc/host/omap_hsmmc.c +11 -1
@@ -1046,8 +1046,18 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)if (end_cmd || ((status &CC ) && host->cmd))omap_hsmmc_cmd_done (host, host->cmd); -if ((end_trans || (status &TC )) && host->mrq) +if ((end_trans || (status &TC )) && host->mrq) {omap_hsmmc_xfer_done (host, data); +if (host->dma_ch !=-1 ) { +omap_free_dma (host->dma_ch); + host->dma_ch =-1 ; +/* +* Callback: run in interrupt context. +* mutex_unlock will throw a kernel warning if used. +*/ +up (&host->sem); + } + }spin_unlock (&host->irq_lock);
@@ -1267,13 +1277,6 @@ static void omap_hsmmc_dma_cb(int lch, u16
ch_status, void *data)
return;
}
- omap_free_dma(host->dma_ch);
- host->dma_ch = -1;
- /*
- * DMA Callback: run in interrupt context.
- * mutex_unlock will throw a kernel warning if used.
- */
- up(&host->sem);
}
/*
Signature · 1 line
1.6.3.3
PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback
Hello.
Quoted 22 lines · Venkatraman S
It is observed that sometimes the MMC Transfer Complete (TC) is not received when DMA completion callback is processed (or takes too long to process)
This patch moves the releasing of DMA channel from dma callback to the mmc transfer complete handler.
This is observed consistently when descriptor loading is used (see the rest of the series)Signed-off-by Venkatraman S <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-1@@ -1046,8 +1046,18 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)if (end_cmd || ((status &CC ) && host->cmd))omap_hsmmc_cmd_done (host, host->cmd); -if ((end_trans || (status &TC )) && host->mrq)
drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id) · line 1058
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +8
-0+if ((end_trans || (status &TC )) && host->mrq) {omap_hsmmc_xfer_done (host, data); +if (host->dma_ch !=-1 ) { +omap_free_dma (host->dma_ch); + host->dma_ch =-1 ; +/* +* Callback: run in interrupt context. +* mutex_unlock will throw a kernel warning if used. +*/
The comment should be aligned with the rest of the code.
drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id) · line 1062
Quoted 5 lines
drivers/mmc/host/omap_hsmmc.c +3
-0+up (&host->sem); + } + }spin_unlock (&host->irq_lock);
WBR, Sergei
PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback
In reply to Venkatraman SQuoted 29 lines
-----Original Message-----
From: linux-mmc-owner at vger.kernel.org [mailto:linux-mmc- owner at vger.kernel.org] On Behalf Of Venkatraman S
Sent: Monday, March 01, 2010 5:26 AM
To: linux-mmc at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callbackIt is observed that sometimes the MMC Transfer Complete (TC) is not received when DMA completion callback is processed (or takes too long to process)
This patch moves the releasing of DMA channel from dma callback to the mmc transfer complete handler.
This is observed consistently when descriptor loading is used (see the rest of the series)Signed-off-by Venkatraman S <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-0
drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_irq(int irq, void · line 1054
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +4
-1@@ -1046,8 +1046,18 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)if (end_cmd || ((status &CC ) && host->cmd))omap_hsmmc_cmd_done (host, host->cmd); -if ((end_trans || (status &TC )) && host->mrq) +if ((end_trans || (status &TC )) && host->mrq) {omap_hsmmc_xfer_done (host, data); +if (host->dma_ch !=-1 ) { +omap_free_dma (host->dma_ch); + host->dma_ch =-1 ;
Why is this necessary? The core is notified of xfer complete only when TC is received which is good enough.
Quoted 31 lines
drivers/mmc/host/omap_hsmmc.c +7
-7+/* +* Callback: run in interrupt context. +* mutex_unlock will throw a kernel warning if used. +*/ +up (&host->sem); + } + }spin_unlock (&host->irq_lock);@@ -1267,13 +1277,6 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *data)return ; } -omap_free_dma (host->dma_ch); - host->dma_ch =-1 ; -/* -* DMA Callback: run in interrupt context. -* mutex_unlock will throw a kernel warning if used. -*/ -up (&host->sem); }/*
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html