All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: ehci: fix update qtd->token in qh_append_tds
@ 2011-08-27 14:48 ` ming.lei at canonical.com
  0 siblings, 0 replies; 53+ messages in thread
From: ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw @ 2011-08-27 14:48 UTC (permalink / raw)
  To: greg-U8xfFu+wG4EAvxtiuMwx3w, stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Ming Lei

From: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

This patch fixs one performance bug on ARM Cortex A9 dual core platform,
which has been reported on quite a few ARM machines(OMAP4, Tegra 2, snowball...),
see details from link of https://bugs.launchpad.net/bugs/709245.

In fact, one mb() on ARM is enough to flush L2 cache, but
'dummy->hw_token = token;' after mb() is added just for obeying
correct mb() usage.

The patch has been tested ok on OMAP4 panda A1 board, the performance
of 'dd' over usb mass storage can be increased from 4~5MB/sec to
14~16MB/sec after applying this patch.

Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/usb/host/ehci-q.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 0917e3a..65b5021 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1082,6 +1082,20 @@ static struct ehci_qh *qh_append_tds (
 			wmb ();
 			dummy->hw_token = token;
 
+			/* The mb() below is added to make sure that
+			 * 'token' can be writen into qtd, so that ehci
+			 * HC can see the up-to-date qtd descriptor. On
+			 * some archs(at least on ARM Cortex A9 dual core),
+			 * writing into coherenet memory doesn't mean the
+			 * value written can reach physical memory
+			 * immediately, and the value may be buffered
+			 * inside L2 cache. 'dummy->hw_token = token;'
+			 * after mb() is added for obeying correct mb()
+			 * usage.
+			 * */
+			mb();
+			token = dummy->hw_token;
+
 			urb->hcpriv = qh_get (qh);
 		}
 	}
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 53+ messages in thread
* [PATCH] usb: ehci: fix update qtd->token in qh_append_tds
@ 2011-08-27 14:46 ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw
  0 siblings, 0 replies; 53+ messages in thread
From: ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw @ 2011-08-27 14:46 UTC (permalink / raw)
  To: greg-U8xfFu+wG4EAvxtiuMwx3w, stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XWe1ixc4/HljEvhb3Hwu1Ks,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Ming Lei

From: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

This patch fixs one performance bug on ARM Cortex A9 dual core platform,
which has been reported on quite a few ARM machines(OMAP4, Tegra 2, snowball...),
see details from link of https://bugs.launchpad.net/bugs/709245.

In fact, one mb() on ARM is enough to flush L2 cache, but
'dummy->hw_token = token;' after mb() is added just for obeying
correct mb() usage.

The patch has been tested ok on OMAP4 panda A1 board, the performance
of 'dd' over usb mass storage can be increased from 4~5MB/sec to
14~16MB/sec after applying this patch.

Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/usb/host/ehci-q.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 0917e3a..65b5021 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1082,6 +1082,20 @@ static struct ehci_qh *qh_append_tds (
 			wmb ();
 			dummy->hw_token = token;
 
+			/* The mb() below is added to make sure that
+			 * 'token' can be writen into qtd, so that ehci
+			 * HC can see the up-to-date qtd descriptor. On
+			 * some archs(at least on ARM Cortex A9 dual core),
+			 * writing into coherenet memory doesn't mean the
+			 * value written can reach physical memory
+			 * immediately, and the value may be buffered
+			 * inside L2 cache. 'dummy->hw_token = token;'
+			 * after mb() is added for obeying correct mb()
+			 * usage.
+			 * */
+			mb();
+			token = dummy->hw_token;
+
 			urb->hcpriv = qh_get (qh);
 		}
 	}
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2011-08-30 14:02 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-27 14:48 [PATCH] usb: ehci: fix update qtd->token in qh_append_tds ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw
2011-08-27 14:48 ` ming.lei at canonical.com
2011-08-27 15:03 ` Santosh
2011-08-27 15:03   ` Santosh
     [not found]   ` <4E590756.9030307-l0cyMroinI0@public.gmane.org>
2011-08-27 15:18     ` Ming Lei
2011-08-27 15:18       ` Ming Lei
     [not found]       ` <CACVXFVPPPUsntdCT=m=vRJ9XVksn6rGMzqJVvdD+sj=eOcTadg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-27 15:46         ` Santosh
2011-08-27 15:46           ` Santosh
     [not found] ` <1314456515-16419-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2011-08-27 15:13   ` Greg KH
2011-08-27 15:13     ` Greg KH
2011-08-27 15:33     ` Ming Lei
2011-08-27 15:33       ` Ming Lei
2011-08-27 16:07       ` Greg KH
2011-08-27 16:07         ` Greg KH
2011-08-27 16:57         ` Ming Lei
2011-08-27 16:57           ` Ming Lei
     [not found]           ` <CACVXFVNz_ic_PPM_vNn1Dz85A2z94kRFso4rcqrvJfuLSqRSCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-27 17:20             ` Ming Lei
2011-08-27 17:20               ` Ming Lei
2011-08-27 20:11               ` Alan Stern
2011-08-27 20:11                 ` Alan Stern
2011-08-28  3:35                 ` Ming Lei
2011-08-28  3:35                   ` Ming Lei
2011-08-27 20:06           ` Alan Stern
2011-08-27 20:06             ` Alan Stern
2011-08-28  3:13             ` Ming Lei
2011-08-28  3:13               ` Ming Lei
     [not found]               ` <CACVXFVP8Lr=ggH4FjvMQd6r9poLAT1r+_S3Z-NimP0i08DsQ8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-28 17:00                 ` Alan Stern
2011-08-28 17:00                   ` Alan Stern
2011-08-28 23:36                   ` Russell King - ARM Linux
2011-08-28 23:36                     ` Russell King - ARM Linux
2011-08-29  1:51                     ` Alan Stern
2011-08-29  1:51                       ` Alan Stern
2011-08-29  8:52                       ` Russell King - ARM Linux
2011-08-29  8:52                         ` Russell King - ARM Linux
2011-08-29 13:57                         ` Alan Stern
2011-08-29 13:57                           ` Alan Stern
     [not found]                           ` <Pine.LNX.4.44L0.1108290951250.2525-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2011-08-29 15:55                             ` Ming Lei
2011-08-29 15:55                               ` Ming Lei
2011-08-29 16:24                               ` Mark Salter
2011-08-29 16:24                                 ` Mark Salter
     [not found]                   ` <Pine.LNX.4.44L0.1108281233270.3742-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2011-08-29 14:25                     ` Ming Lei
2011-08-29 14:25                       ` Ming Lei
     [not found]                       ` <CACVXFVOvw6bSfcOYR2RWJO=k1WLgSCUygmSwZmtRDdM_tZNWEA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-29 15:03                         ` Alan Stern
2011-08-29 15:03                           ` Alan Stern
     [not found]                           ` <Pine.LNX.4.44L0.1108291046540.2525-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2011-08-29 15:21                             ` Ming Lei
2011-08-29 15:21                               ` Ming Lei
2011-08-29 16:33                               ` Alan Stern
2011-08-29 16:33                                 ` Alan Stern
     [not found]                                 ` <Pine.LNX.4.44L0.1108291218040.2525-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2011-08-30 14:02                                   ` Ming Lei
2011-08-30 14:02                                     ` Ming Lei
2011-08-27 16:31   ` Sergei Shtylyov
2011-08-27 16:31     ` Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2011-08-27 14:46 ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.