On Wed, 2005-01-26 at 08:32 -0500, Dmitry Torokhov wrote: > On Wed, 26 Jan 2005 11:31:07 +0300, Evgeniy Polyakov > <[EMAIL PROTECTED]> wrote: > > On Tue, 2005-01-25 at 22:42 +0000, Christoph Hellwig wrote: > > > > Yes, and it is better than removing module whose structures are in use. > > > > SuperIO core is asynchronous in it's nature, one can use logical device > > > > through superio core and remove it's module on other CPU, above loop > > > > will > > > > wait untill all reference counters are dropped. > > > > > > General rule is: increment module reference count while the hardware > > > is actually in use, and let device structures be allocated by the > > > bus core so drivers can be freed with them still allocated. That's > > > how the driver model and thus about every other subsystem works. > > > > It is not general rule - network stack does not have such mechanism, > > which is > > very good, I doubt each block device module increment it's module > > reference > > when it catch a request... > > It is internal structure that has reference counter, not module itself, > > and this > > structure may be in use, when module is unloaded, thus unloading must > > wait, > > untill all it's structures are freed. > > > > No, it does not necessarily has to wait. You can unload driver at any > time if you care to mark all its devices as "dead" and you have > generic release function in a separate module that does not get > unloaded until last registered device has been destroyed. Look for > example at serio code. I think USB is about the same. >
It is only because those structures can live outside the driver. Like skb can live without even any network driver loaded. Above case is similar, but structure is binded to the module, and can be requested outside the world. Consider as example network stack: netdev_wait_allrefs() waits until all references are gone, it is called when device has NETREG_UNREGISTERING state. Very clean example is virtual devices here(tunnels, vlan) - it is exactly the same as logical/superio devices in superio core. -- Evgeniy Polyakov Crash is better than data corruption -- Arthur Grabowski
signature.asc
Description: This is a digitally signed message part