Commit e5416950 authored by Song Liu's avatar Song Liu Committed by Arnaldo Carvalho de Melo

perf bpf: Make synthesize_bpf_events() receive perf_session pointer instead of perf_tool

This patch changes the arguments of perf_event__synthesize_bpf_events()
to include perf_session* instead of perf_tool*. perf_session will be
used in the next patch.
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: kernel-team@fb.com
Link: http://lkml.kernel.org/r/20190312053051.2690567-6-songliubraving@fb.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a742258a
...@@ -1114,7 +1114,7 @@ static int record__synthesize(struct record *rec, bool tail) ...@@ -1114,7 +1114,7 @@ static int record__synthesize(struct record *rec, bool tail)
return err; return err;
} }
err = perf_event__synthesize_bpf_events(tool, process_synthesized_event, err = perf_event__synthesize_bpf_events(session, process_synthesized_event,
machine, opts); machine, opts);
if (err < 0) if (err < 0)
pr_warning("Couldn't synthesize bpf events.\n"); pr_warning("Couldn't synthesize bpf events.\n");
......
...@@ -1208,7 +1208,7 @@ static int __cmd_top(struct perf_top *top) ...@@ -1208,7 +1208,7 @@ static int __cmd_top(struct perf_top *top)
init_process_thread(top); init_process_thread(top);
ret = perf_event__synthesize_bpf_events(&top->tool, perf_event__process, ret = perf_event__synthesize_bpf_events(top->session, perf_event__process,
&top->session->machines.host, &top->session->machines.host,
&top->record_opts); &top->record_opts);
if (ret < 0) if (ret < 0)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "debug.h" #include "debug.h"
#include "symbol.h" #include "symbol.h"
#include "machine.h" #include "machine.h"
#include "session.h"
#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr))
...@@ -42,7 +43,7 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused, ...@@ -42,7 +43,7 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused,
* -1 for failures; * -1 for failures;
* -2 for lack of kernel support. * -2 for lack of kernel support.
*/ */
static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool, static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
perf_event__handler_t process, perf_event__handler_t process,
struct machine *machine, struct machine *machine,
int fd, int fd,
...@@ -52,6 +53,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool, ...@@ -52,6 +53,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
struct ksymbol_event *ksymbol_event = &event->ksymbol_event; struct ksymbol_event *ksymbol_event = &event->ksymbol_event;
struct bpf_event *bpf_event = &event->bpf_event; struct bpf_event *bpf_event = &event->bpf_event;
struct bpf_prog_info_linear *info_linear; struct bpf_prog_info_linear *info_linear;
struct perf_tool *tool = session->tool;
struct bpf_prog_info *info; struct bpf_prog_info *info;
struct btf *btf = NULL; struct btf *btf = NULL;
bool has_btf = false; bool has_btf = false;
...@@ -175,7 +177,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool, ...@@ -175,7 +177,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
return err ? -1 : 0; return err ? -1 : 0;
} }
int perf_event__synthesize_bpf_events(struct perf_tool *tool, int perf_event__synthesize_bpf_events(struct perf_session *session,
perf_event__handler_t process, perf_event__handler_t process,
struct machine *machine, struct machine *machine,
struct record_opts *opts) struct record_opts *opts)
...@@ -209,7 +211,7 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool, ...@@ -209,7 +211,7 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
continue; continue;
} }
err = perf_event__synthesize_one_bpf_prog(tool, process, err = perf_event__synthesize_one_bpf_prog(session, process,
machine, fd, machine, fd,
event, opts); event, opts);
close(fd); close(fd);
......
...@@ -15,7 +15,7 @@ struct record_opts; ...@@ -15,7 +15,7 @@ struct record_opts;
int machine__process_bpf_event(struct machine *machine, union perf_event *event, int machine__process_bpf_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample); struct perf_sample *sample);
int perf_event__synthesize_bpf_events(struct perf_tool *tool, int perf_event__synthesize_bpf_events(struct perf_session *session,
perf_event__handler_t process, perf_event__handler_t process,
struct machine *machine, struct machine *machine,
struct record_opts *opts); struct record_opts *opts);
...@@ -27,7 +27,7 @@ static inline int machine__process_bpf_event(struct machine *machine __maybe_unu ...@@ -27,7 +27,7 @@ static inline int machine__process_bpf_event(struct machine *machine __maybe_unu
return 0; return 0;
} }
static inline int perf_event__synthesize_bpf_events(struct perf_tool *tool __maybe_unused, static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
perf_event__handler_t process __maybe_unused, perf_event__handler_t process __maybe_unused,
struct machine *machine __maybe_unused, struct machine *machine __maybe_unused,
struct record_opts *opts __maybe_unused) struct record_opts *opts __maybe_unused)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment