Message ID | 173519012541.391279.12203132904339088937.stgit@devnote2 (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph | expand |
On Thu, 26 Dec 2024 14:15:25 +0900 "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote: > From: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > Add ftrace_get_entry_ip() which is only for ftrace based probes, and use > it for kprobe multi probes because they are based on fprobe which uses > ftrace instead of kprobes. > > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> On my 32bit build, I hit a new warning; kernel/trace/bpf_trace.c:1073:22: warning: ‘ftrace_get_entry_ip’ defined but not used [-Wunused-function] 1073 | static unsigned long ftrace_get_entry_ip(unsigned long fentry_ip) | ^~~~~~~~~~~~~~~~~~~ Config attached. -- Steve > --- > Changes in v21: > - Use new ftreace_get_symaddr() only for kprobe multi probes. > Changes in v19: > - Use ftrace_get_symaddr() instead of introducing new arch dependent code. > - Also, replace x86 code with ftrace_get_symaddr(), which does the same > thing. > --- > kernel/trace/bpf_trace.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index 863351559334..47beb70187d7 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -1070,6 +1070,13 @@ static unsigned long get_entry_ip(unsigned long fentry_ip) > #define get_entry_ip(fentry_ip) fentry_ip > #endif > > +static unsigned long ftrace_get_entry_ip(unsigned long fentry_ip) > +{ > + unsigned long ip = ftrace_get_symaddr(fentry_ip); > + > + return ip ? : fentry_ip; > +} > + > BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) > { > struct bpf_trace_run_ctx *run_ctx __maybe_unused; > @@ -2829,7 +2836,8 @@ kprobe_multi_link_handler(struct fprobe *fp, unsigned long fentry_ip, > int err; > > link = container_of(fp, struct bpf_kprobe_multi_link, fp); > - err = kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), fregs, false, data); > + err = kprobe_multi_link_prog_run(link, ftrace_get_entry_ip(fentry_ip), > + fregs, false, data); > return is_kprobe_session(link->link.prog) ? err : 0; > } > > @@ -2841,7 +2849,8 @@ kprobe_multi_link_exit_handler(struct fprobe *fp, unsigned long fentry_ip, > struct bpf_kprobe_multi_link *link; > > link = container_of(fp, struct bpf_kprobe_multi_link, fp); > - kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), fregs, true, data); > + kprobe_multi_link_prog_run(link, ftrace_get_entry_ip(fentry_ip), > + fregs, true, data); > } > > static int symbols_cmp_r(const void *a, const void *b, const void *priv)
On Thu, 26 Dec 2024 21:23:39 -0500 Steven Rostedt <rostedt@goodmis.org> wrote: > On Thu, 26 Dec 2024 14:15:25 +0900 > "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote: > > > From: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > > > Add ftrace_get_entry_ip() which is only for ftrace based probes, and use > > it for kprobe multi probes because they are based on fprobe which uses > > ftrace instead of kprobes. > > > > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > On my 32bit build, I hit a new warning; > > kernel/trace/bpf_trace.c:1073:22: warning: ‘ftrace_get_entry_ip’ defined but not used [-Wunused-function] > 1073 | static unsigned long ftrace_get_entry_ip(unsigned long fentry_ip) > | ^~~~~~~~~~~~~~~~~~~ > > Config attached. Since this is the last patch of the series, just send a new patch for this one. I'll continue testing the rest of the patches. -- Steve
On Thu, 26 Dec 2024 21:24:53 -0500 Steven Rostedt <rostedt@goodmis.org> wrote: > > On my 32bit build, I hit a new warning; > > > > kernel/trace/bpf_trace.c:1073:22: warning: ‘ftrace_get_entry_ip’ defined but not used [-Wunused-function] > > 1073 | static unsigned long ftrace_get_entry_ip(unsigned long fentry_ip) > > | ^~~~~~~~~~~~~~~~~~~ > > > > Config attached. > > > Since this is the last patch of the series, just send a new patch for this one. > I'll continue testing the rest of the patches. The tests passed without this patch so I applied them to my for-next branch. If you fix this, you just need to send this patch only. Thanks, -- Steve
On Fri, 27 Dec 2024 10:24:52 -0500 Steven Rostedt <rostedt@goodmis.org> wrote: > On Thu, 26 Dec 2024 21:24:53 -0500 > Steven Rostedt <rostedt@goodmis.org> wrote: > > > > On my 32bit build, I hit a new warning; > > > > > > kernel/trace/bpf_trace.c:1073:22: warning: ‘ftrace_get_entry_ip’ defined but not used [-Wunused-function] > > > 1073 | static unsigned long ftrace_get_entry_ip(unsigned long fentry_ip) > > > | ^~~~~~~~~~~~~~~~~~~ > > > > > > Config attached. > > > > > > Since this is the last patch of the series, just send a new patch for this one. > > I'll continue testing the rest of the patches. > > The tests passed without this patch so I applied them to my for-next branch. Thanks! > > If you fix this, you just need to send this patch only. OK, let me fix this issue. > > Thanks, > > -- Steve
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 863351559334..47beb70187d7 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1070,6 +1070,13 @@ static unsigned long get_entry_ip(unsigned long fentry_ip) #define get_entry_ip(fentry_ip) fentry_ip #endif +static unsigned long ftrace_get_entry_ip(unsigned long fentry_ip) +{ + unsigned long ip = ftrace_get_symaddr(fentry_ip); + + return ip ? : fentry_ip; +} + BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) { struct bpf_trace_run_ctx *run_ctx __maybe_unused; @@ -2829,7 +2836,8 @@ kprobe_multi_link_handler(struct fprobe *fp, unsigned long fentry_ip, int err; link = container_of(fp, struct bpf_kprobe_multi_link, fp); - err = kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), fregs, false, data); + err = kprobe_multi_link_prog_run(link, ftrace_get_entry_ip(fentry_ip), + fregs, false, data); return is_kprobe_session(link->link.prog) ? err : 0; } @@ -2841,7 +2849,8 @@ kprobe_multi_link_exit_handler(struct fprobe *fp, unsigned long fentry_ip, struct bpf_kprobe_multi_link *link; link = container_of(fp, struct bpf_kprobe_multi_link, fp); - kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), fregs, true, data); + kprobe_multi_link_prog_run(link, ftrace_get_entry_ip(fentry_ip), + fregs, true, data); } static int symbols_cmp_r(const void *a, const void *b, const void *priv)