Skip to content

Commit

Permalink
perf bpf: Move perf_event_output() from stdio.h to bpf.h
Browse files Browse the repository at this point in the history
So that we don't always carry that __bpf_output__ map, leaving that to
the scripts wanting to use that facility.

'perf trace' will be changed to look if that map is present and only
setup the bpf-output events if so.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-azwys8irxqx9053vpajr0k5h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed Dec 18, 2018
1 parent b27b38e commit 61d0071
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tools/perf/include/bpf/bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ int _version SEC("version") = LINUX_VERSION_CODE;
static int (*probe_read)(void *dst, int size, const void *unsafe_addr) = (void *)BPF_FUNC_probe_read;
static int (*probe_read_str)(void *dst, int size, const void *unsafe_addr) = (void *)BPF_FUNC_probe_read_str;

static int (*perf_event_output)(void *, struct bpf_map *, int, void *, unsigned long) = (void *)BPF_FUNC_perf_event_output;

#endif /* _PERF_BPF_H */
3 changes: 0 additions & 3 deletions tools/perf/include/bpf/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ struct bpf_map SEC("maps") __bpf_stdout__ = {
.max_entries = __NR_CPUS__,
};

static int (*perf_event_output)(void *, struct bpf_map *, int, void *, unsigned long) =
(void *)BPF_FUNC_perf_event_output;

#define puts(from) \
({ const int __len = sizeof(from); \
char __from[__len] = from; \
Expand Down

0 comments on commit 61d0071

Please sign in to comment.