[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb-devel
Subject:    Re: [linux-usb-devel] Module load/unload races and USB
From:       "Gregory P. Smith" <greg () electricrain ! com>
Date:       2000-06-28 17:57:20
[Download RAW message or body]

(paraphrased re: calling mod_inc_use_count and dec_use_count surrounding
all usbcore calls for a given usb driver module)

> On Mon, Jun 26, 2000 at 01:04:05PM +0200, Vojtech Pavlik wrote:
> > Doing it only for _probe() and _disconnect() would be OK, doing it for
> > every call (even URB callbacks) would be too much.
> 
> Right... I forgot about the URB callbacks.
> 
> Shouldn't a module consider itself "in use" if it has an URB pending?  Or
> at least make sure it cancels all URBs in it's removal function?  If you
> make sure to cancel all you URBs in your removal function, then this proble
> goes away.
> 
> I think part of the problem I'm having in characterizing this is that I'm
> having trouble coming up with a list of all the entrypoints that usbcore
> uses.  There are the probe/disconnect functions, and the URB callbacks, and
> what else?

One approach for module unloading without having to physically remove
the device is to provide a special ioctl or /proc/usb api to allow
usb devices to be 'virtually removed' before module removal is
attempted.  (yes, this means a regular rmmod wouldn't work)

removing usb device modules then would intail:
  loop while the module is using devices:
    finding out which devices the module in question is using
    virtually remove those devices
  end loop
  attempt to remove the module
  (module removal will succeed if all devices were virtually removed
  so the driver lowered its mod_use_count to zero)

virtually removing a device probably involves:
 * making the appropriate calls to simulate a hard disconnect of the
   device.  [should it include powering down that device's hub port?]
 * cancelling all pending urbs for the device
 * if the hub port was powered down, re-enable its power after
   unregistering/removing the driver.

anyways, just a thought.
greg

-- 
Gregory P. Smith   gnupg/pgp: http://suitenine.com/greg/keys/
                   C379 1F92 3703 52C9 87C4  BE58 6CDA DB87 105D 9163

_______________________________________________
linux-usb-devel mailing list
linux-usb-devel@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/linux-usb-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic