Re: USB warning on cdc-acm device close

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Stern
Date: Wednesday, July 29, 2009 - 9:11 am

On Wed, 29 Jul 2009, Manuel Lauss wrote:


Good.


Sorry, my mistake.  I forgot that closing the device was enough to 
trigger the error.


I think I figured out the problem.  The patch below (which includes the 
previous patch) should fix it.  Let me know how it works.


That is where khubd is normally supposed to wait, and it means my guess 
about being stuck was wrong.  However the new patch may solve this 
problem as well.

If it doesn't, can you provide both the dmesg log and a usbmon log
(with the new patch) showing what happens when you reload ehci-hcd and
the CDC-ACM device is detected but fails to work?

Matthijs and Valdis, please just try this new patch in place of the old 
one and see if those "dma_pool_destroy" error messages are still 
present when you unload ehci-hcd.

Alan Stern



Index: 2.6.31-rc4/drivers/usb/host/ehci-hcd.c
===================================================================
--- 2.6.31-rc4.orig/drivers/usb/host/ehci-hcd.c
+++ 2.6.31-rc4/drivers/usb/host/ehci-hcd.c
@@ -903,7 +903,8 @@ static int ehci_urb_dequeue(struct usb_h
 			/* already started */
 			break;
 		case QH_STATE_IDLE:
-			WARN_ON(1);
+			/* QH might be waiting for a Clear-TT-Buffer */
+			qh_completions(ehci, qh);
 			break;
 		}
 		break;
Index: 2.6.31-rc4/drivers/usb/host/ehci-q.c
===================================================================
--- 2.6.31-rc4.orig/drivers/usb/host/ehci-q.c
+++ 2.6.31-rc4/drivers/usb/host/ehci-q.c
@@ -940,6 +940,7 @@ static void qh_link_async (struct ehci_h
 	head->qh_next.qh = qh;
 	head->hw_next = dma;
 
+	qh_get(qh);
 	qh->xacterrs = QH_XACTERR_MAX;
 	qh->qh_state = QH_STATE_LINKED;
 	/* qtd completions reported later by interrupt */
@@ -1080,7 +1081,7 @@ submit_async (
 	 * the HC and TT handle it when the TT has a buffer ready.
 	 */
 	if (likely (qh->qh_state == QH_STATE_IDLE))
-		qh_link_async (ehci, qh_get (qh));
+		qh_link_async(ehci, qh);
  done:
 	spin_unlock_irqrestore (&ehci->lock, flags);
 	if (unlikely (qh == NULL))
@@ -1115,8 +1116,6 @@ static void end_unlink_async (struct ehc
 			&& HC_IS_RUNNING (ehci_to_hcd(ehci)->state))
 		qh_link_async (ehci, qh);
 	else {
-		qh_put (qh);		// refcount from async list
-
 		/* it's not free to turn the async schedule on/off; leave it
 		 * active but idle for a while once it empties.
 		 */
@@ -1124,6 +1123,7 @@ static void end_unlink_async (struct ehc
 				&& ehci->async->qh_next.qh == NULL)
 			timer_action (ehci, TIMER_ASYNC_OFF);
 	}
+	qh_put(qh);			/* refcount from async list */
 
 	if (next) {
 		ehci->reclaim = NULL;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: USB warning on cdc-acm device close, Alan Stern, (Wed Jul 29, 9:11 am)
Re: USB warning on cdc-acm device close, Manuel Lauss, (Wed Jul 29, 10:26 pm)