Re: [linux-usb-devel] [PATCH] back out sysfs reference count change

From: Greg KH
Date: Thu Apr 01 2004 - 02:13:57 EST


On Thu, Apr 01, 2004 at 11:56:09AM +1000, Benjamin Herrenschmidt wrote:
>
> > But that is impossible as has already been pointed out by Alan Stern.
> > If a module creates a kobject, how can the module_exit() function ever
> > be called if that kobject incremented the module reference count?
>
> I just had a loooong discussion with Rusty on that subject, it's
> indeed a nasty one.

Ah, he sucks another person into the "module unload" discussion. My
sympathies :)

> The problem is that the real solution is to
> change the module unload semantics. Regardless of the count, module
> exit should be called, and the actual unload (and eventually calling
> an additional module "release" function) then should only happen
> once the count is down to 0. That means that rmmod would block forever
> if the driver is opened, but that is just something that needs to be
> known.
>
> But that's not something we'll do for 2.6. For that to work, it also
> need various subsystem unregister_* (netdev etc...) functions to not
> error when the device is opened, just prevent new opens, and operate
> asynchronously (freeing data structures on kobject release) etc...

I agree, it's a difficult problem to solve, and something we aren't
going to do for 2.6. That's one reason why module unload is its own
config option :)

Anyway, Rusty's proposal of "never unload, just mark not used" and then
load a new copy into memory that he did during the OLS timeframe last
year sounds like the only sane way to get this completely correct, with
the trade off of never releasing memory.

thanks,

greg k-h
-
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/