freebsd-src/tools/cam
Warner Losh 92f251f36b cam: Dtrace scripts to help diagnose weird things
These are sample dtrace scripts that likely need to be modified for
whatever problem you are chasing. Unfortuneately, you have to read the
driver extensively to understand them or how to use them. But studying
the completion routine of mpr/mps will help understand many of the error
and recovery paths.

Sponsored by:		Netflix
2026-01-08 23:11:10 -07:00
..
cam_all_but_scsi.d
mpr.d
mps.d
README

This directory has snippets of what will eventually become camio. This program
can take an expression for the types of things to trace, and then custom write a
dtrace script to do that.

camio is a d-traced tcpdump-like program for examining CAM traffic (and
therefore I/O and other traffic to storage media) that written during covid, but
with fbp providers that recent clang optimizations make unuseable, hence the
shift to the cam provider, but retooling them and finishing the grammar will
take some time (but these scripts are useful today).

mpr.d and mps.d give insight into the completion path for the mpr and mps SIMs.
You really have to read through the driver to understand, but it's the central
point of the driver and most of the I/O already had the proper CAM status code,
but the reset does not. These scripts use the generic completion hook to show
the exceptional cases (many of which have printfs that can be enabled, but often
aren't). The completion hook should give one enough tools to puzzle out what's
going on for weird, but repeatable problems.