perf skel: Remove some unused variables.
Ian Rogers
reviewerPATCH 1/3 perf skel: Remove some unused variables.
Fixes -Wall warnings.
--- tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c +1 -2
@@ -52,7 +52,7 @@ int BPF_PROG(fentry_XXX)static inline void fexit_update_maps (struct bpf_perf_event_value *after) { -struct bpf_perf_event_value *before, diff, *accum; +struct bpf_perf_event_value *before, diff;__u32 zero =0 ; before =bpf_map_lookup_elem (&fentry_readings, &zero);
@@ -78,7 +78,6 @@ int BPF_PROG(fexit_XXX) {struct bpf_perf_event_value reading;__u32 cpu =bpf_get_smp_processor_id (); -__u32 one =1 , zero =0 ;int err;/* read all events before updating the maps, to reduce error */
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Ian Rogers
reviewerPATCH 2/3 perf tool: Enable warnings when compiling BPF programs
Add -Wall -Werror when compiling BPF skeletons.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -1029,7 +1029,7 @@ $(BPFTOOL): | $(SKEL_TMP_OUT) OUTPUT=$(SKEL_TMP_OUT)/ bootstrap $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) | $(SKEL_TMP_OUT) - $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf $(BPF_INCLUDE) \ + $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -Wall -Werror $(BPF_INCLUDE) \ -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ && $(LLVM_STRIP) -g $@ $(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Re: [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs
Quoted 7 lines · Ian Rogers
Add -Wall -Werror when compiling BPF skeletons.
Signed-off-by Ian Rogers <[email protected]>
Quoted 20 lines
---
tools/perf/Makefile.perf| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/Makefile.perf +1
-1@@ -1029,7 +1029,7 @@ $(BPFTOOL): | $(SKEL_TMP_OUT) OUTPUT=$(SKEL_TMP_OUT)/ bootstrap $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) | $(SKEL_TMP_OUT) - $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf $(BPF_INCLUDE) \ + $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -Wall -Werror $(BPF_INCLUDE) \ -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ && $(LLVM_STRIP) -g $@ $(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Ian Rogers
reviewerPATCH 3/3 perf bpf: Minor whitespace cleanup.
In reply to Ian RogersMissed space after #include.
--- tools/perf/util/bpf_counter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/bpf_counter.h +1 -1
@@ -38,7 +38,7 @@ int bpf_counter__install_pe(struct evsel *evsel, int cpu, int fd);#else /* HAVE_BPF_SKEL */ -#include <linux/err.h> +#include <linux/err.h> static inline int bpf_counter__load (struct evsel *evsel__maybe_unused ,struct target *target__maybe_unused )
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Re: [PATCH 3/3] perf bpf: Minor whitespace cleanup.
Quoted 7 lines · Ian Rogers
Missed space after #include.
Signed-off-by Ian Rogers <[email protected]>
Quoted 20 lines
---
tools/perf/util/bpf_counter.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/bpf_counter.h +1
-1@@ -38,7 +38,7 @@ int bpf_counter__install_pe(struct evsel *evsel, int cpu, int fd);#else /* HAVE_BPF_SKEL */ -#include <linux/err.h> +#include <linux/err.h> static inline int bpf_counter__load (struct evsel *evsel__maybe_unused ,struct target *target__maybe_unused )Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Arnaldo Carvalho de Melo
maintainerEm Sat, Mar 06, 2021 at 12:08:38AM -0800, Ian Rogers escreveu:
Quoted 1 line
Fixes -Wall warnings.
Thanks, tested all with:
$ make BUILD_BPF_SKEL=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin
Which makes me realize we need to turn both python3 and building the bpf skel to be the default...
- Arnaldo
Quoted 29 lines
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c +1
-2@@ -52,7 +52,7 @@ int BPF_PROG(fentry_XXX)static inline void fexit_update_maps (struct bpf_perf_event_value *after) { -struct bpf_perf_event_value *before, diff, *accum; +struct bpf_perf_event_value *before, diff;__u32 zero =0 ; before =bpf_map_lookup_elem (&fentry_readings, &zero);@@ -78,7 +78,6 @@ int BPF_PROG(fexit_XXX) {struct bpf_perf_event_value reading;__u32 cpu =bpf_get_smp_processor_id (); -__u32 one =1 , zero =0 ;int err;/* read all events before updating the maps, to reduce error */ Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Signature · 1 line
- Arnaldo
Quoted 7 lines · Ian Rogers
Fixes -Wall warnings.
Signed-off-by Ian Rogers <[email protected]>
Thanks for the clean up!
Quoted 28 lines
---
tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c +0
-0@@ -52,7 +52,7 @@ int BPF_PROG(fentry_XXX)static inline void
fexit_update_maps(struct bpf_perf_event_value *after){tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c +1
-1-struct bpf_perf_event_value *before, diff, *accum; +struct bpf_perf_event_value *before, diff;__u32 zero = 0; before = bpf_map_lookup_elem(&fentry_readings, &zero);tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c +0
-1@@ -78,7 +78,6 @@ int BPF_PROG(fexit_XXX) {struct bpf_perf_event_value reading;__u32 cpu =bpf_get_smp_processor_id (); -__u32 one =1 , zero =0 ;int err;/* read all events before updating the maps, to reduce error */ Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog