[RFC] reworking FreeBSD's SDT implementation

Mark Johnston markj at freebsd.org
Sat Jul 27 02:27:00 UTC 2013


On Thu, Jul 25, 2013 at 06:16:32PM +0300, Andriy Gapon wrote:
> on 22/07/2013 05:28 markj at 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?

Thanks,
-Mark


More information about the freebsd-dtrace mailing list