Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Fri, 22 Sep 2006, Rafael J. Wysocki wrote: I have tested 2.6.18-rc6-mm2 with your patch applied (it is called 2.6.18-rc6 in the attached dmesg outputs, but that's because I have a customized 2.6.18-rc6-mm2 installed and I didn't want to replace it). I have tested both with and without CONFIG_USB_SUSPEND set. In either case I booted the system without my USB mouse. Then, I plugged the mouse in and checked if it worked. Next, I suspended and resumed the system twice checking if the mouse worked after each resume, without unplugging it. Finally, after the second resume I unplugged and replugged the mouse. The results are the following: 1) The kernel compiled without CONFIG_USB_SUSPEND works just fine, suspends and resumes correctly, and the mouse always works (ie. is correctly detected every time). Good. 2) The kernel compiled with CONFIG_USB_SUSPEND set doesn't detect the mouse plugged in after a fresh boot. However, if the mouse is connected to a USB port during an entire suspend/resume cycle, it works after the resume, but when it's unplugged after the resume and replugged, the kernel fails to detect it. The outputs of dmesg for each case are attached. This helped. I think I figured out the problem. Below is a new version of the patch I asked you to try. It's the same as before except that I removed a bunch of extra code. Some weird interactions between the driver and usbcore prevented status-change interrupts from being enabled; hence the connect-change events just get lost. Anyway, this should solve the problem. If it doesn't, we can settle on a single test case: CONFIG_USB_SUSPEND set, mouse not plugged in during boot, mouse not detected when plugged in after boot-up. Alan Stern Index: mm/drivers/usb/core/hub.c === --- mm.orig/drivers/usb/core/hub.c +++ mm/drivers/usb/core/hub.c @@ -1063,6 +1063,12 @@ void usb_root_hub_lost_power(struct usb_ unsigned long flags; dev_warn(rhdev-dev, root hub lost power or was reset\n); + + /* Make sure no potential wakeup events get lost, +* by forcing the root hub to be resumed. +*/ + rhdev-dev.power.prev_state.event = PM_EVENT_ON; + spin_lock_irqsave(device_state_lock, flags); hub = hdev_to_hub(rhdev); for (port1 = 1; port1 = rhdev-maxchild; ++port1) { Index: mm/drivers/usb/core/driver.c === --- mm.orig/drivers/usb/core/driver.c +++ mm/drivers/usb/core/driver.c @@ -1079,11 +1079,12 @@ int usb_resume_both(struct usb_device *u PM_EVENT_ON) status = -EHOSTUNREACH; } - if (status == 0 udev-state == USB_STATE_SUSPENDED) + if (status == 0) status = resume_device(udev); if (parent) mutex_unlock(parent-pm_mutex); - } + } else + status = resume_device(udev); /* Now the parent won't suspend until we are finished */ Index: mm/drivers/usb/host/ohci-hub.c === --- mm.orig/drivers/usb/host/ohci-hub.c +++ mm/drivers/usb/host/ohci-hub.c @@ -41,6 +41,8 @@ static void ohci_rhsc_enable (struct usb { struct ohci_hcd *ohci = hcd_to_ohci (hcd); + ohci_vdbg (ohci, rhsc enable\n); + hcd-poll_rh = 0; ohci_writel (ohci, OHCI_INTR_RHSC, ohci-regs-intrenable); } @@ -379,29 +381,11 @@ ohci_hub_status_data (struct usb_hcd *hc ohci-hc_control) == OHCI_USB_OPER; #endif - if (hcd-uses_new_polling) { - hcd-poll_rh = 0; - /* use INTR_RHSC iff INTR_RD won't apply */ - if (!can_suspend) - ohci_writel (ohci, OHCI_INTR_RHSC, - ohci-regs-intrenable); - } } done: spin_unlock_irqrestore (ohci-lock, flags); -#ifdef CONFIG_PM - /* save power by autosuspending idle root hubs; -* INTR_RD wakes us when there's work -*/ - if (can_suspend usb_trylock_device (hcd-self.root_hub) == 0) { - ohci_vdbg (ohci, autosuspend\n); - (void) ohci_bus_suspend (hcd); - usb_unlock_device (hcd-self.root_hub); - } -#endif - return changed ? length : 0; } @@ -572,9 +556,6 @@ static int ohci_hub_control ( break; case USB_PORT_FEAT_SUSPEND: temp = RH_PS_POCI; - if ((ohci-hc_control OHCI_CTRL_HCFS) - != OHCI_USB_OPER) - usb_hcd_resume_root_hub(hcd);
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Friday, 22 September 2006 17:18, Alan Stern wrote: On Fri, 22 Sep 2006, Rafael J. Wysocki wrote: I have tested 2.6.18-rc6-mm2 with your patch applied (it is called 2.6.18-rc6 in the attached dmesg outputs, but that's because I have a customized 2.6.18-rc6-mm2 installed and I didn't want to replace it). I have tested both with and without CONFIG_USB_SUSPEND set. In either case I booted the system without my USB mouse. Then, I plugged the mouse in and checked if it worked. Next, I suspended and resumed the system twice checking if the mouse worked after each resume, without unplugging it. Finally, after the second resume I unplugged and replugged the mouse. The results are the following: 1) The kernel compiled without CONFIG_USB_SUSPEND works just fine, suspends and resumes correctly, and the mouse always works (ie. is correctly detected every time). Good. 2) The kernel compiled with CONFIG_USB_SUSPEND set doesn't detect the mouse plugged in after a fresh boot. However, if the mouse is connected to a USB port during an entire suspend/resume cycle, it works after the resume, but when it's unplugged after the resume and replugged, the kernel fails to detect it. The outputs of dmesg for each case are attached. This helped. I think I figured out the problem. Below is a new version of the patch I asked you to try. It's the same as before except that I removed a bunch of extra code. Some weird interactions between the driver and usbcore prevented status-change interrupts from being enabled; hence the connect-change events just get lost. Anyway, this should solve the problem. It does. Now the kernel with CONFIG_USB_SUSPEND set works fine. Thanks, Rafael -- You never change things by fighting the existing reality. R. Buckminster Fuller - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
[Trimmed down the CC list] On Mon, 18 Sep 2006, Rafael J. Wysocki wrote: On Monday, 18 September 2006 17:07, Alan Stern wrote: On Mon, 18 Sep 2006, Rafael J. Wysocki wrote: Actually, the problem is ohci_hcd doesn't seem to recognize devices plugged into the USB ports. For example, if I unplug and replug a mouse (that worked before unplugging), it doesn't work any more. I have to reload ohci_hcd to make it work again. This is 100% reproducible and occurs on the two boxes above. I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Tell me, what happens if you leave that patch installed, and you use the patch I sent last week (the one that removes a chunk of code from ohci-hub.c), and you also set CONFIG_USB_SUSPEND? The problem continues to happen. Moreover, if I revert the above patch and apply the patch removing code from ohci-hub.c, the problem reappears. I'm working on this, but it's slow going because I'm not very familiar with ohci-hcd. One of my computers does have OHCI controllers but I can't reproduce your problem. In the meantime, let's make sure I understand the symptoms properly. Let's say you start with pure 2.6.18-rc6-mm2 and apply the patch below. (Two of the parts have already been submitted and the third is for testing.) Let's also say you start with a clean boot and don't do any suspends. Finally, let's say you leave the mouse unplugged while you boot and then plug it in afterward. Does it work? If it does, what happens if you unplug it and then replug it several seconds later? Do you see the problem is CONFIG_USB_SUSPEND isn't set? What about if it is set? What do the kernel logs show? Assuming the symptoms do not appear, if you do suspend-to-disk do they appear afterward? Alan Stern Index: mm/drivers/usb/core/hub.c === --- mm.orig/drivers/usb/core/hub.c +++ mm/drivers/usb/core/hub.c @@ -1063,6 +1063,12 @@ void usb_root_hub_lost_power(struct usb_ unsigned long flags; dev_warn(rhdev-dev, root hub lost power or was reset\n); + + /* Make sure no potential wakeup events get lost, +* by forcing the root hub to be resumed. +*/ + rhdev-dev.power.prev_state.event = PM_EVENT_ON; + spin_lock_irqsave(device_state_lock, flags); hub = hdev_to_hub(rhdev); for (port1 = 1; port1 = rhdev-maxchild; ++port1) { Index: mm/drivers/usb/core/driver.c === --- mm.orig/drivers/usb/core/driver.c +++ mm/drivers/usb/core/driver.c @@ -1079,11 +1079,12 @@ int usb_resume_both(struct usb_device *u PM_EVENT_ON) status = -EHOSTUNREACH; } - if (status == 0 udev-state == USB_STATE_SUSPENDED) + if (status == 0) status = resume_device(udev); if (parent) mutex_unlock(parent-pm_mutex); - } + } else + status = resume_device(udev); /* Now the parent won't suspend until we are finished */ Index: mm/drivers/usb/host/ohci-hub.c === --- mm.orig/drivers/usb/host/ohci-hub.c +++ mm/drivers/usb/host/ohci-hub.c @@ -391,17 +391,6 @@ ohci_hub_status_data (struct usb_hcd *hc done: spin_unlock_irqrestore (ohci-lock, flags); -#ifdef CONFIG_PM - /* save power by autosuspending idle root hubs; -* INTR_RD wakes us when there's work -*/ - if (can_suspend usb_trylock_device (hcd-self.root_hub) == 0) { - ohci_vdbg (ohci, autosuspend\n); - (void) ohci_bus_suspend (hcd); - usb_unlock_device (hcd-self.root_hub); - } -#endif - return changed ? length : 0; } @@ -572,9 +561,6 @@ static int ohci_hub_control ( break; case USB_PORT_FEAT_SUSPEND: temp = RH_PS_POCI; - if ((ohci-hc_control OHCI_CTRL_HCFS) - != OHCI_USB_OPER) - usb_hcd_resume_root_hub(hcd); break; case USB_PORT_FEAT_C_SUSPEND: temp = RH_PS_PSSC; Index: mm/drivers/usb/host/ohci-hcd.c === --- mm.orig/drivers/usb/host/ohci-hcd.c +++ mm/drivers/usb/host/ohci-hcd.c @@ -107,7 +107,7 @@ /*-*/ -#undef OHCI_VERBOSE_DEBUG /* not always helpful */ +#define OHCI_VERBOSE_DEBUG /* not always helpful */ /* For initializing controller (mask in an HCFS mode too) */ #defineOHCI_CONTROL_INIT
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Saturday, 16 September 2006 10:13, Rafael J. Wysocki wrote: On Saturday, 16 September 2006 00:13, Rafael J. Wysocki wrote: It looks like the ohci_hcd driver sometimes has problems with the initialization (eg. USB mouse doesn't work after a fresh boot and reloading of the driver helps). I have observed this on two different x86_64 boxes (HPC 6325, Asus L5D), but it is not readily reproducible. Anyway I've got a dmesg output from a failing case which is attached. Actually, the problem is ohci_hcd doesn't seem to recognize devices plugged into the USB ports. For example, if I unplug and replug a mouse (that worked before unplugging), it doesn't work any more. I have to reload ohci_hcd to make it work again. This is 100% reproducible and occurs on the two boxes above. I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Greetings, Rafael -- You never change things by fighting the existing reality. R. Buckminster Fuller - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Monday 18 September 2006 08:27, Rafael J. Wysocki wrote: On Saturday, 16 September 2006 10:13, Rafael J. Wysocki wrote: On Saturday, 16 September 2006 00:13, Rafael J. Wysocki wrote: It looks like the ohci_hcd driver sometimes has problems with the initialization (eg. USB mouse doesn't work after a fresh boot and reloading of the driver helps). I have observed this on two different x86_64 boxes (HPC 6325, Asus L5D), but it is not readily reproducible. Anyway I've got a dmesg output from a failing case which is attached. Actually, the problem is ohci_hcd doesn't seem to recognize devices plugged into the USB ports. For example, if I unplug and replug a mouse (that worked before unplugging), it doesn't work any more. I have to reload ohci_hcd to make it work again. This is 100% reproducible and occurs on the two boxes above. I can confirm this behaviour. I've also seen that sometimes my USB keyboard/mouse doesn't work after booting up. Reloading the module solves the problem. This is on an amd64 box, ABIT kn9-sli, nForce 550. This is with 2.6.17.13. I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Will this work against 2.6.17.13 vanilla? Thanks, Jan -- QOTD: If I could walk that way, I wouldn't need the cologne, now would I? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Monday, 18 September 2006 08:50, Jan De Luyck wrote: On Monday 18 September 2006 08:27, Rafael J. Wysocki wrote: On Saturday, 16 September 2006 10:13, Rafael J. Wysocki wrote: On Saturday, 16 September 2006 00:13, Rafael J. Wysocki wrote: It looks like the ohci_hcd driver sometimes has problems with the initialization (eg. USB mouse doesn't work after a fresh boot and reloading of the driver helps). I have observed this on two different x86_64 boxes (HPC 6325, Asus L5D), but it is not readily reproducible. Anyway I've got a dmesg output from a failing case which is attached. Actually, the problem is ohci_hcd doesn't seem to recognize devices plugged into the USB ports. For example, if I unplug and replug a mouse (that worked before unplugging), it doesn't work any more. I have to reload ohci_hcd to make it work again. This is 100% reproducible and occurs on the two boxes above. I can confirm this behaviour. I've also seen that sometimes my USB keyboard/mouse doesn't work after booting up. Reloading the module solves the problem. This is on an amd64 box, ABIT kn9-sli, nForce 550. This is with 2.6.17.13. I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Will this work against 2.6.17.13 vanilla? No, this patch is not present in vanilla. Rafael -- You never change things by fighting the existing reality. R. Buckminster Fuller - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Mon, 18 Sep 2006, Rafael J. Wysocki wrote: Actually, the problem is ohci_hcd doesn't seem to recognize devices plugged into the USB ports. For example, if I unplug and replug a mouse (that worked before unplugging), it doesn't work any more. I have to reload ohci_hcd to make it work again. This is 100% reproducible and occurs on the two boxes above. I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Tell me, what happens if you leave that patch installed, and you use the patch I sent last week (the one that removes a chunk of code from ohci-hub.c), and you also set CONFIG_USB_SUSPEND? I think the real underlying problem here is that David's implementation of root-hub suspend in ohci-hcd is incompatible with the overall scheme I've been working on. In the end I'll probably have to rewrite the ohci-hcd code. Alan Stern - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Monday, 18 September 2006 17:07, Alan Stern wrote: On Mon, 18 Sep 2006, Rafael J. Wysocki wrote: Actually, the problem is ohci_hcd doesn't seem to recognize devices plugged into the USB ports. For example, if I unplug and replug a mouse (that worked before unplugging), it doesn't work any more. I have to reload ohci_hcd to make it work again. This is 100% reproducible and occurs on the two boxes above. I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Tell me, what happens if you leave that patch installed, and you use the patch I sent last week (the one that removes a chunk of code from ohci-hub.c), and you also set CONFIG_USB_SUSPEND? The problem continues to happen. Moreover, if I revert the above patch and apply the patch removing code from ohci-hub.c, the problem reappears. I think the real underlying problem here is that David's implementation of root-hub suspend in ohci-hcd is incompatible with the overall scheme I've been working on. In the end I'll probably have to rewrite the ohci-hcd code. Well, at this point I can only help you by testing some code. ;-) Seriously, if you have any new patches to test, please let me know. Greetings, Rafael -- You never change things by fighting the existing reality. R. Buckminster Fuller - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] 2.6.18-rc6-mm2 (-mm1): ohci_hcd does not recognize new devices
On Mon, 18 Sep 2006, Rafael J. Wysocki wrote: I have carried out a binary search and found that the problem is caused by gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch Tell me, what happens if you leave that patch installed, and you use the patch I sent last week (the one that removes a chunk of code from ohci-hub.c), and you also set CONFIG_USB_SUSPEND? The problem continues to happen. Moreover, if I revert the above patch and apply the patch removing code from ohci-hub.c, the problem reappears. Very strange. I think the real underlying problem here is that David's implementation of root-hub suspend in ohci-hcd is incompatible with the overall scheme I've been working on. In the end I'll probably have to rewrite the ohci-hcd code. Well, at this point I can only help you by testing some code. ;-) Seriously, if you have any new patches to test, please let me know. I definitely will. However they won't be ready for a few days... Alan Stern - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel