mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Florent Revest <revest@chromium.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	bpf@vger.kernel.org
Subject: Re: [PATCH v10 07/11] tracing/probes: Add $args meta argument for all function args
Date: Tue, 16 May 2023 00:11:37 +0900	[thread overview]
Message-ID: <20230516001137.d5c2f16b89c26bfce31f1c2b@kernel.org> (raw)
In-Reply-To: <20230515075701.6f49b3e7@gandalf.local.home>

On Mon, 15 May 2023 07:57:01 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> 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?

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@kernel.org>

  reply	other threads:[~2023-05-15 15:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-14 14:11 [PATCH v10 00/11] tracing: Add fprobe/tracepoint events Masami Hiramatsu (Google)
2023-05-14 14:11 ` [PATCH v10 01/11] fprobe: Pass return address to the handlers Masami Hiramatsu (Google)
2023-05-14 14:11 ` [PATCH v10 02/11] tracing/probes: Add fprobe events for tracing function entry and exit Masami Hiramatsu (Google)
2023-05-14 14:11 ` [PATCH v10 03/11] selftests/ftrace: Add fprobe related testcases Masami Hiramatsu (Google)
2023-05-14 14:11 ` [PATCH v10 04/11] tracing/probes: Add tracepoint support on fprobe_events Masami Hiramatsu (Google)
2023-05-14 14:11 ` [PATCH v10 05/11] tracing/probes: Move event parameter fetching code to common parser Masami Hiramatsu (Google)
2023-05-14 14:12 ` [PATCH v10 06/11] tracing/probes: Support function parameters if BTF is available Masami Hiramatsu (Google)
2023-05-14 14:12 ` [PATCH v10 07/11] tracing/probes: Add $args meta argument for all function args Masami Hiramatsu (Google)
2023-05-15 11:57   ` Steven Rostedt
2023-05-15 15:11     ` Masami Hiramatsu [this message]
2023-05-14 14:12 ` [PATCH v10 08/11] tracing/probes: Add BTF retval type support Masami Hiramatsu (Google)
2023-05-14 14:12 ` [PATCH v10 09/11] selftests/ftrace: Add tracepoint probe test case Masami Hiramatsu (Google)
2023-05-14 14:12 ` [PATCH v10 10/11] selftests/ftrace: Add BTF arguments test cases Masami Hiramatsu (Google)
2023-05-14 14:12 ` [PATCH v10 11/11] Documentation: tracing/probes: Add fprobe event tracing document Masami Hiramatsu (Google)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230516001137.d5c2f16b89c26bfce31f1c2b@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=revest@chromium.org \
    --cc=rostedt@goodmis.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®