linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
@ 2008-10-23 23:35 Larry Finger
  2008-10-23 23:36 ` Greg KH
  2008-10-24 13:57 ` Alan Stern
  0 siblings, 2 replies; 8+ messages in thread
From: Larry Finger @ 2008-10-23 23:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, LKML

In my system, a number of messages that state "unable to enumerate USB device"
are logged. These are intermittent and likely due to some race condition
at bootup.

Some of these happen when the EHCI driver is loaded after UHCI or OHCI, which
causes the device to be switched away from the other controller that's trying
to enumerate it, at least momentarily. This type of message is logged at most
once for each hub and occurs in about 70% of my reboots.

A more insidious form of the message occurs hundreds of times in about 10% of
reboots. They continue until the system is rebooted. This patch limits the
number of these messages to 20. Once the actual cause of this message is
located, this patch can be reverted.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

Index: linux-2.6/drivers/usb/core/hub.c
===================================================================
--- linux-2.6.orig/drivers/usb/core/hub.c
+++ linux-2.6/drivers/usb/core/hub.c
@@ -2746,6 +2746,7 @@ static void hub_port_connect_change(stru
 			le16_to_cpu(hub->descriptor->wHubCharacteristics);
 	struct usb_device *udev;
 	int status, i;
+	static int enum_count;

 	dev_dbg (hub_dev,
 		"port %d, status %04x, change %04x, %s\n",
@@ -2945,8 +2946,9 @@ loop:
 	if (hub->hdev->parent ||
 			!hcd->driver->port_handed_over ||
 			!(hcd->driver->port_handed_over)(hcd, port1))
-		dev_err(hub_dev, "unable to enumerate USB device on port %d\n",
-				port1);
+		if (enum_count++ < 20)
+			dev_err(hub_dev, "unable to enumerate USB device on "
+				"port %d\n", port1);

 done:
 	hub_port_disable(hub, port1, 1);



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-23 23:35 [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages Larry Finger
@ 2008-10-23 23:36 ` Greg KH
  2008-10-24 16:25   ` Larry Finger
  2008-10-24 13:57 ` Alan Stern
  1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2008-10-23 23:36 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-usb, LKML

On Thu, Oct 23, 2008 at 04:35:01PM -0700, Larry Finger wrote:
> In my system, a number of messages that state "unable to enumerate USB device"
> are logged. These are intermittent and likely due to some race condition
> at bootup.
> 
> Some of these happen when the EHCI driver is loaded after UHCI or OHCI, which
> causes the device to be switched away from the other controller that's trying
> to enumerate it, at least momentarily. This type of message is logged at most
> once for each hub and occurs in about 70% of my reboots.

What kernel version are you having these problems with?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-23 23:35 [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages Larry Finger
  2008-10-23 23:36 ` Greg KH
@ 2008-10-24 13:57 ` Alan Stern
  1 sibling, 0 replies; 8+ messages in thread
From: Alan Stern @ 2008-10-24 13:57 UTC (permalink / raw)
  To: Larry Finger; +Cc: Greg Kroah-Hartman, linux-usb, LKML

On Thu, 23 Oct 2008, Larry Finger wrote:

> In my system, a number of messages that state "unable to enumerate USB device"
> are logged. These are intermittent and likely due to some race condition
> at bootup.
> 
> Some of these happen when the EHCI driver is loaded after UHCI or OHCI, which
> causes the device to be switched away from the other controller that's trying
> to enumerate it, at least momentarily. This type of message is logged at most
> once for each hub and occurs in about 70% of my reboots.

This is normal; it is caused by userspace loading the drivers in the
wrong order.  ehci-hcd is supposed to be loaded before uhci-hcd or
ohci-hcd, not after.  There's no point trying to change the kernel to
avoid it.

> A more insidious form of the message occurs hundreds of times in about 10% of
> reboots. They continue until the system is rebooted. This patch limits the
> number of these messages to 20. Once the actual cause of this message is
> located, this patch can be reverted.

I would prefer to attack this problem directly rather than wallpaper 
over it.  Can you provide more information?  For example, a dmesg log 
with CONFIG_USB_DEBUG and CONFIG_PRINTK_TIME enabled would help.  It 
might also help to know what the devices which can't be enumerated 
actually are.

Alan Stern


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-23 23:36 ` Greg KH
@ 2008-10-24 16:25   ` Larry Finger
  2008-10-24 17:00     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Larry Finger @ 2008-10-24 16:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, LKML

Greg KH wrote:

> What kernel version are you having these problems with?

This problem started sometime in the 2.6.26-git sequence, and persists to the
latest from the linux-2.6 git tree.

Larry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-24 16:25   ` Larry Finger
@ 2008-10-24 17:00     ` Greg KH
  2008-10-25  3:16       ` Larry Finger
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2008-10-24 17:00 UTC (permalink / raw)
  To: Larry Finger; +Cc: Greg KH, linux-usb, LKML

On Fri, Oct 24, 2008 at 09:25:57AM -0700, Larry Finger wrote:
> Greg KH wrote:
> 
> > What kernel version are you having these problems with?
> 
> This problem started sometime in the 2.6.26-git sequence, and persists to the
> latest from the linux-2.6 git tree.

The latest tree should warn you if you load the host controller drivers
in the wrong order, so this shouldn't really be an issue anymore, right?

Like Alan said, proper log messages would be helpful here.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-24 17:00     ` Greg KH
@ 2008-10-25  3:16       ` Larry Finger
  2008-10-25 14:59         ` Alan Stern
  0 siblings, 1 reply; 8+ messages in thread
From: Larry Finger @ 2008-10-25  3:16 UTC (permalink / raw)
  To: Greg KH; +Cc: Greg KH, linux-usb, LKML

Greg KH wrote:
> 
> The latest tree should warn you if you load the host controller drivers
> in the wrong order, so this shouldn't really be an issue anymore, right?

I have not seen such warhings, thus I expect loading is in the proper order.
> 
> Like Alan said, proper log messages would be helpful here.

Agreed, but I have no idea what I should be looking for. For the moment, I have
lots of test prints looking for the sequence of events that lead to this
spamming of the logs.

Larry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-25  3:16       ` Larry Finger
@ 2008-10-25 14:59         ` Alan Stern
  2008-10-27 16:37           ` Larry Finger
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Stern @ 2008-10-25 14:59 UTC (permalink / raw)
  To: Larry Finger; +Cc: Greg KH, USB list, LKML

On Fri, 24 Oct 2008, Larry Finger wrote:

> Greg KH wrote:
> > 
> > The latest tree should warn you if you load the host controller drivers
> > in the wrong order, so this shouldn't really be an issue anymore, right?
> 
> I have not seen such warhings, thus I expect loading is in the proper order.
> > 
> > Like Alan said, proper log messages would be helpful here.
> 
> Agreed, but I have no idea what I should be looking for. For the moment, I have
> lots of test prints looking for the sequence of events that lead to this
> spamming of the logs.

Just build your test kernel with USB debugging enabled, and when you 
get that spamming, post the complete dmesg log.

Alan Stern


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages
  2008-10-25 14:59         ` Alan Stern
@ 2008-10-27 16:37           ` Larry Finger
  0 siblings, 0 replies; 8+ messages in thread
From: Larry Finger @ 2008-10-27 16:37 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg KH, USB list, LKML

Alan Stern wrote:
> 
> Just build your test kernel with USB debugging enabled, and when you 
> get that spamming, post the complete dmesg log.

Once I added ehci_hcd to my initrd, which ensured that it was loaded first, the
error messages seem to have disappeared. If they return, I'll open a new thread.

Thanks for the help,

Larry


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-10-27 16:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23 23:35 [PATCH] usbcore: Limit number of 'unable to enumerate USB device' messages Larry Finger
2008-10-23 23:36 ` Greg KH
2008-10-24 16:25   ` Larry Finger
2008-10-24 17:00     ` Greg KH
2008-10-25  3:16       ` Larry Finger
2008-10-25 14:59         ` Alan Stern
2008-10-27 16:37           ` Larry Finger
2008-10-24 13:57 ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).