Re: [PATCH v10 07/11] tracing/probes: Add $args meta argument for all function args
flat view
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-05-15 12:00:40
Also in:
bpf, lkml
On Sun, 14 May 2023 23:12:11 +0900 "Masami Hiramatsu (Google)" [off-list ref] wrote:
From: Masami Hiramatsu (Google) <mhiramat@kernel.org> Add the '$args' meta fetch argument for function-entry probe events. This will be expanded to the all arguments of the function and the tracepoint using BTF function argument information. e.g. # echo 'p vfs_read $args' >> dynamic_events # echo 'f vfs_write $args' >> dynamic_events # echo 't sched_overutilized_tp $args' >> dynamic_events # cat dynamic_events p:kprobes/p_vfs_read_0 vfs_read file=file buf=buf count=count pos=pos f:fprobes/vfs_write__entry vfs_write file=file buf=buf count=count pos=pos t:tracepoints/sched_overutilized_tp sched_overutilized_tp rd=rd overutilized=overutilized NOTE: This is not like other $-vars, you can not use this $args as a part of fetch args, e.g. specifying name "foo=$args" and using it in dereferences "+0($args)" will lead a parse error. Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> --- Changes in v10: - Change $$args to $args so that user can use $$ for current task's pid.
I hate coming up with new apis, because you never know if what you pick is correct ;-) And then you are stuck with whatever you decided on. :-/ I know I suggested $args, but since it is special, should we call it "$arg*" ? That way it follows bash wildcard semantics? # echo 'p vfs_read $arg*' >> dynamic_events I think that is more along the lines of what people would expect. What do you think? -- Steve
Changes in v6: - update patch description. --- kernel/trace/trace_fprobe.c | 21 ++++++++- kernel/trace/trace_kprobe.c | 23 ++++++++-- kernel/trace/trace_probe.c | 98 +++++++++++++++++++++++++++++++++++++++++++ kernel/trace/trace_probe.h | 10 ++++ 4 files changed, 144 insertions(+), 8 deletions(-)