linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] perf skel: Remove some unused variables.
@ 2021-03-06  8:08 Ian Rogers
  2021-03-06  8:08 ` [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs Ian Rogers
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ian Rogers @ 2021-03-06  8:08 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Song Liu, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

Fixes -Wall warnings.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c b/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
index c7cec92d0236..ab12b4c4ece2 100644
--- a/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
+++ b/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
@@ -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 */
-- 
2.30.1.766.gb4fecdf3b7-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs
  2021-03-06  8:08 [PATCH 1/3] perf skel: Remove some unused variables Ian Rogers
@ 2021-03-06  8:08 ` Ian Rogers
  2021-03-06 19:33   ` Song Liu
  2021-03-06  8:08 ` [PATCH 3/3] perf bpf: Minor whitespace cleanup Ian Rogers
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Ian Rogers @ 2021-03-06  8:08 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Song Liu, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

Add -Wall -Werror when compiling BPF skeletons.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5345ac70cd83..f43d2551f3de 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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)
-- 
2.30.1.766.gb4fecdf3b7-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] perf bpf: Minor whitespace cleanup.
  2021-03-06  8:08 [PATCH 1/3] perf skel: Remove some unused variables Ian Rogers
  2021-03-06  8:08 ` [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs Ian Rogers
@ 2021-03-06  8:08 ` Ian Rogers
  2021-03-06 19:34   ` Song Liu
  2021-03-06 12:49 ` [PATCH 1/3] perf skel: Remove some unused variables Arnaldo Carvalho de Melo
  2021-03-06 19:33 ` Song Liu
  3 siblings, 1 reply; 7+ messages in thread
From: Ian Rogers @ 2021-03-06  8:08 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Song Liu, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

Missed space after #include.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/bpf_counter.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/bpf_counter.h b/tools/perf/util/bpf_counter.h
index 2eca210e5dc1..cb9c532e0a07 100644
--- a/tools/perf/util/bpf_counter.h
+++ b/tools/perf/util/bpf_counter.h
@@ -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)
-- 
2.30.1.766.gb4fecdf3b7-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] perf skel: Remove some unused variables.
  2021-03-06  8:08 [PATCH 1/3] perf skel: Remove some unused variables Ian Rogers
  2021-03-06  8:08 ` [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs Ian Rogers
  2021-03-06  8:08 ` [PATCH 3/3] perf bpf: Minor whitespace cleanup Ian Rogers
@ 2021-03-06 12:49 ` Arnaldo Carvalho de Melo
  2021-03-06 19:33 ` Song Liu
  3 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-03-06 12:49 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Song Liu, linux-kernel,
	Stephane Eranian

Em Sat, Mar 06, 2021 at 12:08:38AM -0800, Ian Rogers escreveu:
> 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
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c b/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> index c7cec92d0236..ab12b4c4ece2 100644
> --- a/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> +++ b/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> @@ -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 */
> -- 
> 2.30.1.766.gb4fecdf3b7-goog
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] perf skel: Remove some unused variables.
  2021-03-06  8:08 [PATCH 1/3] perf skel: Remove some unused variables Ian Rogers
                   ` (2 preceding siblings ...)
  2021-03-06 12:49 ` [PATCH 1/3] perf skel: Remove some unused variables Arnaldo Carvalho de Melo
@ 2021-03-06 19:33 ` Song Liu
  3 siblings, 0 replies; 7+ messages in thread
From: Song Liu @ 2021-03-06 19:33 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-kernel, Stephane Eranian



> On Mar 6, 2021, at 12:08 AM, Ian Rogers <irogers@google.com> wrote:
> 
> Fixes -Wall warnings.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>

Acked-by: Song Liu <songliubraving@fb.com>

Thanks for the clean up!

> ---
> tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c b/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> index c7cec92d0236..ab12b4c4ece2 100644
> --- a/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> +++ b/tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> @@ -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 */
> -- 
> 2.30.1.766.gb4fecdf3b7-goog
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs
  2021-03-06  8:08 ` [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs Ian Rogers
@ 2021-03-06 19:33   ` Song Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Song Liu @ 2021-03-06 19:33 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-kernel, Stephane Eranian



> On Mar 6, 2021, at 12:08 AM, Ian Rogers <irogers@google.com> wrote:
> 
> Add -Wall -Werror when compiling BPF skeletons.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>

Acked-by: Song Liu <songliubraving@fb.com>

> ---
> tools/perf/Makefile.perf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 5345ac70cd83..f43d2551f3de 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -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)
> -- 
> 2.30.1.766.gb4fecdf3b7-goog
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] perf bpf: Minor whitespace cleanup.
  2021-03-06  8:08 ` [PATCH 3/3] perf bpf: Minor whitespace cleanup Ian Rogers
@ 2021-03-06 19:34   ` Song Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Song Liu @ 2021-03-06 19:34 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-kernel, Stephane Eranian



> On Mar 6, 2021, at 12:08 AM, Ian Rogers <irogers@google.com> wrote:
> 
> Missed space after #include.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>

Acked-by: Song Liu <songliubraving@fb.com>

> ---
> tools/perf/util/bpf_counter.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/bpf_counter.h b/tools/perf/util/bpf_counter.h
> index 2eca210e5dc1..cb9c532e0a07 100644
> --- a/tools/perf/util/bpf_counter.h
> +++ b/tools/perf/util/bpf_counter.h
> @@ -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)
> -- 
> 2.30.1.766.gb4fecdf3b7-goog
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-06 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-06  8:08 [PATCH 1/3] perf skel: Remove some unused variables Ian Rogers
2021-03-06  8:08 ` [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs Ian Rogers
2021-03-06 19:33   ` Song Liu
2021-03-06  8:08 ` [PATCH 3/3] perf bpf: Minor whitespace cleanup Ian Rogers
2021-03-06 19:34   ` Song Liu
2021-03-06 12:49 ` [PATCH 1/3] perf skel: Remove some unused variables Arnaldo Carvalho de Melo
2021-03-06 19:33 ` Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).