diff mbox series

[v2] perf python: include "util/sample.h"

Message ID 20240819023403.201324-1-xu.yang_2@nxp.com (mailing list archive)
State In Next, archived
Headers show
Series [v2] perf python: include "util/sample.h" | expand

Commit Message

Xu Yang Aug. 19, 2024, 2:34 a.m. UTC
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.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

---
Changes in v2:
 - include "util/sample.h" in "util/python.c"
---
 tools/perf/util/python.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Arnaldo Carvalho de Melo Aug. 19, 2024, 5:44 p.m. UTC | #1
On Mon, Aug 19, 2024 at 10:34:03AM +0800, Xu Yang wrote:
> 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.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> ---
> Changes in v2:
>  - include "util/sample.h" in "util/python.c"

Thanks, applied to perf-tools-next,

- Arnaldo
> ---
>  tools/perf/util/python.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index 3be882b2e845..31a223eaf8e6 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
> @@ -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"
> -- 
> 2.34.1
Ben Hutchings Aug. 25, 2024, 2:21 p.m. UTC | #2
On Mon, 2024-08-19 at 14:44 -0300, Arnaldo Carvalho de Melo wrote:
> On Mon, Aug 19, 2024 at 10:34:03AM +0800, Xu Yang wrote:
> > 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.
> > 
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > 
> > ---
> > 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.
diff mbox series

Patch

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 3be882b2e845..31a223eaf8e6 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -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"