On Fri, Sep 20, 2002, Doug Alcorn <[EMAIL PROTECTED]> wrote:
> In writing my device driver, I connect and disconnect my device quite
> a bit. Every so often I get this message. I typically reboot after I
> see it. I can't imaging anything described as "very bad" being
> something I should just blindly continue on with.
>
> The machine is a Sony Vaio PCG-F650. I've got UCHI Alternate Driver
> (JE) compiled into the kernel. This is on kernel 2.4.20-pre4 pulled
> from the usb-2.4 bk tree. Here's the kern.log, let me know if there's
> more information you need.
>
> Sep 20 12:31:42 kerneltest kernel: uhci.c: root-hub INT complete: port1: 80 port2:
>8a data: 4
> Sep 20 12:31:42 kerneltest kernel: uhci.c: fca0: suspend_hc
> Sep 20 12:31:42 kerneltest kernel: uhci.c: fca0: wakeup_hc
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 1, portstatus 100, change 0, 12 Mb/s
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 2, portstatus 100, change 3, 12 Mb/s
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 2 connection change
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 2, portstatus 100, change 3, 12 Mb/s
> Sep 20 12:31:42 kerneltest kernel: usb.c: USB disconnect on device 4
> Sep 20 12:31:42 kerneltest kernel: driverfs-dataplay.c: dpdevfs_mount_count = 0
> Sep 20 12:31:42 kerneltest kernel: ci-dataplay.c: USB DataPlay #0 now disconnected
> Sep 20 12:31:42 kerneltest kernel: usb.c: kusbd: /sbin/hotplug remove 4
> Sep 20 12:31:42 kerneltest kernel: uhci.c: root-hub INT complete: port1: 80 port2:
>88 data: 4
> Sep 20 12:31:42 kerneltest kernel: uhci.c: fca0: suspend_hc
> Sep 20 12:31:42 kerneltest kernel: uhci.c: fca0: host controller halted. very bad
> Sep 20 12:31:42 kerneltest kernel: uhci.c: fca0: wakeup_hc
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 1, portstatus 100, change 0, 12 Mb/s
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 2, portstatus 100, change 2, 12 Mb/s
> Sep 20 12:31:42 kerneltest kernel: hub.c: port 2 enable change, status 100
It's probably just a race condition with checking is_suspended and
harmless.
Can you try this patch? This should fix that race as well as make sure
we only suspend the HC when we have nothing else waiting. (Another bug)
JE
--- linux-2.4.20-pre7.orig/drivers/usb/uhci.c Fri Sep 20 13:03:02 2002
+++ linux-2.4.20-pre7/drivers/usb/uhci.c Fri Sep 20 13:24:54 2002
@@ -1995,7 +1995,8 @@
struct urb *urb = (struct urb *)ptr;
struct uhci *uhci = (struct uhci *)urb->dev->bus->hcpriv;
struct list_head list, *tmp, *head;
- unsigned long flags;
+ unsigned long flags, oflags;
+ int empty;
if (uhci->rh.send)
rh_send_irq(urb);
@@ -2025,6 +2026,25 @@
spin_unlock(&u->lock);
}
+
+ empty = list_empty(&uhci->urb_list) && list_empty(&list);
+
+ if (empty) {
+ spin_lock_irqsave(&uhci->urb_remove_list_lock, oflags);
+ empty |= list_empty(&uhci->urb_remove_list);
+ spin_unlock_irqrestore(&uhci->urb_remove_list_lock, oflags);
+ }
+
+ if (empty) {
+ spin_lock_irqsave(&uhci->qh_remove_list_lock, oflags);
+ empty |= list_empty(&uhci->qh_remove_list);
+ spin_unlock_irqrestore(&uhci->qh_remove_list_lock, oflags);
+ }
+
+ /* enter global suspend if nothing connected */
+ if (!uhci->is_suspended && !ports_active(uhci) && empty)
+ suspend_hc(uhci);
+
spin_unlock_irqrestore(&uhci->urb_list_lock, flags);
head = &list;
@@ -2044,10 +2064,6 @@
uhci->skel_term_qh->link = UHCI_PTR_TERM;
}
- /* enter global suspend if nothing connected */
- if (!uhci->is_suspended && !ports_active(uhci))
- suspend_hc(uhci);
-
rh_init_int_timer(urb);
}
@@ -2506,9 +2522,9 @@
dbg("%x: suspend_hc", io_addr);
- outw(USBCMD_EGSM, io_addr + USBCMD);
-
uhci->is_suspended = 1;
+
+ outw(USBCMD_EGSM, io_addr + USBCMD);
}
static void wakeup_hc(struct uhci *uhci)