On Mon, 15 May 2023 07:57:01 -0400 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > On Sun, 14 May 2023 23:12:11 +0900 > "Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote: > > > From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> > > > > 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@xxxxxxxxxx> > > --- > > 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? Good idea! BTW, user will expect that $arg* will be expanded to available "$argN". But this $args does different thing at this point, it is expanded to something equivalent to "<BTF-name>=$argN:<BTF-type>". So, to give more consistency, I need one more step: when user gives only "$argN" on BTF supported kernel, it will be translated to "<BTF-name>=$argN:<BTF-type>". Then, I think it is natural to use '$arg*'. Thank you, > > -- 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(-) > > > > -- Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>