"unstable" sdt probes
Robert Mustacchi
rm at joyent.com
Sat Oct 26 19:24:19 UTC 2013
On 10/26/13 14:06 , Mark Johnston wrote:
> On Fri, Oct 25, 2013 at 07:30:45PM +0300, Andriy Gapon wrote:
>> on 24/10/2013 19:16 Mark Johnston said the following:
>>> On Thu, Oct 24, 2013 at 01:20:17PM +0300, Andriy Gapon wrote:
>>>>
>>>> Can our SDT (for kernel) implementation support probes with unspecified types
>>>> for arguments?
>>>> I would like to get DTRACE_PROBE*() which can be found in the code with
>>>> OpenSolaris origins (e.g. ZFS) to work. With minimal efforts :-)
>>>
>>> Hm, it looks like illumos uses the first argument to DTRACE_PROBE* to
>>> specify both the provider name and probe name; if no provider name is
>>> given (based on a lookup in a table in sdt_subr.c), a default "sdt"
>>> provider is used. It looks like this is what's happening for the ZFS
>>> probes.
>>>
>>> I'd suggest something like the following:
>>> - to kern_sdt.c, add
>>>
>>> SDT_PROVIDER_DEFINE(sdt);
>>>
>>> - add DTRACE_PROBE* macros to sdt.h which invoke SDT_PROBE* with the sdt
>>> provider, i.e. something like
>>>
>>> #define DTRACE_PROBE1(name, type, arg) \
>>> SDT_PROBE1(sdt, , , name, arg)
>>>
>>> - add a FreeBSD-only zfs_dtrace.c which contains the SDT_PROBE_DEFINE*
>>> invocations for the ZFS probes. You can define the types there, or not
>>> (using an empty string or NULL should work, I'm not sure).
>>>
>>> This won't work for illumos code where the probes specify a provider,
>>> but I think that's ok. I can do the first two steps if you agree with
>>> this approach. I don't have any way to test the ZFS probes at the
>>> moment, but I guess I can provide a zfs_dtrace.c too if you (or anyone
>>> else) can test.
>>
>> Mark,
>>
>> thank you for the ideas! The approach sounds fine to me.
>> I plan to have some time to work on this next week.
>> I will definitely be able to test things and maybe even develop something.
>> So, thank you again.
>
> The patch here is what I had in mind:
> http://people.freebsd.org/~markj/patches/zfs_probes.diff
>
> I've only compile-tested it, but it should create illumos-compatible ZFS
> probes without changing any ZFS code, assuming I understand exactly how
> they're creating/naming probes. :)
Hi Mark,
Your reading of what's going on in sdt_subr.c is right. We're basically
just using a prefix on the SDT probe name to effectively namespace the
probe to a provider. And if it's currently an unknown provider then we
just end up putting it into the sdt module. All those zfs probes are
just in the SDT provider for now, we don't have a stable ZFS provider
yet. From my reading of what you've done it looks like you've created
compatibly named probes.
Robert
More information about the freebsd-dtrace
mailing list