public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Karsten Wiese <fzu@wemgehoertderstaat.de>,
	amruth <amruth_pv@yahoo.com>, Oliver Neukum <oliver@neukum.org>,
	USB list <linux-usb@vger.kernel.org>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	Greg KH <greg@kroah.com>
Subject: Re: USB Serial device disconnect causes IRQ disable after using ehci controller halted
Date: Tue, 26 Aug 2008 14:43:46 -0700	[thread overview]
Message-ID: <200808261443.47064.david-b@pacbell.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0808261707090.2139-100000@iolanthe.rowland.org>

On Tuesday 26 August 2008, Alan Stern wrote:
> While it certainly would be a good idea to prevent the handshake 
> failures from occurring in the first place -- Dave, aren't you working 
> on a patch for that? -- we should also make sure that when they do 
> occur, the controller gets reset properly.  And an error message should 
> be printed in the log.

Like this?

Greg, please queue for 2.6.27 unless someone finds a
problem with this patch.


=========	SNIP!  SNIP!  SNIPPITY SNIP!
From: David Brownell <dbrownell@users.sourceforge.net>

I noticed that the "Refactor "if (handshake()) state = HC_STATE_HALT"
patch from earlier this year perpetuated a potential problem:  it can
mark the controller as halted when it's still running (but not acting
as, perhaps wrongly, expected).

That caused some hangs and crashes, rather than more polite failure
modes of a truly halted controller.  This patch forces a true halt,
and emits a (previously missing) diagnostic.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/usb/host/ehci-hcd.c |   26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

--- a/drivers/usb/host/ehci-hcd.c	2008-08-15 14:04:27.000000000 -0700
+++ b/drivers/usb/host/ehci-hcd.c	2008-08-15 14:04:36.000000000 -0700
@@ -145,16 +145,6 @@ static int handshake (struct ehci_hcd *e
 	return -ETIMEDOUT;
 }
 
-static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
-				       u32 mask, u32 done, int usec)
-{
-	int error = handshake(ehci, ptr, mask, done, usec);
-	if (error)
-		ehci_to_hcd(ehci)->state = HC_STATE_HALT;
-
-	return error;
-}
-
 /* force HC to halt state from unknown (EHCI spec section 2.3) */
 static int ehci_halt (struct ehci_hcd *ehci)
 {
@@ -173,6 +163,22 @@ static int ehci_halt (struct ehci_hcd *e
 			  STS_HALT, STS_HALT, 16 * 125);
 }
 
+static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
+				       u32 mask, u32 done, int usec)
+{
+	int error;
+
+	error = handshake(ehci, ptr, mask, done, usec);
+	if (error) {
+		ehci_halt(ehci);
+		ehci_to_hcd(ehci)->state = HC_STATE_HALT;
+		ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n",
+			ptr, mask, done, error);
+	}
+
+	return error;
+}
+
 /* put TDI/ARC silicon into EHCI mode */
 static void tdi_reset (struct ehci_hcd *ehci)
 {



  reply	other threads:[~2008-08-26 21:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200808071010.27019.oliver@neukum.org>
2008-08-20 19:34 ` USB Serial device disconnect causes IRQ disable amruth
2008-08-20 20:23   ` Oliver Neukum
2008-08-21  0:18     ` amruth
2008-08-21  5:19       ` Oliver Neukum
2008-08-21  6:03         ` amruth
2008-08-21  6:09           ` Oliver Neukum
2008-08-21  6:18             ` amruth
2008-08-21  6:28               ` Oliver Neukum
2008-08-21 21:02                 ` USB Serial device disconnect causes IRQ disable details captured amruth
2008-08-21 21:20                   ` Alan Stern
2008-08-21 21:52                     ` amruth
2008-08-25 17:50                       ` USB Serial device disconnect causes IRQ disable not working after patch amruth
2008-08-25 18:50                         ` Alan Stern
2008-08-25 21:12                           ` USB Serial device disconnect causes IRQ disable after using ehci_info amruth
2008-08-26  1:56                             ` amruth
2008-08-26 15:01                             ` Alan Stern
2008-08-26 17:18                               ` amruth
2008-08-26 19:00                                 ` USB Serial device disconnect causes IRQ disable after using ehci controller halted amruth
2008-08-26 21:14                                   ` Alan Stern
2008-08-26 21:43                                     ` David Brownell [this message]
2008-08-26 22:56                                       ` amruth
2008-08-27  6:35                                         ` David Brownell
2008-08-27 17:53                                           ` Greg KH
2008-08-27 18:37                                             ` David Brownell

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=200808261443.47064.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=amruth_pv@yahoo.com \
    --cc=fzu@wemgehoertderstaat.de \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.org \
    --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