mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: USB list <linux-usb@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dianders@chromium.org, linux@roeck-us.net,
	gregkh@linuxfoundation.org
Subject: Re: USB disk speed regression WD Elements - with bisect result 22547c4cc4fe20698a6a85a55b8788859134b8e4
Date: Thu, 27 Jul 2017 11:11:49 +0200	[thread overview]
Message-ID: <f2c600c9-1caa-9ddb-ae25-8067810c4ceb@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1707262037220.7542-100000@netrider.rowland.org>

Dne 27.7.2017 v 03:03 Alan Stern napsal(a):
> [Added linux-usb mailing list to CC:]
> 
> Short description of bug: In 4.12 or later, when Zdenek's Western
> Digital disk is attached to an EHCI controller, it ends up connecting
> at full speed to the companion UHCI controller instead.  But when
> commit 22547c4cc4fe ("usb: hub: Wait for connection to be reestablished
> after port reset")  is reverted, the disk connects correctly at high
> speed.
> 
> On Wed, 26 Jul 2017, Zdenek Kabelac wrote:
> 
>> Dne 25.7.2017 v 21:50 Alan Stern napsal(a):
>>> On Tue, 25 Jul 2017, Zdenek Kabelac wrote:
>>>
>>>
>>> 08:18 usb 2-2: USB disconnect, device number 2
>>> 08:25 usb 2-2: new high-speed USB device number 3 using ehci-pci
>>> 08:26 usb 2-2: new high-speed USB device number 4 using ehci-pci
>>>
>>> If the drive were working entirely correctly, it wouldn't do that.
>>>
>>> We could continue futzing around with hardware and driver tests for a
>>> long time.  But there may be a shortcut: If you have a USB hub, you
>>> could try attaching the drive through it.  It's entirely possible that
>>> this will fix the problem.
>>>
>>> If not, you'll have to start doing some very detailed tests.  As a
>>> start, you can enable debugging for the usbcore and ehci_hcd drivers
>>> immediately before the test:
>>>
>>> echo 'module usbcore =p' >/sys/kernel/debug/dynamic_debug/control
>>> echo 'module ehci_hcd =p' >/sys/kernel/debug/dynamic_debug/control
>>> dmesg -C
>>>
>>> Then after the test, see what shows up in the dmesg output.  And again,
>>> we'll want to do a comparison.  In fact, 4.12 with and without the
>>> commit you identified would make a better comparison than 4.12 vs. 4.8.
>>>
>>
>>
>> Hi
>>
>>
>> So here we go with traces - made with freshly compiled recent 4.13-rc2.
>> OK trace is with revert patch applied.
>> BAD trace is the one with it (essentially vaniala master).
>>
>> Trace also has KOBJECT debugging enabled - I think difference is
>> nicely visible between them - but I've no explanation for it.
>>
>> Both traces start with cable detach followed with attachment.
> 
> Okay, I figured out the cause.
> 
> The USB stack assumes that if a high-speed device initialization fails
> and the device is still connected, it means that the device can't run
> properly at high speed and the computer needs to try again at full
> speed.  See commit 90da096ee46b ("USB: force handover port to companion
> when hub_port_connect_change fails").
> 
> In Zdenek's case, the device really does disconnect itself before the
> second port reset.  If 22547c4cc4fe is present, it causes an extra
> delay -- some 200 ms -- long enough for the device to reconnect again.
> So we appear to be in the situation described above, and the connection
> is switched over to the companion controller.
> 
> If 22547c4cc4fe is not present, the kernel sees that the device is not
> connected at the end of the second reset and gives up trying to
> initialize the device.  When the device reconnects about 140 ms later,
> the kernel treats it as a new connection and successfully negotiates a
> high-speed link.
> 
> Zdenek, you check this explanation by commenting out these last two
> lines at the end of hub_port_connect() in drivers/usb/core/hub.c:
> 
> 	if (hcd->driver->relinquish_port && !hub->hdev->parent)
> 		hcd->driver->relinquish_port(hcd, port1);
> 
> That should prevent the connection from being handed over to the UHCI
> companion, allowing the device to operate at high speed.
>

Hi

Yep - seems this helped - I've dropped revert and commented those 2 lines
and I've used the very same kernel - and speed was all good:

usb 2-2: new high-speed USB device number 2 using ehci-pci
usb 2-2: new high-speed USB device number 3 using ehci-pci
usb 2-2: New USB device found, idVendor=1058, idProduct=10a8
usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3


So while I'm not sure if this is final fix for USB - this solution surely 
solved my WD Element disk attachment issue.

Regards

Zdenek

  reply	other threads:[~2017-07-27  9:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 12:03 Zdenek Kabelac
2017-07-24 14:41 ` Alan Stern
2017-07-24 21:03   ` Guenter Roeck
2017-07-25 10:06   ` Zdenek Kabelac
2017-07-25 14:25     ` Alan Stern
2017-07-25 14:34       ` Zdenek Kabelac
2017-07-25 15:03         ` Zdenek Kabelac
2017-07-25 17:02           ` Alan Stern
2017-07-25 17:46             ` Zdenek Kabelac
2017-07-25 19:50               ` Alan Stern
2017-07-26  2:33                 ` Guenter Roeck
2017-07-26 14:28                   ` Alan Stern
2017-07-26 14:36                     ` Zdenek Kabelac
2017-07-26 15:04                       ` Alan Stern
2017-07-26 17:49                 ` Zdenek Kabelac
2017-07-27  1:03                   ` Alan Stern
2017-07-27  9:11                     ` Zdenek Kabelac [this message]
2017-07-28 18:33                       ` Alan Stern
     [not found] <49a43034-9330-e48d-f0d5-896b23ecb552@redhat.com>
2017-07-29  2:09 ` Alan Stern

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=f2c600c9-1caa-9ddb-ae25-8067810c4ceb@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®