perf trace: Fix compilation error for make NO_LIBBPF=1 DEBUG=1
Jiri Olsa
reviewerRFC 1/1 perf trace: Fix compilation error for make NO_LIBBPF=1 DEBUG=1
I haven't tested if this breaks some perf trace functionality, hence RFC ;-)
The perf compilation fails for NO_LIBBPF=1 DEBUG=1 with:
$ make NO_LIBBPF=1 DEBUG=1
BUILD: Doing 'make -j8' parallel build
CC builtin-trace.o
LD perf-in.o
LINK perf
/usr/bin/ld: perf-in.o: in function `trace__find_bpf_map_by_name':
/home/jolsa/kernel/linux-perf/tools/perf/builtin-trace.c:4608: undefined reference to `bpf_object__find_map_by_name'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.perf:631: perf] Error 1
make[1]: *** [Makefile.perf:225: sub-make] Error 2
make: *** [Makefile:70: all] Error 2Moving trace__find_bpf_map_by_name calls under HAVE_LIBBPF_SUPPORT ifdef and add make test for this.
--- tools/perf/builtin-trace.c | 54 ++++++++++++++++++++++++-------------- tools/perf/tests/make | 1 + 2 files changed, 35 insertions(+), 20 deletions(-)
tools/perf/builtin-trace.c +34 -20
@@ -3174,6 +3174,26 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) }#ifdef HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) +{ +if (trace->bpf_obj ==NULL ) +return NULL ; + +return bpf_object__find_map_by_name (trace->bpf_obj, name); +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace) +{ + trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); +} + +static void trace__set_bpf_map_syscalls (struct trace *trace) +{ + trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); + trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); + trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); +} +static struct bpf_program *trace__find_bpf_program_by_title (struct trace *trace,const char *name) {if (trace->bpf_obj ==NULL )
@@ -3512,6 +3532,20 @@ static void trace__delete_augmented_syscalls(struct trace *trace) trace->bpf_obj = NULL; }#else // HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace__maybe_unused , +const char *name__maybe_unused ) +{ +return NULL ; +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace__maybe_unused ) +{ +} + +static void trace__set_bpf_map_syscalls (struct trace *trace__maybe_unused ) +{ +} +static int trace__set_ev_qualifier_bpf_filter (struct trace *trace__maybe_unused ) {return 0 ;
@@ -4600,26 +4634,6 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int ureturn 0 ; } -static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) -{ -if (trace->bpf_obj ==NULL ) -return NULL ; - -return bpf_object__find_map_by_name (trace->bpf_obj, name); -} - -static void trace__set_bpf_map_filtered_pids (struct trace *trace) -{ - trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); -} - -static void trace__set_bpf_map_syscalls (struct trace *trace) -{ - trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); - trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); - trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); -} -static int trace__config (const char *var,const char *value,void *arg) {struct trace *trace = arg;
tools/perf/tests/make +1 -0
@@ -84,6 +84,7 @@ make_no_libaudit := NO_LIBAUDIT=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 +make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 make_no_libcrypto := NO_LIBCRYPTO=1 make_with_babeltrace:= LIBBABELTRACE=1 make_no_sdt := NO_SDT=1
Signature · 1 line
2.25.4
Em Mon, May 18, 2020 at 04:10:27PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
I haven't tested if this breaks some perf trace functionality, hence RFC ;-)
Thanks for the patch, looks ok, applying, please let me know if you need to do something else with it.
- Arnaldo
Quoted 117 lines
The perf compilation fails for NO_LIBBPF=1 DEBUG=1 with:
$ make NO_LIBBPF=1 DEBUG=1 BUILD: Doing 'make -j8' parallel build CC builtin-trace.o LD perf-in.o LINK perf /usr/bin/ld: perf-in.o: in function `trace__find_bpf_map_by_name': /home/jolsa/kernel/linux-perf/tools/perf/builtin-trace.c:4608: undefined reference to `bpf_object__find_map_by_name' collect2: error: ld returned 1 exit status make[2]: *** [Makefile.perf:631: perf] Error 1 make[1]: *** [Makefile.perf:225: sub-make] Error 2 make: *** [Makefile:70: all] Error 2Moving
trace__find_bpf_map_by_namecalls underHAVE_LIBBPF_SUPPORTifdef and add make test for this.Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-trace.c | 54 ++++++++++++++++++++++++-------------- tools/perf/tests/make | 1 + 2 files changed, 35 insertions(+), 20 deletions(-)tools/perf/builtin-trace.c +34
-20@@ -3174,6 +3174,26 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) }#ifdef HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) +{ +if (trace->bpf_obj ==NULL ) +return NULL ; + +return bpf_object__find_map_by_name (trace->bpf_obj, name); +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace) +{ + trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); +} + +static void trace__set_bpf_map_syscalls (struct trace *trace) +{ + trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); + trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); + trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); +} +static struct bpf_program *trace__find_bpf_program_by_title (struct trace *trace,const char *name) {if (trace->bpf_obj ==NULL )@@ -3512,6 +3532,20 @@ static void trace__delete_augmented_syscalls(struct trace *trace) trace->bpf_obj = NULL; }#else // HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace__maybe_unused , +const char *name__maybe_unused ) +{ +return NULL ; +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace__maybe_unused ) +{ +} + +static void trace__set_bpf_map_syscalls (struct trace *trace__maybe_unused ) +{ +} +static int trace__set_ev_qualifier_bpf_filter (struct trace *trace__maybe_unused ) {return 0 ;@@ -4600,26 +4634,6 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int ureturn 0 ; } -static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) -{ -if (trace->bpf_obj ==NULL ) -return NULL ; - -return bpf_object__find_map_by_name (trace->bpf_obj, name); -} - -static void trace__set_bpf_map_filtered_pids (struct trace *trace) -{ - trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); -} - -static void trace__set_bpf_map_syscalls (struct trace *trace) -{ - trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); - trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); - trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); -} -static int trace__config (const char *var,const char *value,void *arg) {struct trace *trace = arg;tools/perf/tests/make +1
-0@@ -84,6 +84,7 @@ make_no_libaudit := NO_LIBAUDIT=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 +make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 make_no_libcrypto := NO_LIBCRYPTO=1 make_with_babeltrace:= LIBBABELTRACE=1 make_no_sdt := NO_SDT=1Signature · 1 line
2.25.4
Signature · 1 line
- Arnaldo
Quoted 6 lines · Arnaldo Carvalho de Melo
Em Mon, May 18, 2020 at 04:10:27PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
I haven't tested if this breaks some perf trace functionality, hence RFC ;-)
Thanks for the patch, looks ok, applying, please let me know if you need to do something else with it.
just wasn't sure the hook will work with NULL,
so if you're ok with it, then it's ok ;-)
thanks,
jirka
Quoted 125 lines
- Arnaldo
Quoted 117 lines
The perf compilation fails for NO_LIBBPF=1 DEBUG=1 with:
$ make NO_LIBBPF=1 DEBUG=1 BUILD: Doing 'make -j8' parallel build CC builtin-trace.o LD perf-in.o LINK perf /usr/bin/ld: perf-in.o: in function `trace__find_bpf_map_by_name': /home/jolsa/kernel/linux-perf/tools/perf/builtin-trace.c:4608: undefined reference to `bpf_object__find_map_by_name' collect2: error: ld returned 1 exit status make[2]: *** [Makefile.perf:631: perf] Error 1 make[1]: *** [Makefile.perf:225: sub-make] Error 2 make: *** [Makefile:70: all] Error 2Moving
trace__find_bpf_map_by_namecalls underHAVE_LIBBPF_SUPPORTifdef and add make test for this.Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-trace.c | 54 ++++++++++++++++++++++++-------------- tools/perf/tests/make | 1 + 2 files changed, 35 insertions(+), 20 deletions(-)tools/perf/builtin-trace.c +34
-20@@ -3174,6 +3174,26 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) }#ifdef HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) +{ +if (trace->bpf_obj ==NULL ) +return NULL ; + +return bpf_object__find_map_by_name (trace->bpf_obj, name); +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace) +{ + trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); +} + +static void trace__set_bpf_map_syscalls (struct trace *trace) +{ + trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); + trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); + trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); +} +static struct bpf_program *trace__find_bpf_program_by_title (struct trace *trace,const char *name) {if (trace->bpf_obj ==NULL )@@ -3512,6 +3532,20 @@ static void trace__delete_augmented_syscalls(struct trace *trace) trace->bpf_obj = NULL; }#else // HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace__maybe_unused , +const char *name__maybe_unused ) +{ +return NULL ; +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace__maybe_unused ) +{ +} + +static void trace__set_bpf_map_syscalls (struct trace *trace__maybe_unused ) +{ +} +static int trace__set_ev_qualifier_bpf_filter (struct trace *trace__maybe_unused ) {return 0 ;@@ -4600,26 +4634,6 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int ureturn 0 ; } -static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) -{ -if (trace->bpf_obj ==NULL ) -return NULL ; - -return bpf_object__find_map_by_name (trace->bpf_obj, name); -} - -static void trace__set_bpf_map_filtered_pids (struct trace *trace) -{ - trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); -} - -static void trace__set_bpf_map_syscalls (struct trace *trace) -{ - trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); - trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); - trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); -} -static int trace__config (const char *var,const char *value,void *arg) {struct trace *trace = arg;tools/perf/tests/make +1
-0@@ -84,6 +84,7 @@ make_no_libaudit := NO_LIBAUDIT=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 +make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 make_no_libcrypto := NO_LIBCRYPTO=1 make_with_babeltrace:= LIBBABELTRACE=1 make_no_sdt := NO_SDT=1Signature · 1 line
2.25.4Signature · 1 line
- Arnaldo
Em Mon, May 18, 2020 at 04:35:28PM +0200, Jiri Olsa escreveu:
Quoted 10 lines · Arnaldo Carvalho de Melo
Quoted 6 lines
Em Mon, May 18, 2020 at 04:10:27PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
I haven't tested if this breaks some perf trace functionality, hence RFC ;-)
Thanks for the patch, looks ok, applying, please let me know if you need to do something else with it.
just wasn't sure the hook will work with NULL,
so if you're ok with it, then it's ok ;-)
I looked at the places leading into that, should be ok :-)
- Arnaldo
Quoted 129 lines
thanks,
jirkaQuoted 125 lines
- Arnaldo
Quoted 117 lines
The perf compilation fails for NO_LIBBPF=1 DEBUG=1 with:
$ make NO_LIBBPF=1 DEBUG=1 BUILD: Doing 'make -j8' parallel build CC builtin-trace.o LD perf-in.o LINK perf /usr/bin/ld: perf-in.o: in function `trace__find_bpf_map_by_name': /home/jolsa/kernel/linux-perf/tools/perf/builtin-trace.c:4608: undefined reference to `bpf_object__find_map_by_name' collect2: error: ld returned 1 exit status make[2]: *** [Makefile.perf:631: perf] Error 1 make[1]: *** [Makefile.perf:225: sub-make] Error 2 make: *** [Makefile:70: all] Error 2Moving
trace__find_bpf_map_by_namecalls underHAVE_LIBBPF_SUPPORTifdef and add make test for this.Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-trace.c | 54 ++++++++++++++++++++++++-------------- tools/perf/tests/make | 1 + 2 files changed, 35 insertions(+), 20 deletions(-)tools/perf/builtin-trace.c +34
-20@@ -3174,6 +3174,26 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) }#ifdef HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) +{ +if (trace->bpf_obj ==NULL ) +return NULL ; + +return bpf_object__find_map_by_name (trace->bpf_obj, name); +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace) +{ + trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); +} + +static void trace__set_bpf_map_syscalls (struct trace *trace) +{ + trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); + trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); + trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); +} +static struct bpf_program *trace__find_bpf_program_by_title (struct trace *trace,const char *name) {if (trace->bpf_obj ==NULL )@@ -3512,6 +3532,20 @@ static void trace__delete_augmented_syscalls(struct trace *trace) trace->bpf_obj = NULL; }#else // HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace__maybe_unused , +const char *name__maybe_unused ) +{ +return NULL ; +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace__maybe_unused ) +{ +} + +static void trace__set_bpf_map_syscalls (struct trace *trace__maybe_unused ) +{ +} +static int trace__set_ev_qualifier_bpf_filter (struct trace *trace__maybe_unused ) {return 0 ;@@ -4600,26 +4634,6 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int ureturn 0 ; } -static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) -{ -if (trace->bpf_obj ==NULL ) -return NULL ; - -return bpf_object__find_map_by_name (trace->bpf_obj, name); -} - -static void trace__set_bpf_map_filtered_pids (struct trace *trace) -{ - trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); -} - -static void trace__set_bpf_map_syscalls (struct trace *trace) -{ - trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); - trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); - trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); -} -static int trace__config (const char *var,const char *value,void *arg) {struct trace *trace = arg;tools/perf/tests/make +1
-0@@ -84,6 +84,7 @@ make_no_libaudit := NO_LIBAUDIT=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 +make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 make_no_libcrypto := NO_LIBCRYPTO=1 make_with_babeltrace:= LIBBABELTRACE=1 make_no_sdt := NO_SDT=1Signature · 1 line
2.25.4Signature · 1 line
- Arnaldo
Signature · 1 line
- Arnaldo
Em Mon, May 18, 2020 at 04:35:28PM +0200, Jiri Olsa escreveu:
Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 4 lines
Em Mon, May 18, 2020 at 04:10:27PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
I haven't tested if this breaks some perf trace functionality, hence RFC ;-)
Quoted 8 lines
Quoted 2 lines
Thanks for the patch, looks ok, applying, please let me know if you need to do something else with it.
just wasn't sure the hook will work with NULL,
so if you're ok with it, then it's ok ;-)thanks,
jirka
you forgot this, right?
tools/perf/tests/make +1 -0
@@ -145,6 +145,7 @@ run += make_no_libaudit run += make_no_libbionic run += make_no_auxtrace run += make_no_libbpf +run += make_no_libbpf_DEBUG run += make_with_babeltrace run += make_with_clangllvm run += make_help
Quoted 126 lines
Quoted 125 lines
- Arnaldo
Quoted 117 lines
The perf compilation fails for NO_LIBBPF=1 DEBUG=1 with:
$ make NO_LIBBPF=1 DEBUG=1 BUILD: Doing 'make -j8' parallel build CC builtin-trace.o LD perf-in.o LINK perf /usr/bin/ld: perf-in.o: in function `trace__find_bpf_map_by_name': /home/jolsa/kernel/linux-perf/tools/perf/builtin-trace.c:4608: undefined reference to `bpf_object__find_map_by_name' collect2: error: ld returned 1 exit status make[2]: *** [Makefile.perf:631: perf] Error 1 make[1]: *** [Makefile.perf:225: sub-make] Error 2 make: *** [Makefile:70: all] Error 2Moving
trace__find_bpf_map_by_namecalls underHAVE_LIBBPF_SUPPORTifdef and add make test for this.Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-trace.c | 54 ++++++++++++++++++++++++-------------- tools/perf/tests/make | 1 + 2 files changed, 35 insertions(+), 20 deletions(-)tools/perf/builtin-trace.c +34
-20@@ -3174,6 +3174,26 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) }#ifdef HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) +{ +if (trace->bpf_obj ==NULL ) +return NULL ; + +return bpf_object__find_map_by_name (trace->bpf_obj, name); +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace) +{ + trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); +} + +static void trace__set_bpf_map_syscalls (struct trace *trace) +{ + trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); + trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); + trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); +} +static struct bpf_program *trace__find_bpf_program_by_title (struct trace *trace,const char *name) {if (trace->bpf_obj ==NULL )@@ -3512,6 +3532,20 @@ static void trace__delete_augmented_syscalls(struct trace *trace) trace->bpf_obj = NULL; }#else // HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace__maybe_unused , +const char *name__maybe_unused ) +{ +return NULL ; +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace__maybe_unused ) +{ +} + +static void trace__set_bpf_map_syscalls (struct trace *trace__maybe_unused ) +{ +} +static int trace__set_ev_qualifier_bpf_filter (struct trace *trace__maybe_unused ) {return 0 ;@@ -4600,26 +4634,6 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int ureturn 0 ; } -static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) -{ -if (trace->bpf_obj ==NULL ) -return NULL ; - -return bpf_object__find_map_by_name (trace->bpf_obj, name); -} - -static void trace__set_bpf_map_filtered_pids (struct trace *trace) -{ - trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); -} - -static void trace__set_bpf_map_syscalls (struct trace *trace) -{ - trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); - trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); - trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); -} -static int trace__config (const char *var,const char *value,void *arg) {struct trace *trace = arg;tools/perf/tests/make +1
-0@@ -84,6 +84,7 @@ make_no_libaudit := NO_LIBAUDIT=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 +make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 make_no_libcrypto := NO_LIBCRYPTO=1 make_with_babeltrace:= LIBBABELTRACE=1 make_no_sdt := NO_SDT=1Signature · 1 line
2.25.4Signature · 1 line
- Arnaldo
Signature · 1 line
- Arnaldo
Quoted 9 lines · Arnaldo Carvalho de Melo
Em Mon, May 18, 2020 at 04:35:28PM +0200, Jiri Olsa escreveu:
Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 6 lines
Em Mon, May 18, 2020 at 04:10:27PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
I haven't tested if this breaks some perf trace functionality, hence RFC ;-)
Thanks for the patch, looks ok, applying, please let me know if you need to do something else with it.
Quoted 7 lines
Quoted 5 lines
just wasn't sure the hook will work with NULL,
so if you're ok with it, then it's ok ;-)thanks,
jirkayou forgot this, right?
ugh yea.. I did not test the test :-\ sry
jirka
Quoted 146 lines
tools/perf/tests/make +1
-0@@ -145,6 +145,7 @@ run += make_no_libaudit run += make_no_libbionic run += make_no_auxtrace run += make_no_libbpf +run += make_no_libbpf_DEBUG run += make_with_babeltrace run += make_with_clangllvm run += make_helpQuoted 127 lines
Quoted 126 lines
- Arnaldo
Quoted 117 lines
The perf compilation fails for NO_LIBBPF=1 DEBUG=1 with:
$ make NO_LIBBPF=1 DEBUG=1 BUILD: Doing 'make -j8' parallel build CC builtin-trace.o LD perf-in.o LINK perf /usr/bin/ld: perf-in.o: in function `trace__find_bpf_map_by_name': /home/jolsa/kernel/linux-perf/tools/perf/builtin-trace.c:4608: undefined reference to `bpf_object__find_map_by_name' collect2: error: ld returned 1 exit status make[2]: *** [Makefile.perf:631: perf] Error 1 make[1]: *** [Makefile.perf:225: sub-make] Error 2 make: *** [Makefile:70: all] Error 2Moving
trace__find_bpf_map_by_namecalls underHAVE_LIBBPF_SUPPORTifdef and add make test for this.Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-trace.c | 54 ++++++++++++++++++++++++-------------- tools/perf/tests/make | 1 + 2 files changed, 35 insertions(+), 20 deletions(-)tools/perf/builtin-trace.c +34
-20@@ -3174,6 +3174,26 @@ static int trace__set_ev_qualifier_tp_filter(struct trace *trace) }#ifdef HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) +{ +if (trace->bpf_obj ==NULL ) +return NULL ; + +return bpf_object__find_map_by_name (trace->bpf_obj, name); +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace) +{ + trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); +} + +static void trace__set_bpf_map_syscalls (struct trace *trace) +{ + trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); + trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); + trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); +} +static struct bpf_program *trace__find_bpf_program_by_title (struct trace *trace,const char *name) {if (trace->bpf_obj ==NULL )@@ -3512,6 +3532,20 @@ static void trace__delete_augmented_syscalls(struct trace *trace) trace->bpf_obj = NULL; }#else // HAVE_LIBBPF_SUPPORT +static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace__maybe_unused , +const char *name__maybe_unused ) +{ +return NULL ; +} + +static void trace__set_bpf_map_filtered_pids (struct trace *trace__maybe_unused ) +{ +} + +static void trace__set_bpf_map_syscalls (struct trace *trace__maybe_unused ) +{ +} +static int trace__set_ev_qualifier_bpf_filter (struct trace *trace__maybe_unused ) {return 0 ;@@ -4600,26 +4634,6 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int ureturn 0 ; } -static struct bpf_map *trace__find_bpf_map_by_name (struct trace *trace,const char *name) -{ -if (trace->bpf_obj ==NULL ) -return NULL ; - -return bpf_object__find_map_by_name (trace->bpf_obj, name); -} - -static void trace__set_bpf_map_filtered_pids (struct trace *trace) -{ - trace->filter_pids.map =trace__find_bpf_map_by_name (trace,"pids_filtered" ); -} - -static void trace__set_bpf_map_syscalls (struct trace *trace) -{ - trace->syscalls.map =trace__find_bpf_map_by_name (trace,"syscalls" ); - trace->syscalls.prog_array.sys_enter =trace__find_bpf_map_by_name (trace,"syscalls_sys_enter" ); - trace->syscalls.prog_array.sys_exit =trace__find_bpf_map_by_name (trace,"syscalls_sys_exit" ); -} -static int trace__config (const char *var,const char *value,void *arg) {struct trace *trace = arg;tools/perf/tests/make +1
-0@@ -84,6 +84,7 @@ make_no_libaudit := NO_LIBAUDIT=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 +make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 make_no_libcrypto := NO_LIBCRYPTO=1 make_with_babeltrace:= LIBBABELTRACE=1 make_no_sdt := NO_SDT=1Signature · 1 line
2.25.4Signature · 1 line
- ArnaldoSignature · 1 line
- Arnaldo