Bug 220965 - Some dtrace_io probes lack struct bio reference
Summary: Some dtrace_io probes lack struct bio reference
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2017-07-24 11:48 UTC by Fabian Keil
Modified: 2017-12-28 18:25 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Keil 2017-07-24 11:48:17 UTC
According to dtrace_io(4) and "dtrace -lvn io:::", the dtrace_io probes use
a struct bio * as arg[0] to represent the I/O request, however that is only
true for the probes declared with a define with _BIO_ in its name.

Quoting sys/kern/subr_devstat.c:
    57	#define	DTRACE_DEVSTAT_START()		SDT_PROBE2(io, , , start, NULL, ds)
    58	#define	DTRACE_DEVSTAT_BIO_START()	SDT_PROBE2(io, , , start, bp, ds)
    59	#define	DTRACE_DEVSTAT_DONE()		SDT_PROBE2(io, , , done, NULL, ds)
    60	#define	DTRACE_DEVSTAT_BIO_DONE()	SDT_PROBE2(io, , , done, bp, ds)

As a result, even simple scripts like the example in dtrace_io(4) result in errors like:
dtrace: error on enabled probe ID 1 (ID 41752: io:kernel:none:start): invalid address (0x20) in action #6 at DIF offset 16

One can workaround this by skipping probes without bio reference by adding:
/args[0] != NULL/
but it would be more convenient if probes with bio reference had a different name than
those that don't.