HomeFreeBSD

sdt: Support fetching the probe sixth argument with MI machinery

Description

sdt: Support fetching the probe sixth argument with MI machinery

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
Reviewed by: Domagoj Stolfa
MFC after: 1 month
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D45648

Details

Provenance
markjAuthored on Jun 20 2024, 4:40 PM
Differential Revision
D45648: sdt: Support fetching the probe sixth argument with MI machinery
Parents
rG0667538b888c: ee: fix wprintw usage (highlighted by ncurses 6.5)
Branches
Unknown
Tags
Unknown