lkml.org 
[lkml]   [2023]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 07/11] tracing/probes: Add $args meta argument for all function args
On Sun, 14 May 2023 23:12:11 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> 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(-)
>
>

\
 
 \ /
  Last update: 2023-05-15 14:00    [W:0.067 / U:2.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site