On Thu, Apr 18, 2002, David Brownell <[EMAIL PROTECTED]> wrote: > > > It "should" only shake out code that doesn't play by today's rules, > > > right? Or am I missing something? > > > > Yes. It shook out the fact that uhci.c wasn't updated to play by the new > > rules. > > No, a code inspection shook out the fact that it didn't even > play by the 2.4 rules, which require HCDs to clean up their > device state when bus->op->deallocate() is called.
That was never a rule for 2.4. Reference counting takes care of making sure things work correctly after deallocate(). > It's a > latent problem, not yet seen in the wild, masked by the same > loose coding in 2.4 that masks other driver cleanup bugs. > > Note that Andries' BUG() is (a) different from the one I noticed > uhci.c might trigger, and is even in a different source file; also > (b) followed several other USB problems, one of which is IMO > likely causing his BUG(). Huh? Care to explain? The BUG() Andries' posted about was the result of UHCI finishing up with a QH after usb_disconnect(). I specifically coded it to work that way and by design it works in 2.4 because the reference counting ensures it works fine. It doesn't work in 2.5 because the reference counting semantics have changed. However, I don't think the change is the right thing for 2.5. > > However, it can only be useful if code uses reference counting after > > uhci_disconnect is called, which is a perfectly legitimate use of > > reference counting in the kernel. That is what it is traditionally > > used for, so the memory doesn't disappear under us. > > But there _is_ no uhci_disconnect()!! Sorry, usb_disconnect(), typo on my part. > Do you mean uhci_free_dev()? The NOP? Remember that > method must be called when it can sleep, and the loose 2.4 > way of managing device refcounts couldn't guarantee that. > (Caused oopsing in the correct code, not the buggy code...) The reference counting only takes care of freeing memory, which can be called in any context. Looking now, I don't even see why bus->op->deallocate() is necessary. OHCI doesn't even appear to need it. > If you try to make refcounting be "poor man's kernel garbage > collection", you'll either need to provide another way to ensure > it's never called in_interrupt(), or else be making incompatible > changes to at least bus->op->deallocate(). > > I'm sure UHCI doesn't care whether its NOP can sleep or not, but > it'd seem wrong to change semantics of bus->op->deallocate() so > that (unlike other hotplug "device is gone" calls) it may not sleep. > And I'd rather not change the HCDs that rely on that, either. It's a bug to sleep in bus->op->deallocate() in 2.4. JE _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
