[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZbJ6NxkjWEP5adru@krava>
Date: Thu, 25 Jan 2024 16:11:51 +0100
From: Jiri Olsa <olsajiri@...il.com>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Florent Revest <revest@...omium.org>,
linux-trace-kernel@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, bpf <bpf@...r.kernel.org>,
Sven Schnelle <svens@...ux.ibm.com>,
Alexei Starovoitov <ast@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Alan Maguire <alan.maguire@...cle.com>,
Mark Rutland <mark.rutland@....com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, Guo Ren <guoren@...nel.org>
Subject: Re: [PATCH v6 32/36] fprobe: Rewrite fprobe on function-graph tracer
On Fri, Jan 12, 2024 at 07:17:06PM +0900, Masami Hiramatsu (Google) wrote:
SNIP
> * Register @fp to ftrace for enabling the probe on the address given by @addrs.
> @@ -298,23 +547,27 @@ EXPORT_SYMBOL_GPL(register_fprobe);
> */
> int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num)
> {
> - int ret;
> -
> - if (!fp || !addrs || num <= 0)
> - return -EINVAL;
> -
> - fprobe_init(fp);
> + struct fprobe_hlist *hlist_array;
> + int ret, i;
>
> - ret = ftrace_set_filter_ips(&fp->ops, addrs, num, 0, 0);
> + ret = fprobe_init(fp, addrs, num);
> if (ret)
> return ret;
>
> - ret = fprobe_init_rethook(fp, num);
> - if (!ret)
> - ret = register_ftrace_function(&fp->ops);
> + mutex_lock(&fprobe_mutex);
> +
> + hlist_array = fp->hlist_array;
> + ret = fprobe_graph_add_ips(addrs, num);
so fprobe_graph_add_ips registers the ftrace_ops and actually starts
the tracing.. and in the code below we prepare fprobe data that is
checked in the ftrace_ops callback.. should we do this this earlier
before calling fprobe_graph_add_ips/register_ftrace_graph?
jirka
> + if (!ret) {
> + add_fprobe_hash(fp);
> + for (i = 0; i < hlist_array->size; i++)
> + insert_fprobe_node(&hlist_array->array[i]);
> + }
> + mutex_unlock(&fprobe_mutex);
>
> if (ret)
> fprobe_fail_cleanup(fp);
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(register_fprobe_ips);
> @@ -352,14 +605,13 @@ EXPORT_SYMBOL_GPL(register_fprobe_syms);
SNIP
Powered by blists - more mailing lists