On Tue, 9 Dec 2003, David Brownell wrote:

> Various folk have reported similar problems on system shutdown
> before, and the simple fix has been not to clean up so aggressively.
> 
> What puzzled me was that a normal "rmmod" wouldn't give the
> same symptoms -- but the same codepaths could oops in certain
> system shutdown scenarios.

In an earlier message I wrote that the HC driver couldn't unload so long
as the device usbfs was using held a reference to its bus.  I just did
some checking, and guess what: It can!

I looked at both the UHCI and OHCI drivers.  In their module_exit routines
they call pci_unregister_driver().  Without knowing how the PCI subsystem
works, I would assume this behaves like any other "deregister" routine in
the driver model and returns without waiting for any reference count to go
to 0 -- that's what release callbacks are for.

However, the module_exit routines _don't_ wait for the release callbacks.  
They just go right on ahead and exit.  Result: when the reference count 
eventually does go to 0 (when usbfs drops its last reference), the 
hcd_free routine is no longer present and you get an oops.

The proper fix would be to have each HC driver keep track of how many 
instances are allocated.  The module_exit routine must wait for that 
number to drop to 0 before returning.

Alan Stern



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to