Ohci-hcd: fix endless loop
Subsystems (2)
PATCH 1/1 Ohci-hcd: fix endless loop
Hi,
Following patch fixes an endless loop that happens after having slept and resumed my iBook with a linux-wlan-ng controller plugged in, removed the stick and plugged it back (getting "IRQ lossage" message).
drivers/usb/host/ohci-hcd.c +6 -0
@@ -375,6 +375,11 @@spin_unlock_irqrestore (&ohci->lock, flags);set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (1 ); +if (limit-- <-1000 ) { +ohci_warn (ohci,"Couldn't recover\n" ); +ohci_restart (ohci); + goto bail; + } goto rescan;case ED_IDLE :/* fully unlinked */ if (list_empty (&ed->td_list)) {
@@ -396,6 +401,7 @@ dev->ep [epnum] =NULL ; done:spin_unlock_irqrestore (&ohci->lock, flags); +bail:return ; }
Quoted 5 lines · Colin Leroy
Hi,
Following patch fixes an endless loop that happens after having slept and resumed my iBook with a linux-wlan-ng controller plugged in, removed the stick and plugged it back (getting "IRQ lossage" message).
The infinite loop means that something trashed the stack, yes?
The "limit-- < -1000" test below should never be able to succeed unless the previous "limit-- == 0" test got trashed by having something obliterate the stack. Possibly the driver for that WLAN adapter. Once that happens, all kinds of things will misbehave...
If you got the "IRQ INTR_SF lossage" diagnostic, there's clearly some problem with IRQ handling after the resume ... is the iBook firmware (or hardware) doing wierd stuff so that the normal PCI IRQ calls stopped working?
And for that matter, "limit" is unsigned, so you must be getting (and ignoring) some compiler warnings too.
This is not a good patch; not accepted.
- Dave
Quoted 35 lines
Signed-off-by Colin Leroy <[email protected]>drivers/usb/host/ohci-hcd.c +6
-1@@ -375,6 +375,11 @@spin_unlock_irqrestore (&ohci->lock, flags);set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (1 ); +if (limit-- <-1000 ) { +ohci_warn (ohci,"Couldn't recover\n" ); +ohci_restart (ohci); + goto bail; + } goto rescan;case ED_IDLE :/* fully unlinked */ if (list_empty (&ed->td_list)) {@@ -396,6 +401,7 @@ dev->ep [epnum] =NULL ; done:spin_unlock_irqrestore (&ohci->lock, flags); +bail:return ; } -------------------------------------------------------SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Quoted 5 lines
If you got the "IRQ
INTR_SFlossage" diagnostic, there's clearly some problem with IRQ handling after the resume ... is the iBook firmware (or hardware) doing wierd stuff so that the normal PCI IRQ calls stopped working?
The iBook hardware isn't doing anything special, the controller is just coming back out of the blue. If it's the NEC one, it's just a normal NEC EHCI+OHCI coming out of D3cold, if it's the KeyLargo Apple one, it comes from some special state which is similar to D2.
Ben.
On 26 Nov 2004 at 08h11, David Brownell wrote:
Hi,
Quoted 5 lines
The infinite loop means that something trashed the stack, yes?
The "limit-- < -1000" test below should never be able to succeed unless the previous "limit-- == 0" test got trashed by having something obliterate the stack.
Sure? the (limit -- == 0) gotoes higher to test again.
from what I understand the loop goes back to rescan 1000 times, then once to sanitize, then to back to rescan again infinetely...
I may be wrong but I don't think there's a stack corruption there.
Quoted 4 lines
If you got the "IRQ
INTR_SFlossage" diagnostic, there's clearly some problem with IRQ handling after the resume ... is the iBook firmware (or hardware) doing wierd stuff so that the normal PCI IRQ calls stopped working?
No, the rest of the computer worked fine.
Quoted 2 lines
And for that matter, "limit" is unsigned, so you must be getting (and ignoring) some compiler warnings too.
Yes, noticed and sent a second patch.
Signature · 1 line
Colin
Quoted 6 lines · Colin Leroy
On 26 Nov 2004 at 08h11, David Brownell wrote:
Hi,
Quoted 2 lines
The infinite loop means that something trashed the stack, yes?
Quoted 8 lines
Quoted 3 lines
The "limit-- < -1000" test below should never be able to succeed unless the previous "limit-- == 0" test got trashed by having something obliterate the stack.
Sure? the (limit -- == 0) gotoes higher to test again.
from what I understand the loop goes back to rescan 1000 times, then once to sanitize, then to back to rescan again infinetely...
I may be wrong but I don't think there's a stack corruption there.
The "limit" isn't tested a 1001st time, since the ED state changed.
For that matter, any time that the IRQ lossage appears, there's always been something that damaged the IRQ setup.
- Dave