public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Youn <John.Youn@synopsys.com>
To: Yunzhi Li <lyz@rock-chips.com>,
	Vincent Palatin <vpalatin@chromium.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"balbi@ti.com" <balbi@ti.com>
Cc: Doug Anderson <dianders@chromium.org>,
	Julius Werner <jwerner@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	John Youn <John.Youn@synopsys.com>
Subject: Re: [PATCH RESEND] usb: dwc2: avoid leaking DMA channels on disconnection
Date: Mon, 16 Mar 2015 19:06:19 -0700	[thread overview]
Message-ID: <55078C1B.3090404@synopsys.com> (raw)
In-Reply-To: <5506A701.7050008@rock-chips.com>

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 <vpalatin@chromium.org>
>> ---
>> 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 <lyz@rock-chips.com>


Acked-by: John Youn <johnyoun@synopsys.com>




      reply	other threads:[~2015-03-17  2:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-15 20:24 [PATCH RESEND] usb: dwc2: avoid leaking DMA channels on disconnection Vincent Palatin
2015-03-16  9:48 ` Yunzhi Li
2015-03-17  2:06   ` John Youn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55078C1B.3090404@synopsys.com \
    --to=john.youn@synopsys.com \
    --cc=balbi@ti.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jwerner@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lyz@rock-chips.com \
    --cc=vpalatin@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox