Re: [Patch -mm 0/3] RFC: module unloading vs. release function

From: Alan Stern
Date: Mon Apr 16 2007 - 17:03:12 EST


On Mon, 16 Apr 2007, Dmitry Torokhov wrote:

> > > What about 4:
> > >
> > > When registering an [k]object increment refcount of module that
> > > provides ->release() function.
> > >
> > > That would normally require ->release function to be placed on
> > > subsystem level to allow unloading individual devices.

That's what Cornelia is trying to do. For all release methods, not just
those on the subsystem level (although that is where most of them sit).

> > But that would also mean that a lot of modules that want to be able to
> > be released whenever they want to today, not be allowed to (network
> > drivers, etc.)
> >
>
> No, only the core module has to stay. For example, every time you
> register an input device you pin input.ko as it is the module that
> provides ->release() method for input devices. You can freely unload
> psmouse, or hid or your favorite joystick but input has to stay until
> last reference to the input device is dropped. serio and gameport work
> the same way.
>
> I think the requirement that one is not able to unload a core
> subsystem module untill all users are dropped off is ok - you can't
> unload it anyway until you unload all drivers that reference its
> exported functions and once you unload all the drivers data objects
> will drop off pretty quickly.

The problem is that sometimes devices are owned by modules that aren't
core subsystem modules. Or the code using a device doesn't depend on the
device's owner module and therefore doesn't pin it.

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/