BUG: remove ASS/PSS polling timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 17 Feb 2013, Ronald wrote:

> Current head gives this when I plug a 'Mass Storage Device' into a 2.0 hub:
> 
> [  842.760400] hub 1-0:1.0: unable to enumerate USB device on port 3
> [  843.080058] usb 1-3: new high-speed USB device number 48 using ehci-pci
> [  858.230072] usb 1-3: device descriptor read/64, error -110
> [  873.490070] usb 1-3: device descriptor read/64, error -110
> 
> Reverting the following commit makes it work again:
> 
> commit 55bcdce8a8228223ec4d17d8ded8134ed265d2c5
> Author: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Date:   Fri Jan 25 16:52:45 2013 -0500
> 
>     USB: EHCI: remove ASS/PSS polling timeout
> 
>     This patch (as1647) attempts to work around a problem that seems to
>     affect some nVidia EHCI controllers.  They sometimes take a very long
>     time to turn off their async or periodic schedules.  I don't know if
>     this is a result of other problems, but in any case it seems wise not
>     to depend on schedule enables or disables taking effect in any
>     specific length of time.
> 
>     The patch removes the existing 20-ms timeout for enabling and
>     disabling the schedules.  The driver will now continue to poll the
>     schedule state at 1-ms intervals until the controller finally decides
>     to obey the most recent command issued by the driver.  Just in case
>     this hides a problem, a debugging message will be logged if the
>     controller takes longer than 20 polls.
> 
>     I don't know if this will actually fix anything, but it can't hurt.


On Thu, 14 Feb 2013, Paul Hartman wrote:

> I ran git bisect on kernel and found this commit. "but it can't hurt"
> famous last words :)
> 
> 269ef9f3805a5ec17ddf3dd5f13d5e09598c155b is the first bad commit
> commit 269ef9f3805a5ec17ddf3dd5f13d5e09598c155b
> Author: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Date:   Fri Jan 25 16:52:45 2013 -0500
> 
>     USB: EHCI: remove ASS/PSS polling timeout

Okay.  I have no idea what could be going wrong, but obviously we need 
to find out.  The patch below will add a bunch of debugging info 
related to this commit.  For it to work, you will need to enable 
CONFIG_USB_DEBUG when you build your kernels.

Please post the output from "dmesg", showing what happens starting from 
boot-up until a device fails.

Alan Stern



Index: usb-3.8/drivers/usb/host/ehci-hcd.c
===================================================================
--- usb-3.8.orig/drivers/usb/host/ehci-hcd.c
+++ usb-3.8/drivers/usb/host/ehci-hcd.c
@@ -287,6 +287,9 @@ static void ehci_quiesce (struct ehci_hc
 	/* wait for any schedule enables/disables to take effect */
 	temp = (ehci->command << 10) & (STS_ASS | STS_PSS);
 	handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, temp, 16 * 125);
+	ehci_dbg(ehci, "quiesce: temp %x status %x\n", temp,
+			ehci_readl(ehci, &ehci->regs->status) &
+				(STS_ASS | STS_PSS));
 
 	/* then disable anything that's still active */
 	spin_lock_irq(&ehci->lock);
@@ -296,6 +299,9 @@ static void ehci_quiesce (struct ehci_hc
 
 	/* hardware can take 16 microframes to turn off ... */
 	handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, 0, 16 * 125);
+	ehci_dbg(ehci, "quiesce2: status %x\n",
+			ehci_readl(ehci, &ehci->regs->status) &
+				(STS_ASS | STS_PSS));
 }
 
 /*-------------------------------------------------------------------------*/
Index: usb-3.8/drivers/usb/host/ehci-timer.c
===================================================================
--- usb-3.8.orig/drivers/usb/host/ehci-timer.c
+++ usb-3.8/drivers/usb/host/ehci-timer.c
@@ -110,6 +110,8 @@ static void ehci_poll_ASS(struct ehci_hc
 
 	want = (ehci->command & CMD_ASE) ? STS_ASS : 0;
 	actual = ehci_readl(ehci, &ehci->regs->status) & STS_ASS;
+	ehci_dbg(ehci, "ASS want %x actual %x count %d\n",
+			want, actual, ehci->ASS_poll_count);
 
 	if (want != actual) {
 
@@ -126,8 +128,10 @@ static void ehci_poll_ASS(struct ehci_hc
 
 	/* The status is up-to-date; restart or stop the schedule as needed */
 	if (want == 0) {	/* Stopped */
-		if (ehci->async_count > 0)
+		if (ehci->async_count > 0) {
+			ehci_dbg(ehci, "Set ASE\n");
 			ehci_set_command_bit(ehci, CMD_ASE);
+		}
 
 	} else {		/* Running */
 		if (ehci->async_count == 0) {
@@ -142,6 +146,7 @@ static void ehci_poll_ASS(struct ehci_hc
 /* Turn off the async schedule after a brief delay */
 static void ehci_disable_ASE(struct ehci_hcd *ehci)
 {
+	ehci_dbg(ehci, "Clear ASE");
 	ehci_clear_command_bit(ehci, CMD_ASE);
 }
 
@@ -157,6 +162,8 @@ static void ehci_poll_PSS(struct ehci_hc
 
 	want = (ehci->command & CMD_PSE) ? STS_PSS : 0;
 	actual = ehci_readl(ehci, &ehci->regs->status) & STS_PSS;
+	ehci_dbg(ehci, "PSS want %x actual %x count %d\n",
+			want, actual, ehci->PSS_poll_count);
 
 	if (want != actual) {
 
@@ -172,8 +179,10 @@ static void ehci_poll_PSS(struct ehci_hc
 
 	/* The status is up-to-date; restart or stop the schedule as needed */
 	if (want == 0) {	/* Stopped */
-		if (ehci->periodic_count > 0)
+		if (ehci->periodic_count > 0) {
+			ehci_dbg(ehci, "Set PSE\n");
 			ehci_set_command_bit(ehci, CMD_PSE);
+		}
 
 	} else {		/* Running */
 		if (ehci->periodic_count == 0) {
@@ -188,6 +197,7 @@ static void ehci_poll_PSS(struct ehci_hc
 /* Turn off the periodic schedule after a brief delay */
 static void ehci_disable_PSE(struct ehci_hcd *ehci)
 {
+	ehci_dbg(ehci, "Clear PSE");
 	ehci_clear_command_bit(ehci, CMD_PSE);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux