[RFC] reworking FreeBSD's SDT implementation

markj at freebsd.org markj at freebsd.org
Thu Jul 25 23:40:10 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?

I think that's nicer than what I did - I was mostly just following what
illumos does. I did consider having some general mechanism for posting
module load/unload events, but it's not clear that the hwpmc hooks could
use it. The DTrace handlers need to be called with the linker lock
exclusively held, and the unload handler needs to be called before
linker_file_unload(), so this is at odds with the locations of the hwpmc
hooks, and I decided not to bother with it.

That said, I think it would be good to use EVENTHANDLER() even if hwpmc
can't use it. Calling two DTrace hooks is ugly - originally I just had
one, so it wasn't as bad. I'll post an updated patch soon.

Thanks!
-Mark


More information about the freebsd-dtrace mailing list