Page MenuHomeFreeBSD

sdt: Support fetching the probe sixth argument with MI machinery
ClosedPublic

Authored by markj on Jun 19 2024, 8:09 PM.
Tags
None
Referenced Files
F102826825: D45648.id140041.diff
Sun, Nov 17, 5:03 PM
Unknown Object (File)
Sun, Nov 10, 11:10 PM
Unknown Object (File)
Oct 11 2024, 8:31 AM
Unknown Object (File)
Sep 28 2024, 5:39 PM
Unknown Object (File)
Sep 24 2024, 10:13 AM
Unknown Object (File)
Sep 21 2024, 4:20 AM
Unknown Object (File)
Sep 20 2024, 4:26 AM
Unknown Object (File)
Sep 18 2024, 7:34 PM

Details

Summary

SDT calls dtrace_probe() directly, and this can be used to pass up to
five probe arguments directly. To pass the sixth argument (SDT
currently doesn't support more than this), we use a hack: just add
additional parameters to the call and cast dtrace_probe accordingly.
This happens to work on amd64, but doesn't work in general.

Modify SDT to call dtrace_probe() after storing arguments beyond the
first five in thread-local storage. Implement sdt_getargval() to fetch
extra argument values this way. An alternative would be to use invop
handlers instead and make sdt_probe_func point to a breakpoint
instruction, so that one can extract arguments using the breakpoint
exception trapframe, but this makes the providers more expensive when
enabled and doesn't seem justified. This approach works well unless we
want to add more than one or two more parameters to SDT probes, which
seems unlikely at present.

In particular, this fixes fetching the last argument of most ip and tcp
probes on arm64.

Reported by: rwatson

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58250
Build 55138: arc lint + arc unit

Event Timeline

markj requested review of this revision.Jun 19 2024, 8:09 PM

I ran this on an M3, seems to work fine. I was debating if it would make sense to define a macro specifying how many arguments there are, but it seems fairly unlikely that we'll need that anywhere else, so this looks good to me.

This revision is now accepted and ready to land.Jun 20 2024, 3:15 PM

I ran this on an M3, seems to work fine. I was debating if it would make sense to define a macro specifying how many arguments there are, but it seems fairly unlikely that we'll need that anywhere else, so this looks good to me.

Thank you for testing.

I thought about having a named constant as well, but didn't think it would really help make anything clearer.