[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADxym3YcR+WYjRv-0+SOiE1yoO85FaqffCF2XbLZ9H7+qHet6w@mail.gmail.com>
Date: Wed, 29 Oct 2025 22:09:40 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: mhiramat@...nel.org, jolsa@...nel.org, mathieu.desnoyers@...icios.com, 
	jiang.biao@...ux.dev, linux-kernel@...r.kernel.org, 
	linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing: fprobe: use ftrace if CONFIG_DYNAMIC_FTRACE_WITH_ARGS
On Wed, Oct 29, 2025 at 10:00 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Wed, 29 Oct 2025 10:15:14 +0800
> Menglong Dong <menglong8.dong@...il.com> wrote:
>
> > -#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> > +#if defined(CONFIG_DYNAMIC_FTRACE_WITH_ARGS) || defined(CONFIG_DYNAMIC_FTRACE_WITH_REGS)
> > +#define FPROBE_USE_FTRACE
> > +#endif
> > +
> > +#ifdef FPROBE_USE_FTRACE
> >  /* ftrace_ops callback, this processes fprobes which have only entry_handler. */
> >  static void fprobe_ftrace_entry(unsigned long ip, unsigned long parent_ip,
> >       struct ftrace_ops *ops, struct ftrace_regs *fregs)
> > @@ -295,7 +299,7 @@ NOKPROBE_SYMBOL(fprobe_ftrace_entry);
> >
> >  static struct ftrace_ops fprobe_ftrace_ops = {
> >       .func   = fprobe_ftrace_entry,
> > -     .flags  = FTRACE_OPS_FL_SAVE_REGS,
> > +     .flags  = FTRACE_OPS_FL_SAVE_ARGS,
>
> If an arch defines DYNAMIC_FTRACE_WITH_REGS but not
> DYNAMIC_FTRACE_WITH_ARGS, then this will fail to build.
Hi, it won't fail here, as FTRACE_OPS_FL_SAVE_ARGS has
following definition:
#ifndef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
#define FTRACE_OPS_FL_SAVE_ARGS                        FTRACE_OPS_FL_SAVE_REGS
#else
#define FTRACE_OPS_FL_SAVE_ARGS                        0
#endif
Which means it will fallback to FTRACE_OPS_FL_SAVE_REGS if
CONFIG_DYNAMIC_FTRACE_WITH_ARGS not defined.
I have commit a PR to the bpf CI, and all testings passed and no
building error happens:
  https://github.com/kernel-patches/bpf/pull/10110
Thanks!
Menglong Dong
>
> >  };
> >  static int fprobe_ftrace_active;
> >
>
> Perhaps do:
>
> #ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
> # define FPROBE_FTRACE_TYPE FTRACE_OPS_FL_SAVE_ARGS
> #elif defined(CONFIG_DYNAMIC_FTRACE_WITH_REGS)
> # define FPROBE_FTRACE_TYPE FTRACE_OPS_FL_SAVE_REGS,
> #endif
>
> #ifdef FPROBE_FTRACE_TYPE
> [..]
> static struct ftrace_ops fprobe_ftrace_ops = {
>         .func   = fprobe_ftrace_entry,
>         .flags  = FTRACE_FTRACE_TYPE,
>
>
> ?
>
> -- Steve
Powered by blists - more mailing lists
 
