Re: [PROPOSED PATCH] ATM refcount + firestream

From: Philipp Rumpf (prumpf@parcelfarce.linux.theplanet.co.uk)
Date: Mon Oct 30 2000 - 10:18:14 EST


On Sat, Oct 28, 2000 at 11:50:22AM -0400, Brian Gerst wrote:
> Philipp Rumpf wrote:
> >
> > On Sat, Oct 28, 2000 at 09:55:21AM -0400, Brian Gerst wrote:
> > > Yes, but they can be called (and sleep) with module refcount == 0. This
> > > is because the file descripter used to perform the ioctl isn't directly
> > > associated with the network device, thereby not incrementing the
> > > refcount on open.
> >
> > According to my proposal, it is perfectly safe to call a function in a module
> > while the module's use count is 0. This function would typically look like this:
> >
> > foo()
> > {
> > MOD_INC_USE_COUNT;
> >
> > copy_*_user() (or anything else that sleeps);
> >
> > MOD_DEC_USE_COUNT;
> >
> > return bar;
> > }
> >
> > The only difference to the "old" module scheme is that the above currently isn't
> > safe on SMP systems.
>
> This will only work while the kernel is not preemptable. Once the
> kernel thread can be rescheduled, all bets are off.

The implementation will need adjusting for preemptable kernel threads. The
concept still works fine.

> With or without your patch, the network ioctls are unsafe, since they
> don't currently do refcounting at all.

I was under the impression most network ioctls didn't sleep.

> Adding it in the layer above thTe
> driver is the easier and cleaner solution.

I disagree. I dislike special-casing inter-module calls (and that's not even
taking into account that the current implementation of an inter-module call is
quite ugly).
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 31 2000 - 21:00:26 EST