From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753011AbbCQCGY (ORCPT ); Mon, 16 Mar 2015 22:06:24 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:44683 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752301AbbCQCGV (ORCPT ); Mon, 16 Mar 2015 22:06:21 -0400 Message-ID: <55078C1B.3090404@synopsys.com> Date: Mon, 16 Mar 2015 19:06:19 -0700 From: John Youn User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Yunzhi Li , Vincent Palatin , "linux-usb@vger.kernel.org" , LKML , "balbi@ti.com" CC: Doug Anderson , Julius Werner , Greg Kroah-Hartman , John Youn Subject: Re: [PATCH RESEND] usb: dwc2: avoid leaking DMA channels on disconnection References: <1426451072-3162-1-git-send-email-vpalatin@chromium.org> <5506A701.7050008@rock-chips.com> In-Reply-To: <5506A701.7050008@rock-chips.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.10.161.115] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/16/2015 2:50 AM, Yunzhi Li wrote: > Hi >> When the HCD is disconnected, the DMA transfers still in-flight were cleaned-up >> but the count of available DMA channels (e.g. available_host_channels) was not >> reset. >> The pool of DMA channels can be depleted when doing unclean >> disconnection of USB peripherals, and reaches the point where no >> transfer was possible until the next reboot/reload of the driver. >> >> Tested by putting a programmable USB mux on the port and randomly >> plugging/unpluging a USB HUB with USB mass-storage key, USB-audio and >> USB-ethernet dongle connected to its downstream ports, and also doing the >> disconnection early while the devices are still enumerating to get more URBs >> in-flight. >> After the patch, the devices are still enumerating after thousands of cycles, >> while the port was totally dead before. >> >> Signed-off-by: Vincent Palatin >> --- >> I'm re-sending it, it seems the previous email did not show up. >> >> drivers/usb/dwc2/hcd.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c >> index c78c874..559b55e 100644 >> --- a/drivers/usb/dwc2/hcd.c >> +++ b/drivers/usb/dwc2/hcd.c >> @@ -257,6 +257,14 @@ static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg) >> */ >> channel->qh = NULL; >> } >> + /* All channels have been freed, mark them available */ >> + if (hsotg->core_params->uframe_sched > 0) { >> + hsotg->available_host_channels = >> + hsotg->core_params->host_channels; >> + } else { >> + hsotg->non_periodic_channels = 0; >> + hsotg->periodic_channels = 0; >> + } >> } >> >> /** > > I have reviewed this patch. Obviously,it makes sense. > > Reviewed-by: Yunzhi Li Acked-by: John Youn