Skip to contentSkip to conversation

omap hsmmc: prevent race between dma and hsmmc callback

PATCH In review Venkatraman S 4 participants 6 messages Mar 10, 2010 – Aug 27, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

CC Adrian Hunter <[email protected]>
CC Madhusudhan C <[email protected]>
CC Tony Lindgren <[email protected]>
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/mmc/host/omap_hsmmc.c +11 -1
index 83f0aff..ea2a082 100644
@@ -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
#1 lore raw

PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback

Quoted 11 lines

-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Venkatraman S
Sent: Wednesday, March 10, 2010 7:42 PM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-mmc at vger.kernel.org
Cc: Adrian Hunter; Chikkature Rajashekar, Madhusudhan; Tony Lindgren
Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

Why did you dropped change log in all your patches? You should retain that and just change the patch version in the subject.

Quoted 53 lines
CC Adrian Hunter <[email protected]>
CC Madhusudhan C <[email protected]>
CC Tony Lindgren <[email protected]>
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/mmc/host/omap_hsmmc.c +11 -8
index 83f0aff..ea2a082 100644
@@ -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);
 }
 

/*
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback

Quoted 8 lines · Santosh
Quoted 8 lines

-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Venkatraman S
Sent: Wednesday, March 10, 2010 7:42 PM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-mmc at vger.kernel.org
Cc: Adrian Hunter; Chikkature Rajashekar, Madhusudhan; Tony Lindgren
Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback

Quoted 6 lines
Quoted 3 lines

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

Why did you dropped change log in all your patches? You should retain that and just change the patch version in the subject.

My bad. I just edited the merge commit to point to the previous threads and posted it.
Should I post them again ?

Thanks and regards,
Venkat.

#3 lore raw

PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback

Quoted 12 lines · Venkatraman S
Quoted 11 lines · Santosh
Quoted 11 lines

-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Venkatraman S
Sent: Wednesday, March 10, 2010 7:42 PM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-mmc at vger.kernel.org
Cc: Adrian Hunter; Chikkature Rajashekar, Madhusudhan; Tony Lindgren
Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

Quoted 8 lines
Quoted 3 lines

Why did you dropped change log in all your patches? You should retain that and just change the patch version in the subject.

My bad. I just edited the merge commit to point to the previous threads and posted it.
Should I post them again ?

Yes.

As Santosh pointed out, keep the changelog. and add any comments about how this differs from previous versions after the '---' in the changelog.

Keep in mind that the changelog will be stored in the git history and should be useful without having to reference previous versions etc.

Anything useful to the reviewers but not important for the changelog should go after the '---' since that will be ignored by git when applying.

Kevin

#4 lore raw
In reply to Venkatraman S
Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Venkatraman S
Sent: Wednesday, March 10, 2010 7:42 PM
To: [email protected]; [email protected]; [email protected]
Cc: Adrian Hunter; Chikkature Rajashekar, Madhusudhan; Tony Lindgren
Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

Why did you dropped change log in all your patches? You should retain that and just change the patch version in the subject.

Quoted 53 lines
CC Adrian Hunter <[email protected]>
CC Madhusudhan C <[email protected]>
CC Tony Lindgren <[email protected]>
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/mmc/host/omap_hsmmc.c +11 -8
index 83f0aff..ea2a082 100644
@@ -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);
 }
 

/*
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH 1/3 omap hsmmc: prevent race between dma and hsmmc callback

In reply to Venkatraman S

Hi,

Looks like the discussion on this patch stopped: do we think there's a race worth fixing here?

Quoted 52 lines · Venkatraman S

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

CC Adrian Hunter <[email protected]>
CC Madhusudhan C <[email protected]>
CC Tony Lindgren <[email protected]>
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/mmc/host/omap_hsmmc.c +11 -8
index 83f0aff..ea2a082 100644
@@ -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
Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child