* [PATCH] fsldma: fix performance degradation by optimizing spinlock use.
@ 2011-12-26 6:01 b29237
2012-01-11 7:54 ` Shi Xuelin-B29237
0 siblings, 1 reply; 5+ messages in thread
From: b29237 @ 2011-12-26 6:01 UTC (permalink / raw)
To: iws, vinod.koul, dan.j.williams, linuxppc-dev, linux-kernel; +Cc: Forrest shi
From: Forrest shi <b29237@freescale.com>
dma status check function fsl_tx_status is heavily called in
a tight loop and the desc lock in fsl_tx_status contended by
the dma status update function. this caused the dma performance
degrades much.
this patch releases the lock in the fsl_tx_status function, and
introduce the smp_mb() to avoid possible memory inconsistency.
Signed-off-by: Forrest Shi <xuelin.shi@freescale.com>
---
drivers/dma/fsldma.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 8a78154..008fb5e 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -986,15 +986,11 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan,
struct fsldma_chan *chan = to_fsl_chan(dchan);
dma_cookie_t last_complete;
dma_cookie_t last_used;
- unsigned long flags;
-
- spin_lock_irqsave(&chan->desc_lock, flags);
last_complete = chan->completed_cookie;
+ smp_mb();
last_used = dchan->cookie;
- spin_unlock_irqrestore(&chan->desc_lock, flags);
-
dma_set_tx_state(txstate, last_complete, last_used, 0);
return dma_async_is_complete(cookie, last_complete, last_used);
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. 2011-12-26 6:01 [PATCH] fsldma: fix performance degradation by optimizing spinlock use b29237 @ 2012-01-11 7:54 ` Shi Xuelin-B29237 2012-01-11 16:13 ` Ira W. Snyder 0 siblings, 1 reply; 5+ messages in thread From: Shi Xuelin-B29237 @ 2012-01-11 7:54 UTC (permalink / raw) To: iws; +Cc: vinod.koul, dan.j.williams, linuxppc-dev, linux-kernel Hello Iris, As we discussed in the previous patch, I add one smp_mb() in fsl_tx_status. In my testing with iozone, this smp_mb() could cause 1%~2% performance degradation. Anyway it is acceptable for me. Do you have any other comments? Thanks, Forrest -----Original Message----- From: Shi Xuelin-B29237 Sent: 2011年12月26日 14:01 To: iws@ovro.caltech.edu; vinod.koul@intel.com; dan.j.williams@intel.com; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org Cc: Shi Xuelin-B29237 Subject: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. From: Forrest shi <b29237@freescale.com> dma status check function fsl_tx_status is heavily called in a tight loop and the desc lock in fsl_tx_status contended by the dma status update function. this caused the dma performance degrades much. this patch releases the lock in the fsl_tx_status function, and introduce the smp_mb() to avoid possible memory inconsistency. Signed-off-by: Forrest Shi <xuelin.shi@freescale.com> --- drivers/dma/fsldma.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 8a78154..008fb5e 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -986,15 +986,11 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan, struct fsldma_chan *chan = to_fsl_chan(dchan); dma_cookie_t last_complete; dma_cookie_t last_used; - unsigned long flags; - - spin_lock_irqsave(&chan->desc_lock, flags); last_complete = chan->completed_cookie; + smp_mb(); last_used = dchan->cookie; - spin_unlock_irqrestore(&chan->desc_lock, flags); - dma_set_tx_state(txstate, last_complete, last_used, 0); return dma_async_is_complete(cookie, last_complete, last_used); } -- 1.7.0.4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. 2012-01-11 7:54 ` Shi Xuelin-B29237 @ 2012-01-11 16:13 ` Ira W. Snyder 2012-04-26 2:03 ` Shi Xuelin-B29237 0 siblings, 1 reply; 5+ messages in thread From: Ira W. Snyder @ 2012-01-11 16:13 UTC (permalink / raw) To: Shi Xuelin-B29237; +Cc: vinod.koul, dan.j.williams, linuxppc-dev, linux-kernel On Wed, Jan 11, 2012 at 07:54:55AM +0000, Shi Xuelin-B29237 wrote: > Hello Iris, > > As we discussed in the previous patch, I add one smp_mb() in fsl_tx_status. > In my testing with iozone, this smp_mb() could cause 1%~2% performance degradation. > Anyway it is acceptable for me. Do you have any other comments? > This patch looks fine to me. Ira > -----Original Message----- > From: Shi Xuelin-B29237 > Sent: 2011年12月26日 14:01 > To: iws@ovro.caltech.edu; vinod.koul@intel.com; dan.j.williams@intel.com; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org > Cc: Shi Xuelin-B29237 > Subject: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. > > From: Forrest shi <b29237@freescale.com> > > dma status check function fsl_tx_status is heavily called in > a tight loop and the desc lock in fsl_tx_status contended by > the dma status update function. this caused the dma performance > degrades much. > > this patch releases the lock in the fsl_tx_status function, and > introduce the smp_mb() to avoid possible memory inconsistency. > > Signed-off-by: Forrest Shi <xuelin.shi@freescale.com> > --- > drivers/dma/fsldma.c | 6 +----- > 1 files changed, 1 insertions(+), 5 deletions(-) > > diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 8a78154..008fb5e 100644 > --- a/drivers/dma/fsldma.c > +++ b/drivers/dma/fsldma.c > @@ -986,15 +986,11 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan, > struct fsldma_chan *chan = to_fsl_chan(dchan); > dma_cookie_t last_complete; > dma_cookie_t last_used; > - unsigned long flags; > - > - spin_lock_irqsave(&chan->desc_lock, flags); > > last_complete = chan->completed_cookie; > + smp_mb(); > last_used = dchan->cookie; > > - spin_unlock_irqrestore(&chan->desc_lock, flags); > - > dma_set_tx_state(txstate, last_complete, last_used, 0); > return dma_async_is_complete(cookie, last_complete, last_used); } > -- > 1.7.0.4 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. 2012-01-11 16:13 ` Ira W. Snyder @ 2012-04-26 2:03 ` Shi Xuelin-B29237 2012-04-26 2:59 ` Li Yang-R58472 0 siblings, 1 reply; 5+ messages in thread From: Shi Xuelin-B29237 @ 2012-04-26 2:03 UTC (permalink / raw) To: dan.j.williams Cc: vinod.koul, linuxppc-dev, linux-kernel, Ira W. Snyder, Li Yang-R58472 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2550 bytes --] Hi Dan Williams, Do you have any comment about this patch? Thanks, Forrest -----Original Message----- From: Ira W. Snyder [mailto:iws@ovro.caltech.edu] Sent: 2012å¹´1æ12æ¥ 0:14 To: Shi Xuelin-B29237 Cc: vinod.koul@intel.com; dan.j.williams@intel.com; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. On Wed, Jan 11, 2012 at 07:54:55AM +0000, Shi Xuelin-B29237 wrote: > Hello Iris, > > As we discussed in the previous patch, I add one smp_mb() in fsl_tx_status. > In my testing with iozone, this smp_mb() could cause 1%~2% performance degradation. > Anyway it is acceptable for me. Do you have any other comments? > This patch looks fine to me. Ira > -----Original Message----- > From: Shi Xuelin-B29237 > Sent: 2011å¹´12æ26æ¥ 14:01 > To: iws@ovro.caltech.edu; vinod.koul@intel.com; dan.j.williams@intel.com; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org > Cc: Shi Xuelin-B29237 > Subject: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. > > From: Forrest shi <b29237@freescale.com> > > dma status check function fsl_tx_status is heavily called in > a tight loop and the desc lock in fsl_tx_status contended by > the dma status update function. this caused the dma performance > degrades much. > > this patch releases the lock in the fsl_tx_status function, and > introduce the smp_mb() to avoid possible memory inconsistency. > > Signed-off-by: Forrest Shi <xuelin.shi@freescale.com> > --- > drivers/dma/fsldma.c | 6 +----- > 1 files changed, 1 insertions(+), 5 deletions(-) > > diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 8a78154..008fb5e 100644 > --- a/drivers/dma/fsldma.c > +++ b/drivers/dma/fsldma.c > @@ -986,15 +986,11 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan, > struct fsldma_chan *chan = to_fsl_chan(dchan); > dma_cookie_t last_complete; > dma_cookie_t last_used; > - unsigned long flags; > - > - spin_lock_irqsave(&chan->desc_lock, flags); > > last_complete = chan->completed_cookie; > + smp_mb(); > last_used = dchan->cookie; > > - spin_unlock_irqrestore(&chan->desc_lock, flags); > - > dma_set_tx_state(txstate, last_complete, last_used, 0); > return dma_async_is_complete(cookie, last_complete, last_used); } > -- > 1.7.0.4 > > ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] fsldma: fix performance degradation by optimizing spinlock use. 2012-04-26 2:03 ` Shi Xuelin-B29237 @ 2012-04-26 2:59 ` Li Yang-R58472 0 siblings, 0 replies; 5+ messages in thread From: Li Yang-R58472 @ 2012-04-26 2:59 UTC (permalink / raw) To: Shi Xuelin-B29237, dan.j.williams, vinod.koul Cc: linuxppc-dev, linux-kernel, Ira W. Snyder [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3208 bytes --] Hi Dan and Vinod, Please help to pick this patch up. It addresses a great performance regression for RAID offloading. Acked-by: Li Yang <leoli@freescale.com> - Leo > -----Original Message----- > From: Shi Xuelin-B29237 > Sent: Thursday, April 26, 2012 10:04 AM > To: dan.j.williams@intel.com > Cc: vinod.koul@intel.com; linuxppc-dev@lists.ozlabs.org; linux- > kernel@vger.kernel.org; Ira W. Snyder; Li Yang-R58472 > Subject: RE: [PATCH] fsldma: fix performance degradation by optimizing > spinlock use. > > Hi Dan Williams, > > Do you have any comment about this patch? > > Thanks, > Forrest > > -----Original Message----- > From: Ira W. Snyder [mailto:iws@ovro.caltech.edu] > Sent: 2012å¹´1æ12æ¥ 0:14 > To: Shi Xuelin-B29237 > Cc: vinod.koul@intel.com; dan.j.williams@intel.com; linuxppc- > dev@lists.ozlabs.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] fsldma: fix performance degradation by optimizing > spinlock use. > > On Wed, Jan 11, 2012 at 07:54:55AM +0000, Shi Xuelin-B29237 wrote: > > Hello Iris, > > > > As we discussed in the previous patch, I add one smp_mb() in > fsl_tx_status. > > In my testing with iozone, this smp_mb() could cause 1%~2% performance > degradation. > > Anyway it is acceptable for me. Do you have any other comments? > > > > This patch looks fine to me. > > Ira > > > -----Original Message----- > > From: Shi Xuelin-B29237 > > Sent: 2011å¹´12æ26æ¥ 14:01 > > To: iws@ovro.caltech.edu; vinod.koul@intel.com; > dan.j.williams@intel.com; linuxppc-dev@lists.ozlabs.org; linux- > kernel@vger.kernel.org > > Cc: Shi Xuelin-B29237 > > Subject: [PATCH] fsldma: fix performance degradation by optimizing > spinlock use. > > > > From: Forrest shi <b29237@freescale.com> > > > > dma status check function fsl_tx_status is heavily called in > > a tight loop and the desc lock in fsl_tx_status contended by > > the dma status update function. this caused the dma performance > > degrades much. > > > > this patch releases the lock in the fsl_tx_status function, and > > introduce the smp_mb() to avoid possible memory inconsistency. > > > > Signed-off-by: Forrest Shi <xuelin.shi@freescale.com> > > --- > > drivers/dma/fsldma.c | 6 +----- > > 1 files changed, 1 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index > 8a78154..008fb5e 100644 > > --- a/drivers/dma/fsldma.c > > +++ b/drivers/dma/fsldma.c > > @@ -986,15 +986,11 @@ static enum dma_status fsl_tx_status(struct > dma_chan *dchan, > > struct fsldma_chan *chan = to_fsl_chan(dchan); > > dma_cookie_t last_complete; > > dma_cookie_t last_used; > > - unsigned long flags; > > - > > - spin_lock_irqsave(&chan->desc_lock, flags); > > > > last_complete = chan->completed_cookie; > > + smp_mb(); > > last_used = dchan->cookie; > > > > - spin_unlock_irqrestore(&chan->desc_lock, flags); > > - > > dma_set_tx_state(txstate, last_complete, last_used, 0); > > return dma_async_is_complete(cookie, last_complete, last_used); } > > -- > > 1.7.0.4 > > > > ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-26 2:59 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-12-26 6:01 [PATCH] fsldma: fix performance degradation by optimizing spinlock use b29237 2012-01-11 7:54 ` Shi Xuelin-B29237 2012-01-11 16:13 ` Ira W. Snyder 2012-04-26 2:03 ` Shi Xuelin-B29237 2012-04-26 2:59 ` Li Yang-R58472
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome