lkml.org 
[lkml]   [2016]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: host: xhci: Replace bus lock with host controller lock
On Thu, 4 Feb 2016, Chris Bainbridge wrote:

> The XHCI controller presents two USB buses to the system - one for USB 2
> and one for USB 3. When only one bus is locked there is a race condition
> during hub init that results in errors like:
>
> [ 13.183701] usb 3-3: device descriptor read/all, error -110

What exactly is the race condition? Why does locking both buses fix
it?


> @@ -4312,7 +4312,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
> if (oldspeed == USB_SPEED_LOW)
> delay = HUB_LONG_RESET_TIME;
>
> - mutex_lock(&hdev->bus->usb_address0_mutex);
> + mutex_lock(&hdev->bus->controller->mutex);
>
> /* Reset the device; full speed may morph to high speed */
> /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */
> @@ -4588,7 +4588,7 @@ fail:
> hub_port_disable(hub, port1, 0);
> update_devnum(udev, devnum); /* for disconnect processing */
> }
> - mutex_unlock(&hdev->bus->usb_address0_mutex);
> + mutex_unlock(&hdev->bus->controller->mutex);
> return retval;
> }

I don't think this is a good idea. The driver core needs to be able to
access the controller while this function is running. You can
introduce a new mutex if you want, perhaps in the primary hcd
structure, but don't use bus->controller->mutex.

Alan Stern

\
 
 \ /
  Last update: 2016-02-04 22:41    [W:0.073 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site