Re: [lkcd-devel] Re: [PATCH] Notifier for significant events on

Stephen Hemminger (shemminger@osdl.org)
11 Dec 2002 08:56:04 -0800


On Wed, 2002-12-11 at 03:43, Vamsi Krishna S . wrote:
> On Wed, Dec 11, 2002 at 03:16:39AM -0800, William Lee Irwin III wrote:
> > On Wed, Dec 11, 2002 at 04:51:53PM +0530, Vamsi Krishna S . wrote:
> > > <snip>
> > >
> > > I am considering using a RCU-based list for notifier chains.
> > > Corey has done some work on these lines to add NMI notifier
> > > chain, I think it should be generalised on for all notifiers.
> >
> > A coherent explanation of how notifier locking is supposed to work
> > would be wonderful to have. I'd like to register notifiers but am
> > pig ignorant of how to lock my structures down to work with it.
> >
> Unless I am missing something, notifiers have always been racy.
> No amount of locking you do in individual modules to prevent
> races will help as the notifier chain is walked inside
> notifier_call_chain() in kernel/sys.c. One would need to
> add some form of locking there (*) so that users of notifier
> chains need not worry about races/locking at all.
>
> (*) converting the notifier chain to an RCU-based list guarentees
> to modules using the notifier chains that their handlers will
> not be called once the handler is unregistered.
>
> > Bill
> Vamsi.

There should be a register/unregister interface that uses RCU. That
makes sense. This assumes that this is an uncommon thing that happens
at init/load and unload. The notifier callback's better not change
themselves! Especially, since they get called when the system may be in
a unstable state like in a panic or other error handling.

-- 
Stephen Hemminger <shemminger@osdl.org>
Open Source Devlopment Lab

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