aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/bpf-loader.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-02-06 19:56:20 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-06 19:56:20 -0500
commite90b1fd83c94d536375d8b9f4916afd15f4db0ed (patch)
treeba50688cc9a6712575aa861ff37b1db53dc472b8 /tools/perf/util/bpf-loader.c
parent907bea9cb8e9b7c4cb6a8042c164f3c24f141006 (diff)
parentdd9cef43c222df7c0d76d34451808e789952379d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2019-02-07 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Add a riscv64 JIT for BPF, from Björn. 2) Implement BTF deduplication algorithm for libbpf which takes BTF type information containing duplicate per-compilation unit information and reduces it to an equivalent set of BTF types with no duplication and without loss of information, from Andrii. 3) Offloaded and native BPF XDP programs can coexist today, enable also offloaded and generic ones as well, from Jakub. 4) Expose various BTF related helper functions in libbpf as API which are in particular helpful for JITed programs, from Yonghong. 5) Fix the recently added JMP32 code emission in s390x JIT, from Heiko. 6) Fix BPF kselftests' tcp_{server,client}.py to be able to run inside a network namespace, also add a fix for libbpf to get libbpf_print() working, from Stanislav. 7) Fixes for bpftool documentation, from Prashant. 8) Type cleanup in BPF kselftests' test_maps.c to silence a gcc8 warning, from Breno. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/perf/util/bpf-loader.c')
-rw-r--r--tools/perf/util/bpf-loader.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 2f3eb6d293ee..037d8ff6a634 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -24,22 +24,12 @@
24#include "llvm-utils.h" 24#include "llvm-utils.h"
25#include "c++/clang-c.h" 25#include "c++/clang-c.h"
26 26
27#define DEFINE_PRINT_FN(name, level) \ 27static int libbpf_perf_print(enum libbpf_print_level level __attribute__((unused)),
28static int libbpf_##name(const char *fmt, ...) \ 28 const char *fmt, va_list args)
29{ \ 29{
30 va_list args; \ 30 return veprintf(1, verbose, pr_fmt(fmt), args);
31 int ret; \
32 \
33 va_start(args, fmt); \
34 ret = veprintf(level, verbose, pr_fmt(fmt), args);\
35 va_end(args); \
36 return ret; \
37} 31}
38 32
39DEFINE_PRINT_FN(warning, 1)
40DEFINE_PRINT_FN(info, 1)
41DEFINE_PRINT_FN(debug, 1)
42
43struct bpf_prog_priv { 33struct bpf_prog_priv {
44 bool is_tp; 34 bool is_tp;
45 char *sys_name; 35 char *sys_name;
@@ -59,9 +49,7 @@ bpf__prepare_load_buffer(void *obj_buf, size_t obj_buf_sz, const char *name)
59 struct bpf_object *obj; 49 struct bpf_object *obj;
60 50
61 if (!libbpf_initialized) { 51 if (!libbpf_initialized) {
62 libbpf_set_print(libbpf_warning, 52 libbpf_set_print(libbpf_perf_print);
63 libbpf_info,
64 libbpf_debug);
65 libbpf_initialized = true; 53 libbpf_initialized = true;
66 } 54 }
67 55
@@ -79,9 +67,7 @@ struct bpf_object *bpf__prepare_load(const char *filename, bool source)
79 struct bpf_object *obj; 67 struct bpf_object *obj;
80 68
81 if (!libbpf_initialized) { 69 if (!libbpf_initialized) {
82 libbpf_set_print(libbpf_warning, 70 libbpf_set_print(libbpf_perf_print);
83 libbpf_info,
84 libbpf_debug);
85 libbpf_initialized = true; 71 libbpf_initialized = true;
86 } 72 }
87 73