public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Donglin Peng <dolinux.peng@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	mark.rutland@arm.com, mathieu.desnoyers@efficios.com,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing/fgraph: Simplify return address printing in function graph tracer
Date: Thu, 10 Oct 2024 23:06:13 +0900	[thread overview]
Message-ID: <20241010230613.9eb8d8e156789037bf52593b@kernel.org> (raw)
In-Reply-To: <CAErzpmtyA9hh611jGS=FHT9K4YyfsRv5=9mg6YLD2m5XQS8dyw@mail.gmail.com>

On Thu, 10 Oct 2024 10:40:02 +0800
Donglin Peng <dolinux.peng@gmail.com> wrote:

> On Thu, Oct 10, 2024 at 7:35 AM Masami Hiramatsu (Google)
> <mhiramat@kernel.org> wrote:
> >
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
> > Simplify return address printing in the function graph tracer by removing
> > fgraph_extras. Since this feature is only used by the function graph
> > tracer and the feature flags can directly accessible from the function
> > graph tracer, fgraph_extras can be removed from the fgraph callback.
> >
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > ---
> >  include/linux/ftrace.h               |   16 ++++--------
> >  kernel/trace/fgraph.c                |   45 ++++++++++++++++++++++------------
> >  kernel/trace/ftrace.c                |    3 +-
> >  kernel/trace/trace.h                 |    3 +-
> >  kernel/trace/trace_functions_graph.c |   14 +++++------
> >  kernel/trace/trace_irqsoff.c         |    3 +-
> >  kernel/trace/trace_sched_wakeup.c    |    3 +-
> >  kernel/trace/trace_selftest.c        |    8 ++----
> >  8 files changed, 48 insertions(+), 47 deletions(-)
> >
> > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> > index 2ac3b3b53cd0..997e1f0335b6 100644
> > --- a/include/linux/ftrace.h
> > +++ b/include/linux/ftrace.h
> > @@ -1068,29 +1068,20 @@ struct ftrace_graph_ret {
> >         unsigned long long rettime;
> >  } __packed;
> >
> > -struct fgraph_extras;
> >  struct fgraph_ops;
> >
> >  /* Type of the callback handlers for tracing function graph*/
> >  typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *,
> >                                        struct fgraph_ops *); /* return */
> >  typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *,
> > -                                     struct fgraph_ops *,
> > -                                     struct fgraph_extras *); /* entry */
> > +                                     struct fgraph_ops *); /* entry */
> >
> >  extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace,
> > -                                  struct fgraph_ops *gops,
> > -                                  struct fgraph_extras *extras);
> > +                                  struct fgraph_ops *gops);
> >  bool ftrace_pids_enabled(struct ftrace_ops *ops);
> >
> >  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> >
> > -/* Used to convey some extra datas when creating a graph entry */
> > -struct fgraph_extras {
> > -       u32 flags;
> > -       unsigned long retaddr;
> > -};
> > -
> >  struct fgraph_ops {
> >         trace_func_graph_ent_t          entryfunc;
> >         trace_func_graph_ret_t          retfunc;
> > @@ -1131,12 +1122,15 @@ function_graph_enter(unsigned long ret, unsigned long func,
> >
> >  struct ftrace_ret_stack *
> >  ftrace_graph_get_ret_stack(struct task_struct *task, int skip);
> > +unsigned long ftrace_graph_top_ret_addr(struct task_struct *task);
> >
> >  unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
> >                                     unsigned long ret, unsigned long *retp);
> >  unsigned long *fgraph_get_task_var(struct fgraph_ops *gops);
> >
> >  u32 graph_tracer_flags_get(u32 flags);
> > +#define graph_tracer_flags_is_set(flags)       \
> > +       (graph_tracer_flags_get(flags) == (flags))
> 
> Do we need to retain the function graph_tracer_flags_get? it will be
> only invoked in the
> file trace_functions_graph.c, so we may access the tracer_flags
> variable directly.

Good catch!
Let me send v2.

Thanks!


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

      reply	other threads:[~2024-10-10 14:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 23:35 [PATCH] tracing/fgraph: Simplify return address printing in function graph tracer Masami Hiramatsu (Google)
2024-10-10  2:40 ` Donglin Peng
2024-10-10 14:06   ` Masami Hiramatsu [this message]

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=20241010230613.9eb8d8e156789037bf52593b@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=dolinux.peng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.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