[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1602041557380.1515-100000@iolanthe.rowland.org>
Date: Thu, 4 Feb 2016 16:00:51 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Chris Bainbridge <chris.bainbridge@...il.com>
cc: mathias.nyman@...ux.intel.com, <johan@...nel.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [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
Powered by blists - more mailing lists