[DTrace-devel] [RFC PATCH 0/2] DTrace TCP provider

Alan Maguire alan.maguire at oracle.com
Thu Jun 5 21:33:39 UTC 2025


This series is a first draft of TCP provider support, where the
probes are implemented via underlying fbt and sdt probes.

Due to the use of the sock/inet_sock_set_state tracepoint, intended
for ~5.15 kernels and later.  Tried replacing this with

fbt::tcp_set_state:entry

but this misses a few state transitions.

A few things that need tidying up; haul get_member() functionality
duplicated in dt_prov_tcp.c from dt_prov_ip.c into a common
function (in dt_cg.c maybe?).  Note that we needed to bump the
DT_STRING_SLOTS to 8 to prevent assert failures; likely a
result of the complex translator dances with inet_ntoa*()s etc.

All tests under test/unitest/tcp pass unmodified on an upstream
(6.15) kernel.  For 5.15, we see missing state-change to
SYN_RECV; on further inspection it appears that while the probe
fires, we do not get accurate IP address info in args[2].
This works on upstream, so it may be that something changed
in clone socket logic as we call the probe with the newsk.

Goes without saying needs more testing and cleanups, but does
implement all TCP provider probes:

accept-established, accept-refused, connnect-request,
connect-established, connect-refused, receive, send,
state-change

so it's a start at least.

Alan Maguire (2):
  dtrace: add tcp provider
  dtrace: sync dlibs with tcp.d, ip.d and net.d changes

 dlibs/aarch64/5.14/ip.d  |   1 -
 dlibs/aarch64/5.14/net.d |   6 +-
 dlibs/aarch64/5.14/tcp.d |  43 +++--
 dlibs/aarch64/5.16/ip.d  |   1 -
 dlibs/aarch64/5.16/net.d |   6 +-
 dlibs/aarch64/5.16/tcp.d |  43 +++--
 dlibs/aarch64/6.1/ip.d   |   1 -
 dlibs/aarch64/6.1/net.d  |   6 +-
 dlibs/aarch64/6.1/tcp.d  |  43 +++--
 dlibs/aarch64/6.10/ip.d  |   1 -
 dlibs/aarch64/6.10/net.d |   6 +-
 dlibs/aarch64/6.10/tcp.d |  43 +++--
 dlibs/x86_64/5.14/ip.d   |   1 -
 dlibs/x86_64/5.14/net.d  |   6 +-
 dlibs/x86_64/5.14/tcp.d  |  43 +++--
 dlibs/x86_64/5.16/ip.d   |   1 -
 dlibs/x86_64/5.16/net.d  |   6 +-
 dlibs/x86_64/5.16/tcp.d  |  43 +++--
 dlibs/x86_64/6.1/ip.d    |   1 -
 dlibs/x86_64/6.1/net.d   |   6 +-
 dlibs/x86_64/6.1/tcp.d   |  43 +++--
 dlibs/x86_64/6.10/ip.d   |   1 -
 dlibs/x86_64/6.10/net.d  |   6 +-
 dlibs/x86_64/6.10/tcp.d  |  43 +++--
 libdtrace/Build          |   2 +
 libdtrace/dt_impl.h      |   2 +-
 libdtrace/dt_prov_tcp.c  | 397 +++++++++++++++++++++++++++++++++++++++
 libdtrace/dt_provider.c  |   1 +
 libdtrace/dt_provider.h  |   1 +
 libdtrace/ip.d           |   1 -
 libdtrace/net.d          |   6 +-
 libdtrace/tcp.d          |  43 +++--
 32 files changed, 654 insertions(+), 199 deletions(-)
 create mode 100644 libdtrace/dt_prov_tcp.c

-- 
2.43.5




More information about the DTrace-devel mailing list