Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Aug 2013 21:51:22 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        freebsd-dtrace@FreeBSD.org
Subject:   Re: [RFC] reworking FreeBSD's SDT implementation
Message-ID:  <20130804015122.GA3259@raichu>
In-Reply-To: <51F372C8.1000107@FreeBSD.org>
References:  <20130703041023.GA82673@raichu> <20130711024500.GA67976@raichu> <20130711210215.GB7506@gmail.com> <20130713234200.GA40803@raichu> <20130714075634.GC2832@gmail.com> <20130722022811.GA14288@raichu> <51F14150.7000509@FreeBSD.org> <20130727022656.GB67227@raichu> <51F372C8.1000107@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sat, Jul 27, 2013 at 10:12:08AM +0300, Andriy Gapon wrote:
> on 27/07/2013 05:26 Mark Johnston said the following:
> > On Thu, Jul 25, 2013 at 06:16:32PM +0300, Andriy Gapon wrote:
> >> on 22/07/2013 05:28 markj@freebsd.org said the following:
> >>> http://people.freebsd.org/~markj/patches/sdt-module-info/20130721-sdt-module-info.diff
> >>
> >> Mark,
> >>
> >> this is a minor suggestion only partially related to your patch.
> >> I think that it would be nice if module loading and unloading events were posted
> >> via EVENTHANDLER(9) mechanism.  Then instead of introducing yet more DTrace
> >> related hooks in the kernel code, DTrace modules could just subscribe to those
> >> events.  Also, those events could be potentially useful to other consumers
> >> beyond DTrace.
> >> What do you think?
> > 
> > Hm, now that I look at this, I'm not sure if it can work. The unload
> > hooks need to be able to veto a module unload in the case that one of
> > its probes is enabled. This is done by checking whether lf->nenabled > 0,
> > and it needs to be done with the dtrace lock held to prevent races.
> > 
> > I've done this by having the unload hooks return a non-zero value if
> > there are probes enabled, but EVENTHANDLER(9) doesn't give me a way to
> > look at a handler's return value. Do you see a way to get around this?
> 
> Hmm, I didn't think about this problem in advance...
> Having looked around I think that it should be possible to handle this situation
> in a way similar to watchdog_list.  watchdog(9) documents how that works.  Of
> course, all handlers will have to be careful to not override error if it's
> already set.

I implemented the module load/unload events a couple of days ago using
EVENTHANDLER(9), and it looks like everything works properly. I copied
the trick used for watchdog_list and just added an error pointer
argument to the unload handlers. The revised patch is here:

http://people.freebsd.org/~markj/patches/sdt-module-info/20130803-sdt-module-info.diff

Thanks!
-Mark



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130804015122.GA3259>