* Re: unloading drivers and usage counters
2001-01-21 21:12 unloading drivers and usage counters Oliver Neukum
@ 2001-01-22 5:28 ` David Brownell
2001-01-22 6:04 ` David Hinds
2001-01-22 16:26 ` David Brownell
2 siblings, 0 replies; 4+ messages in thread
From: David Brownell @ 2001-01-22 5:28 UTC (permalink / raw)
To: linux-hotplug
> From: Oliver Neukum <Oliver.Neukum@lrz.uni-muenchen.de>
> Sent: Sunday, January 21, 2001 1:12 PM
>
> going through the hotplugging scripts I noticed that there's no good way to
> unload modules. A time based approach cannot be used due to race conditions.
No good way now, true; I'm not sure I'd call the reasons "races" though.
More like different models for why "kernel modules" get used.
> Unloading on device removal requires keeping a usage counter in user space.
> This seems to be a brittle approach.
I can imagine implementing a workable solution in userspace,
which may be the best that the 2.4 kernels can handle. Yep,
brittle is a good word for that!
> Not increasing the module usage counters on connect seems to be the wrong
> strategy. The desire to keep the modules unloadable has come back to bite us
> into our behind.
> If the usage counters were increased for each connected device unloading would
> come natural.
Sounds like a substantial change in the model for what module use
counts should be. Maybe the pcmcia_cs tools have a better model?
- Dave
> A patch to disconnect drivers by an ioctl has been posted. It
> would allow forced unload.
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: unloading drivers and usage counters
2001-01-21 21:12 unloading drivers and usage counters Oliver Neukum
2001-01-22 5:28 ` David Brownell
@ 2001-01-22 6:04 ` David Hinds
2001-01-22 16:26 ` David Brownell
2 siblings, 0 replies; 4+ messages in thread
From: David Hinds @ 2001-01-22 6:04 UTC (permalink / raw)
To: linux-hotplug
On Sun, Jan 21, 2001 at 09:28:41PM -0800, David Brownell wrote:
> Sounds like a substantial change in the model for what module use
> counts should be. Maybe the pcmcia_cs tools have a better model?
For PCMCIA, module use counts are incremented when a device is opened,
and decremented when closed, just like most non-hot-plug modules.
Attaching a driver to a newly hot plugged device does not increment
its use count.
To decide when to unload a module, the cardmgr daemon keeps track of
the number of times a module has been requested in response to new
device insertions; this count can indeed get messed up if people
manually unload modules, or if cardmgr is killed and restarted. I am
not bothered much by this, because the consequences are mostly
harmless and the user has to go out of their way to mess up the
automatic usage counting. In practice, no one has ever complained to
me about it.
The PCMCIA subsystem does provide /proc/bus/pccard/drivers, which
lists what drivers are present, which are modules vs. which are static
linked, and the actual number of present devices that are associated
with each driver. Cardmgr currently only uses the module/static flag
from this file, so that it won't bother trying to remove a static
driver; it would not be much work to also use the usage information
for precise decisions about when to unload modules.
-- Dave
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: unloading drivers and usage counters
2001-01-21 21:12 unloading drivers and usage counters Oliver Neukum
2001-01-22 5:28 ` David Brownell
2001-01-22 6:04 ` David Hinds
@ 2001-01-22 16:26 ` David Brownell
2 siblings, 0 replies; 4+ messages in thread
From: David Brownell @ 2001-01-22 16:26 UTC (permalink / raw)
To: linux-hotplug
> From: David Hinds <dhinds@sonic.net>
> Sent: Sunday, January 21, 2001 10:04 PM
>
> To decide when to unload a module, the cardmgr daemon keeps track of
> the number of times a module has been requested in response to new
> device insertions; this count can indeed get messed up if people
> manually unload modules, or if cardmgr is killed and restarted. I am
> not bothered much by this, because the consequences are mostly
> harmless and the user has to go out of their way to mess up the
> automatic usage counting. In practice, no one has ever complained to
> me about it.
Hmm, so maybe a pure user-mode solution isn't so brittle as that.
That's been in use how many years now? :-)
This is stuff that could clearly be handled in some /sbin/hotplug
policy code, saving state in some file.
> The PCMCIA subsystem does provide /proc/bus/pccard/drivers, which
> lists what drivers are present, which are modules vs. which are static
> linked, and the actual number of present devices that are associated
> with each driver. Cardmgr currently only uses the module/static flag
> from this file, so that it won't bother trying to remove a static
> driver; it would not be much work to also use the usage information
> for precise decisions about when to unload modules.
Sounds like this is something that the "linux hotplug" system should
perhaps consider providing in a more general way, for all levels of
the driver stacks.
- Dave
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread