linux-trace-kernel.vger.kernel.org archive mirror
 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 v11 02/11] tracing/probes: Add fprobe events for tracing function entry and exit.
Date: Fri, 7 Jul 2023 23:17:30 +0900	[thread overview]
Message-ID: <20230707231730.7e2d176d729718a9ba51255a@kernel.org> (raw)
In-Reply-To: <20230608165234.0c00c146@gandalf.local.home>

On Thu, 8 Jun 2023 16:52:34 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 17 May 2023 19:59:04 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > Add fprobe events for tracing function entry and exit instead of kprobe
> > events. With this change, we can continue to trace function entry/exit
> > even if the CONFIG_KPROBES_ON_FTRACE is not available. Since
> > CONFIG_KPROBES_ON_FTRACE requires the CONFIG_DYNAMIC_FTRACE_WITH_REGS,
> > it is not available if the architecture only supports
> > CONFIG_DYNAMIC_FTRACE_WITH_ARGS. And that means kprobe events can not
> > probe function entry/exit effectively on such architecture.
> > But this can be solved if the dynamic events supports fprobe events.
> > 
> > The fprobe event is a new dynamic events which is only for the function
> > (symbol) entry and exit. This event accepts non register fetch arguments
> > so that user can trace the function arguments and return values.
> > 
> > The fprobe events syntax is here;
> > 
> >  f[:[GRP/][EVENT]] FUNCTION [FETCHARGS]
> >  f[MAXACTIVE][:[GRP/][EVENT]] FUNCTION%return [FETCHARGS]
> 
> I finally got around to look at these (I know you already queued them), but
> looking at the above, the "%return" is redundant.
> 
> > 
> > E.g.
> > 
> >  # echo 'f vfs_read $arg1'  >> dynamic_events
> >  # echo 'f vfs_read%return $retval'  >> dynamic_events
> >  # cat dynamic_events
> >  f:fprobes/vfs_read__entry vfs_read arg1=$arg1
> >  f:fprobes/vfs_read__exit vfs_read%return arg1=$retval
> 
> Can't we just have:
> 
>   f:fprobes/vfs_read__entry vfs_read arg1=$arg1
>   f:fprobes/vfs_read__exit vfs_read arg1=$retval
> 
> Where if "$retval" is specified, it automatically becomes a return? If
> anything else is specified, it errors out. That is, if $retval is
> specified, it becomes a return probe, as a return probe can only have
> $retval. If anything else is specified, it errors out if $retval is also
> specified.

Hmm, current implementation design doesn't allow that.
It parses the 'place' and 'args' sequencially because what 'args' is
available depends on the place.

> 
> Now if it's a void function, and you just want to make it a return then we
> can have your:
> 
>   f:fprobes/vfs_read__exit vfs_read%return
> 
> Thoughts?

But this sounds useful. Let me try to scan the argument to find $retval.

Thank you,

> 
> -- Steve
> 
> 
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2023-07-07 14:17 UTC|newest]

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

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=20230707231730.7e2d176d729718a9ba51255a@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;
as well as URLs for NNTP newsgroup(s).