On Wed, 10 Apr 2024 11:41:18 -0400 Chuck Lever <chuck.lever@xxxxxxxxxx> wrote: > > If anything, it needs to be: > > > > __string_len(acceptor, data, len) > > > > as the macro code has changed recently, and the current code will crash! > > A general question: > > Is there a test suite we should run regularly to build some > confidence in the kernel's observability apparatus? We're building > a menagerie of tests around kdevops, and one area where we know > there is a testing gap is the tracepoints in NFSD and SunRPC. I try to add self tests within the macros. As __assign_str() is going to turn into just __assign_str(field) (instead of __assign_str(field, src)), I added a test to make sure what was passed to __string() is also what __assign_str() gets. But using strcpy() in place of __assign_str() really is doing something that one should not be doing. There's checks in the tracepoint code as well for things like referencing a pointer that was not saved in the event, and other things. But a generic test on a custom trace event, I don't really have. Note, you could enable CONFIG_TRACE_EVENT_INJECT where an "inject" file is created, and you can write into it: # cd /sys/kernel/tracing # echo 1 > events/rpcgss/rpcgss_context/enable # echo 'expiry=123456 now=222' > events/rpcgss/rpcgss_context/inject # cat trace bash-843 [001] ..... 720.083189: rpcgss_context: win_size=0 expiry=123456 now=222 timeout=0 acceptor= And you could use that for testing. -- Steve