Skip to contentSkip to conversation

perf python: include "util/sample.h"

PATCH Applied Xu Yang 3 participants 3 messages Aug 19, 2024 – Aug 25, 2024

Subsystems (2)
lore
Share & tools
lore

Xu Yang

author
#0 lore raw

PATCH v2 1/1 perf python: include "util/sample.h"

The 32-bit arm build system will complain:

tools/perf/util/python.c:75:28: error: field ‘sample’ has incomplete type
75 | struct perf_sample sample;

However, arm64 build system doesn't complain this.

The root cause is arm64 define "HAVE_KVM_STAT_SUPPORT := 1" in tools/perf/arch/arm64/Makefile, but arm arch doesn't define this. This will lead to kvm-stat.h include other header files on arm64 build system, especially "util/sample.h" for util/python.c.

This will try to directly include "util/sample.h" for "util/python.c" to avoid such build issue on arm platform.

---
Changes in v2:
- include "util/sample.h" in "util/python.c"

---
 tools/perf/util/python.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/python.c +1 -0
index 3be882b2e845..31a223eaf8e6 100644
@@ -20,6 +20,7 @@
 #include "util/env.h"
 #include "util/kvm-stat.h"
 #include "util/kwork.h"
+#include "util/sample.h"
 #include "util/lock-contention.h"
 #include <internal/lib.h>
 #include "../builtin.h"
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 12 lines · Xu Yang

The 32-bit arm build system will complain:

tools/perf/util/python.c:75:28: error: field ‘sample’ has incomplete type
75 | struct perf_sample sample;

However, arm64 build system doesn't complain this.

The root cause is arm64 define "HAVE_KVM_STAT_SUPPORT := 1" in tools/perf/arch/arm64/Makefile, but arm arch doesn't define this. This will lead to kvm-stat.h include other header files on arm64 build system, especially "util/sample.h" for util/python.c.

Quoted 8 lines

This will try to directly include "util/sample.h" for "util/python.c" to avoid such build issue on arm platform.

---
Changes in v2:
- include "util/sample.h" in "util/python.c"

Thanks, applied to perf-tools-next,

- Arnaldo

Quoted 18 lines
---
 tools/perf/util/python.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/python.c +1 -0
index 3be882b2e845..31a223eaf8e6 100644
@@ -20,6 +20,7 @@
 #include "util/env.h"
 #include "util/kvm-stat.h"
 #include "util/kwork.h"
+#include "util/sample.h"
 #include "util/lock-contention.h"
 #include <internal/lib.h>
 #include "../builtin.h"
Signature · 1 line
2.34.1
#2 lore raw
Quoted 16 lines · Arnaldo Carvalho de Melo
Quoted 15 lines · Xu Yang

The 32-bit arm build system will complain:

tools/perf/util/python.c:75:28: error: field ‘sample’ has incomplete type
75 | struct perf_sample sample;

However, arm64 build system doesn't complain this.

The root cause is arm64 define "HAVE_KVM_STAT_SUPPORT := 1" in tools/perf/arch/arm64/Makefile, but arm arch doesn't define this. This will lead to kvm-stat.h include other header files on arm64 build system, especially "util/sample.h" for util/python.c.

This will try to directly include "util/sample.h" for "util/python.c" to avoid such build issue on arm platform.

Quoted 7 lines
Quoted 5 lines

---
Changes in v2:
- include "util/sample.h" in "util/python.c"

Thanks, applied to perf-tools-next,

[...]

This is a regression in 6.11, so the fix should go into the current release cycle, not the next one.

Ben.

Signature · 3 lines
Ben Hutchings
Any smoothly functioning technology is indistinguishable
from a rigged demo.