From patchwork Fri Jan 29 02:20:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 8158261 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 55AB2BEEE5 for ; Fri, 29 Jan 2016 02:37:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DE0D20265 for ; Fri, 29 Jan 2016 02:37:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C714200F2 for ; Fri, 29 Jan 2016 02:37:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOyvq-0005rS-29; Fri, 29 Jan 2016 02:37:06 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOyvj-0005Sf-29 for linux-rockchip@bombadil.infradead.org; Fri, 29 Jan 2016 02:36:59 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by casper.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1aOygO-00013R-WE for linux-rockchip@lists.infradead.org; Fri, 29 Jan 2016 02:21:10 +0000 Received: by mail-pa0-x22f.google.com with SMTP id cy9so32900016pac.0 for ; Thu, 28 Jan 2016 18:20:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YZkk4yjvd99IdbdmxPvg9TsvDqZohaNweqXHkPjj/UY=; b=SZZDqpTojC3znTCwD16FiM1F4J4+7Uz/zbYUEqoKkNSLfIn0P9pUsQxcBWruQupJg5 MOCz6xnqlJGXM9P5LjuT4hFRYGp5Z/6VhHCdc4VQw99L5bwtROgJOXV+ii7tESryIav/ iyyOyvoh15ZQ294qoO3436MFndPuRZAkULynA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YZkk4yjvd99IdbdmxPvg9TsvDqZohaNweqXHkPjj/UY=; b=jMBeqF42fzKzCJfI8NaPc1JmbCH/FQ78fs2oliL060o0bUt4xy8IcEk+w2BWSAmqYf o+FeS+dltIblRXo5crDwUkObOpObwYZ4IS1q+yM29fVeE0NTU1LDUxywuMQE0+z5Fii8 9E+CQmJWhYAtNCNOgMVmIbD5madxVR5Yji6UziEpida9CBi+ow7wADyR6pUiM4VpAiYd Rg5H98OgWiY8qJeaDNpzJQVop42FoIHvSe2lY/UivZjaGJ5/Dewo/EcbVF6AsA5K/lmf vNMhr9azlwbEecc+Ve10FjCdiUWejbwSvRIYLS+CbUbn2db9WPsgWLfCYAqgcjghoJvT Jyag== X-Gm-Message-State: AG10YOTK2tvYuvtexFZWszZ/XWdm8RiyrewsBni06UTEM78c4UTyGDYnrOUkdaFJehyE9A== X-Received: by 10.66.162.164 with SMTP id yb4mr9690140pab.94.1454034046297; Thu, 28 Jan 2016 18:20:46 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id ux2sm19314864pac.46.2016.01.28.18.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jan 2016 18:20:45 -0800 (PST) From: Douglas Anderson To: John Youn , balbi@ti.com, kever.yang@rock-chips.com Subject: [PATCH v6 09/22] usb: dwc2: host: Giveback URB in tasklet context Date: Thu, 28 Jan 2016 18:20:00 -0800 Message-Id: <1454034013-24657-10-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1454034013-24657-1-git-send-email-dianders@chromium.org> References: <1454034013-24657-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160129_022109_201868_B130AB74 X-CRM114-Status: GOOD ( 16.74 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, stefan.wahren@i2se.com, heiko@sntech.de, johnyoun@synopsys.com, gregkh@linuxfoundation.org, ming.lei@canonical.com, linux-usb@vger.kernel.org, Douglas Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, yousaf.kaukab@intel.com, stern@rowland.harvard.edu, linux-rpi-kernel@lists.infradead.org, gregory.herrero@intel.com, william.wu@rock-chips.com, Julius Werner , dinguyen@opensource.altera.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Note that this requires the change ("usb: dwc2: host: Add a delay before releasing periodic bandwidth") to come first. Note that, as per Alan Stern in , we also need to make sure that the extra delay before the device drivers submit more data doesn't break the scheduler. At the moment the scheduler is pretty broken (see future patches) so it's hard to be 100% certain, but I have yet to see any new breakage introduced by this delay. ...and speeding up interrupt processing for dwc2 is a huge deal because it means we've got a better chance of not missing SOF interrupts. That means we've got an overall win here. Note that when playing USB audio and using a USB webcam and having several USB keyboards plugged in, the crackling on the USB audio device is noticably reduced with this patch. Signed-off-by: Douglas Anderson Tested-by: Heiko Stuebner Tested-by: Stefan Wahren --- Changes in v6: - Add Stefan's Tested-by. Changes in v5: None Changes in v4: - A bit earlier in the list of patches than in v3. Changes in v3: None Changes in v2: - Commit message now says that URB giveback change needs delay change. 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 0b6ebc7fff3f..40558478a192 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2341,9 +2341,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); } /* @@ -2964,7 +2962,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,