Skip to contentSkip to conversation

perf python: Fix up the build on architectures without HAVE_KVM_STAT_SUPPORT

PATCH In review Arnaldo Carvalho de Melo 2 participants 5 messages Oct 23, 2024 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 perf python: Fix up the build on architectures without HAVE_KVM_STAT_SUPPORT

Noticed while building on a raspbian arm 32-bit system.

There was also this other case, fixed by adding a missing util/stat.h with the prototypes:

/tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1396:6: error: no previous prototype for ‘perf_stat__set_no_csv_summary’ [-Werror=missing-prototypes]
1396 | void perf_stat__set_no_csv_summary(int set __maybe_unused)

        |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1400:6: error: no previous prototype for ‘perf_stat__set_big_num’ [-Werror=missing-prototypes]
   1400 | void perf_stat__set_big_num(int set __maybe_unused)
        |      ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

In other architectures this must be building due to some lucky indirect inclusion of that header.

Fixes 9dabf4003423c8d3 ("perf python: Switch module to linking libraries from building source")
Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/util/python.c | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/util/python.c +3 -0
index 31a223eaf8e65fa3..ee3d43a7ba4570f0 100644
@@ -19,6 +19,7 @@
 #include "util/bpf-filter.h"
 #include "util/env.h"
 #include "util/kvm-stat.h"
+#include "util/stat.h"
 #include "util/kwork.h"
 #include "util/sample.h"
 #include "util/lock-contention.h"
@@ -1355,6 +1356,7 @@ PyMODINIT_FUNC PyInit_perf(void)
 
 unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
 
+#ifdef HAVE_KVM_STAT_SUPPORT
 bool kvm_entry_event(struct evsel *evsel __maybe_unused)
 {
 	return false;
@@ -1384,6 +1386,7 @@ void exit_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused,
 			   char *decode __maybe_unused)
 {
 }
+#endif // HAVE_KVM_STAT_SUPPORT
 
 int find_scripts(char **scripts_array  __maybe_unused, char **scripts_path_array  __maybe_unused,
 		int num  __maybe_unused, int pathlen __maybe_unused)
Signature · 1 line
2.46.0
reviewer
#1 lore raw
Quoted 17 lines · Arnaldo Carvalho de Melo

Noticed while building on a raspbian arm 32-bit system.

There was also this other case, fixed by adding a missing util/stat.h with the prototypes:

/tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1396:6: error: no previous prototype for ‘perf_stat__set_no_csv_summary’ [-Werror=missing-prototypes]
1396 | void perf_stat__set_no_csv_summary(int set __maybe_unused)

        |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1400:6: error: no previous prototype for ‘perf_stat__set_big_num’ [-Werror=missing-prototypes]
   1400 | void perf_stat__set_big_num(int set __maybe_unused)
        |      ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

In other architectures this must be building due to some lucky indirect inclusion of that header.

Quoted 7 lines
Fixes 9dabf4003423c8d3 ("perf python: Switch module to linking libraries from building source")
Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>

So this will at least conflict with:
https://lore.kernel.org/lkml/[email protected]/
where the #ifdef-ed out functions are removed. Does that series fix the ARM32 issue? Could we land that?

Thanks,
Ian

Quoted 35 lines
---
 tools/perf/util/python.c | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/util/python.c +3 -1
index 31a223eaf8e65fa3..ee3d43a7ba4570f0 100644
@@ -19,6 +19,7 @@
 #include "util/bpf-filter.h"
 #include "util/env.h"
 #include "util/kvm-stat.h"
+#include "util/stat.h"
 #include "util/kwork.h"
 #include "util/sample.h"
 #include "util/lock-contention.h"
@@ -1355,6 +1356,7 @@ PyMODINIT_FUNC PyInit_perf(void)
 
 unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
 
+#ifdef HAVE_KVM_STAT_SUPPORT
 bool kvm_entry_event(struct evsel *evsel __maybe_unused)
 {
        return false;
@@ -1384,6 +1386,7 @@ void exit_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused,
                           char *decode __maybe_unused)
 {
 }
+#endif // HAVE_KVM_STAT_SUPPORT
 
 int find_scripts(char **scripts_array  __maybe_unused, char **scripts_path_array  __maybe_unused,
                int num  __maybe_unused, int pathlen __maybe_unused)
--

2.46.0

author maintainer
#2 lore raw
Quoted 27 lines · Ian Rogers
Quoted 17 lines · Arnaldo Carvalho de Melo

Noticed while building on a raspbian arm 32-bit system.

There was also this other case, fixed by adding a missing util/stat.h with the prototypes:

/tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1396:6: error: no previous prototype for ‘perf_stat__set_no_csv_summary’ [-Werror=missing-prototypes]
1396 | void perf_stat__set_no_csv_summary(int set __maybe_unused)

        |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1400:6: error: no previous prototype for ‘perf_stat__set_big_num’ [-Werror=missing-prototypes]
   1400 | void perf_stat__set_big_num(int set __maybe_unused)
        |      ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

In other architectures this must be building due to some lucky indirect inclusion of that header.

Quoted 7 lines
Fixes 9dabf4003423c8d3 ("perf python: Switch module to linking libraries from building source")
Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>
Quoted 4 lines

So this will at least conflict with:
https://lore.kernel.org/lkml/[email protected]/
where the #ifdef-ed out functions are removed. Does that series fix the ARM32 issue? Could we land that?

I'd prefer to have what I posted for perf-tools, as it is smaller, and to land the patch removing those functions on perf-tools-next.

I'll try to switch testing to a librecomputer board, the rpi3 is super slow :-)

Thanks,

- Arnaldo

reviewer Reviewed-by
#3 lore raw
Quoted 29 lines · Arnaldo Carvalho de Melo
Quoted 27 lines · Ian Rogers
Quoted 24 lines · Arnaldo Carvalho de Melo

Noticed while building on a raspbian arm 32-bit system.

There was also this other case, fixed by adding a missing util/stat.h with the prototypes:

/tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1396:6: error: no previous prototype for ‘perf_stat__set_no_csv_summary’ [-Werror=missing-prototypes]
1396 | void perf_stat__set_no_csv_summary(int set __maybe_unused)

        |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/tmp.MbiSHoF3dj/perf-6.12.0-rc3/tools/perf/util/python.c:1400:6: error: no previous prototype for ‘perf_stat__set_big_num’ [-Werror=missing-prototypes]
   1400 | void perf_stat__set_big_num(int set __maybe_unused)
        |      ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

In other architectures this must be building due to some lucky indirect inclusion of that header.

Fixes 9dabf4003423c8d3 ("perf python: Switch module to linking libraries from building source")
Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>
Quoted 7 lines
Quoted 4 lines

So this will at least conflict with:
https://lore.kernel.org/lkml/[email protected]/
where the #ifdef-ed out functions are removed. Does that series fix the ARM32 issue? Could we land that?

I'd prefer to have what I posted for perf-tools, as it is smaller, and to land the patch removing those functions on perf-tools-next.

Makes sense to me. Have a

should you need it.

Quoted 2 lines

I'll try to switch testing to a librecomputer board, the rpi3 is super slow :-)

Thanks,
Ian

author maintainer
#4 lore raw
Quoted 4 lines · Ian Rogers
Quoted 3 lines · Arnaldo Carvalho de Melo
Quoted 2 lines · Ian Rogers
Quoted 1 line · Arnaldo Carvalho de Melo

Noticed while building on a raspbian arm 32-bit system.

<SNIP>

Quoted 13 lines
Quoted 12 lines
Quoted 12 lines
Quoted 7 lines
Fixes 9dabf4003423c8d3 ("perf python: Switch module to linking libraries from building source")
Cc Adrian Hunter <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>

So this will at least conflict with:
https://lore.kernel.org/lkml/[email protected]/
where the #ifdef-ed out functions are removed. Does that series fix the ARM32 issue? Could we land that?

Quoted 6 lines
Quoted 2 lines

I'd prefer to have what I posted for perf-tools, as it is smaller, and to land the patch removing those functions on perf-tools-next.

Makes sense to me. Have a

should you need it.

Always appreciated, thanks, applying it to the patch,

- Arnaldo

Quoted 2 lines
Quoted 2 lines

I'll try to switch testing to a librecomputer board, the rpi3 is super slow :-)