discussed in this RFD
There should be a space after the first "void".
This will break if fbt::m_length:entry is enabled. I think you also need to have NOFAULT set when walking the mbuf chain.
"offset" is unsigned.
dest == mstate->dtms_scratch_ptr here. Ditto below, so I'm confused by the subtraction here.
Why do the OS-specific subr indices need to be non-overlapping? Seems like every OS could just start at 100 or so for their own subroutines. And then we can use the same definition of VALID_SUBR() on every OS.
Maybe prefix this with "DIF_" too to make its purpose easier to guess?
It's probably not a good idea for this to be DTrace version 1.0.0. Perhaps 1.13.0 would make sense -- or even a bump to 1.13.1?
Unless anything other than the dtrace_bcopy() in dtrace_mbuf_copydata() can fault, which I can't see, this is not necessary. The DTRACE_LOADFUNC macro already sets CPU_DTRACE_NOFAULT.
This could be circumvented by implementing this with a builtin DTrace-specific routine such as dtrace_m_length()...?
DIF_SUBR_OSDEP_MAX could be maintained as the last one added and the compiler could use that to verify it. However, to your point, if we want a portable codebase this would result in an ifdef forest that's a bit difficult to maintain.