From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932882AbbKEAaS (ORCPT ); Wed, 4 Nov 2015 19:30:18 -0500 Received: from mail-yk0-f179.google.com ([209.85.160.179]:35170 "EHLO mail-yk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754080AbbKEAaP (ORCPT ); Wed, 4 Nov 2015 19:30:15 -0500 MIME-Version: 1.0 In-Reply-To: <1446677585-28582-3-git-send-email-dianders@chromium.org> References: <1446677585-28582-1-git-send-email-dianders@chromium.org> <1446677585-28582-3-git-send-email-dianders@chromium.org> Date: Wed, 4 Nov 2015 16:30:14 -0800 X-Google-Sender-Auth: oT6a5dQSMi4d8r2hMg5H6G26204 Message-ID: Subject: Re: [PATCH 2/3] usb: dwc2: host: Giveback URB in tasklet context From: Doug Anderson To: John Youn , Felipe Balbi Cc: Yunzhi Li , =?UTF-8?Q?Heiko_St=C3=BCbner?= , "open list:ARM/Rockchip SoC..." , Julius Werner , "Herrero, Gregory" , "Kaukab, Yousaf" , Dinh Nguyen , Douglas Anderson , John Youn , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ming Lei , Alan Stern Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Nov 4, 2015 at 2:53 PM, Douglas Anderson wrote: > In commit 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet > context") support was added to give back the URB in tasklet context. > Let's take advantage of this in dwc2. > > This speeds up the dwc2 interrupt handler considerably. > > Signed-off-by: Douglas Anderson > --- > drivers/usb/dwc2/hcd.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index e79baf73c234..9e7988950c7a 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -2273,9 +2273,7 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, > kfree(qtd->urb); > qtd->urb = NULL; > > - spin_unlock(&hsotg->lock); > usb_hcd_giveback_urb(dwc2_hsotg_to_hcd(hsotg), urb, status); > - spin_lock(&hsotg->lock); > } > > /* > @@ -2888,7 +2886,7 @@ static struct hc_driver dwc2_hc_driver = { > .hcd_priv_size = sizeof(struct wrapper_priv_data), > > .irq = _dwc2_hcd_irq, > - .flags = HCD_MEMORY | HCD_USB2, > + .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, > > .start = _dwc2_hcd_start, > .stop = _dwc2_hcd_stop, In the ChromeOS gerrit Julius Werner points out that for EHCI it was good to take the optimization from commit 9118f9eb4f1e ("USB: EHCI: improve interrupt qh unlink") before this one. I'm still trying to learn USB / dwc2 so it's unclear to me whether we also need a similar change before landing. I'll see if I can do some investigation about this and also some benchmarking before and after. Certainly profiling the interrupt handler itself showed a huge improvement, but I'd hate to see a regression elsewhere. If anyone else knows better than I, please speak up! :) -Doug From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Anderson Subject: Re: [PATCH 2/3] usb: dwc2: host: Giveback URB in tasklet context Date: Wed, 4 Nov 2015 16:30:14 -0800 Message-ID: References: <1446677585-28582-1-git-send-email-dianders@chromium.org> <1446677585-28582-3-git-send-email-dianders@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1446677585-28582-3-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+glpar-linux-rockchip=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: John Youn , Felipe Balbi Cc: "Herrero, Gregory" , =?UTF-8?Q?Heiko_St=C3=BCbner?= , John Youn , Greg Kroah-Hartman , Ming Lei , "linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Douglas Anderson , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "open list:ARM/Rockchip SoC..." , "Kaukab, Yousaf" , Alan Stern , Yunzhi Li , Julius Werner , Dinh Nguyen List-Id: linux-rockchip.vger.kernel.org Hi, On Wed, Nov 4, 2015 at 2:53 PM, Douglas Anderson wrote: > In commit 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet > context") support was added to give back the URB in tasklet context. > Let's take advantage of this in dwc2. > > This speeds up the dwc2 interrupt handler considerably. > > Signed-off-by: Douglas Anderson > --- > drivers/usb/dwc2/hcd.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index e79baf73c234..9e7988950c7a 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -2273,9 +2273,7 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, > kfree(qtd->urb); > qtd->urb = NULL; > > - spin_unlock(&hsotg->lock); > usb_hcd_giveback_urb(dwc2_hsotg_to_hcd(hsotg), urb, status); > - spin_lock(&hsotg->lock); > } > > /* > @@ -2888,7 +2886,7 @@ static struct hc_driver dwc2_hc_driver = { > .hcd_priv_size = sizeof(struct wrapper_priv_data), > > .irq = _dwc2_hcd_irq, > - .flags = HCD_MEMORY | HCD_USB2, > + .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, > > .start = _dwc2_hcd_start, > .stop = _dwc2_hcd_stop, In the ChromeOS gerrit Julius Werner points out that for EHCI it was good to take the optimization from commit 9118f9eb4f1e ("USB: EHCI: improve interrupt qh unlink") before this one. I'm still trying to learn USB / dwc2 so it's unclear to me whether we also need a similar change before landing. I'll see if I can do some investigation about this and also some benchmarking before and after. Certainly profiling the interrupt handler itself showed a huge improvement, but I'd hate to see a regression elsewhere. If anyone else knows better than I, please speak up! :) -Doug