Re: 2.6.33: Xorg+khubd lockup (D-state) BUG / ioctl EVIOCGNAMEfailed: Inappropriate ioctl for device / PreInit returned NULL

From: Alan Stern
Date: Mon Mar 29 2010 - 11:34:04 EST


On Mon, 29 Mar 2010, Justin Piszcz wrote:

> Done, here is the output:
>
> BEFORE UNPLUG:
>
> # cat ./kernel/debug/usb/ohci/0000:00:0b.0/periodic
> size = 32
> 0 [117]: ed8/f674a040 (ls dev2 ep1in-int qlen 1 max 8 00083082)
> 1 [ 98]: ed8/f674a0c0 (ls dev3 ep1in-int qlen 1 max 5 00053083)
> 8 [117]: ed8/f674a040
> 9 [ 98]: ed8/f674a0c0
> 16 [117]: ed8/f674a040
> 17 [ 98]: ed8/f674a0c0
> 24 [117]: ed8/f674a040
> 25 [ 98]: ed8/f674a0c0
>
> UNPLUG:
>
> # cat ./kernel/debug/usb/ohci/0000:00:0b.0/periodic
> size = 32
> 0 [117]: ed8/f674a040 (ls dev2 ep1in-int qlen 1 max 8 00083082)
> 8 [117]: ed8/f674a040
> 16 [117]: ed8/f674a040
> 24 [117]: ed8/f674a040
>
> AFTER PLUG BACK IN:
>
> # cat ./kernel/debug/usb/ohci/0000:00:0b.0/periodic
> size = 32
> 0 [117]: ed8/f674a040 (ls dev2 ep1in-int qlen 1 max 8 00083082)
> 8 [117]: ed8/f674a040
> 16 [117]: ed8/f674a040
> 24 [117]: ed8/f674a040

What about the "registers" file?

> KERNEL MESSAGES:
>
> [ 30.569377] usb 2-5:1.0: uevent
> [ 30.572365] usb 2-6:1.0: uevent
> [ 1053.663314] usb usb1: uevent
> [ 1053.663404] usb 1-0:1.0: uevent
> [ 1053.663455] usb usb2: uevent
> [ 1053.663530] usb 2-0:1.0: uevent
> [ 1053.663582] usb 2-5: uevent
> [ 1053.663656] usb 2-5:1.0: uevent
> [ 1053.663706] usb 2-6: uevent
> [ 1053.663777] usb 2-6:1.0: uevent
> [333937.016444] hub 2-0:1.0: state 7 ports 8 chg 0000 evt 0040
> [333937.016453] ohci_hcd 0000:00:0b.0: GetStatus roothub.portstatus [5] = 0x00030300 PESC CSC LSDA PPS
> [333937.016458] hub 2-0:1.0: port 6, status 0300, change 0003, 1.5 Mb/s
> [333937.016461] usb 2-6: USB disconnect, address 3
> [333937.016463] usb 2-6: unregistering device
> [333937.016465] usb 2-6: usb_disable_device nuking all URBs
> [333937.016472] ohci_hcd 0000:00:0b.0: shutdown urb f6a2d540 ep1in-intr

This all looks normal. It's possible that we've been looking for the
bug in the wrong place; maybe there's nothing wrong with the OHCI
controller.

So next you should get a usbmon trace showing what happens on bus 2
when one of these mouse failures occurs. Instructions for usbmon are
in Documentation/usb/usbmon.txt.

At the same time, just to be increase my level of certainty, you should
apply the following debugging patch for ohci-hcd. Let's see both the
usbmon trace and the dmesg log for the same event. The trace and the
debugging patch will generate plenty of output during normal operation,
but don't worry about that. Only the part starting from shortly before
the mouse quits really matters.

Alan Stern


Index: usb-2.6/drivers/usb/host/ohci-hcd.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/ohci-hcd.c
+++ usb-2.6/drivers/usb/host/ohci-hcd.c
@@ -290,6 +290,8 @@ static int ohci_urb_dequeue(struct usb_h
*/
urb_priv = urb->hcpriv;
if (urb_priv) {
+ ohci_info(ohci, "start unlink urb %p, ed %p\n",
+ urb, urb_priv->ed);
if (urb_priv->ed->state == ED_OPER)
start_ed_unlink (ohci, urb_priv->ed);
}
@@ -324,6 +326,9 @@ ohci_endpoint_disable (struct usb_hcd *h

if (!ed)
return;
+ ohci_info(ohci, "disable ed %p (#%02x) state %d%s\n",
+ ed, ep->desc.bEndpointAddress, ed->state,
+ list_empty(&ed->td_list) ? "" : " (has tds)");

rescan:
spin_lock_irqsave (&ohci->lock, flags);
@@ -770,6 +775,10 @@ static irqreturn_t ohci_irq (struct usb_
return IRQ_HANDLED;
}

+ ohci_info(ohci, "int %x enable %x rm_list %p\n", ints,
+ ohci_readl(ohci, &regs->intrenable),
+ ohci->ed_rm_list);
+
/* We only care about interrupts that are enabled */
ints &= ohci_readl(ohci, &regs->intrenable);


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