Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf kvm: move HAVE_KVM_STAT_SUPPORT down
@ 2024-08-09 11:53 Xu Yang
  2024-08-16 17:31 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Xu Yang @ 2024-08-09 11:53 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, kan.liang
  Cc: linux-perf-users, imx

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 "sort.h" for util/python.c.

This will try to move HAVE_KVM_STAT_SUPPORT down, so normal header files
can be exported to source files on other arch too.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 tools/perf/util/kvm-stat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
index 3e9ac754c3d1..92f1191cd462 100644
--- a/tools/perf/util/kvm-stat.h
+++ b/tools/perf/util/kvm-stat.h
@@ -2,8 +2,6 @@
 #ifndef __PERF_KVM_STAT_H
 #define __PERF_KVM_STAT_H
 
-#ifdef HAVE_KVM_STAT_SUPPORT
-
 #include "tool.h"
 #include "sort.h"
 #include "stat.h"
@@ -13,6 +11,8 @@
 #include <stdlib.h>
 #include <linux/zalloc.h>
 
+#ifdef HAVE_KVM_STAT_SUPPORT
+
 #define KVM_EVENT_NAME_LEN	40
 
 struct evsel;
-- 
2.34.1


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

* Re: [PATCH] perf kvm: move HAVE_KVM_STAT_SUPPORT down
  2024-08-09 11:53 [PATCH] perf kvm: move HAVE_KVM_STAT_SUPPORT down Xu Yang
@ 2024-08-16 17:31 ` Namhyung Kim
  2024-08-19  2:14   ` Xu Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2024-08-16 17:31 UTC (permalink / raw)
  To: Xu Yang
  Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, kan.liang, linux-perf-users, imx

On Fri, Aug 09, 2024 at 07:53:35PM +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 "sort.h" for util/python.c.

But it's not intuitive.  I think you can include "util/sample.h" in the
util/python.c.

Thanks,
Namhyung

> 
> This will try to move HAVE_KVM_STAT_SUPPORT down, so normal header files
> can be exported to source files on other arch too.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  tools/perf/util/kvm-stat.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
> index 3e9ac754c3d1..92f1191cd462 100644
> --- a/tools/perf/util/kvm-stat.h
> +++ b/tools/perf/util/kvm-stat.h
> @@ -2,8 +2,6 @@
>  #ifndef __PERF_KVM_STAT_H
>  #define __PERF_KVM_STAT_H
>  
> -#ifdef HAVE_KVM_STAT_SUPPORT
> -
>  #include "tool.h"
>  #include "sort.h"
>  #include "stat.h"
> @@ -13,6 +11,8 @@
>  #include <stdlib.h>
>  #include <linux/zalloc.h>
>  
> +#ifdef HAVE_KVM_STAT_SUPPORT
> +
>  #define KVM_EVENT_NAME_LEN	40
>  
>  struct evsel;
> -- 
> 2.34.1
> 

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

* Re: [PATCH] perf kvm: move HAVE_KVM_STAT_SUPPORT down
  2024-08-16 17:31 ` Namhyung Kim
@ 2024-08-19  2:14   ` Xu Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Xu Yang @ 2024-08-19  2:14 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, kan.liang, linux-perf-users, imx

On Fri, Aug 16, 2024 at 10:31:39AM -0700, Namhyung Kim wrote:
> On Fri, Aug 09, 2024 at 07:53:35PM +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 "sort.h" for util/python.c.
> 
> But it's not intuitive.  I think you can include "util/sample.h" in the
> util/python.c.

Sure. I'll send v2.

Thanks,
Xu Yang

> 
> Thanks,
> Namhyung
> 
> > 
> > This will try to move HAVE_KVM_STAT_SUPPORT down, so normal header files
> > can be exported to source files on other arch too.
> > 
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > ---
> >  tools/perf/util/kvm-stat.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
> > index 3e9ac754c3d1..92f1191cd462 100644
> > --- a/tools/perf/util/kvm-stat.h
> > +++ b/tools/perf/util/kvm-stat.h
> > @@ -2,8 +2,6 @@
> >  #ifndef __PERF_KVM_STAT_H
> >  #define __PERF_KVM_STAT_H
> >  
> > -#ifdef HAVE_KVM_STAT_SUPPORT
> > -
> >  #include "tool.h"
> >  #include "sort.h"
> >  #include "stat.h"
> > @@ -13,6 +11,8 @@
> >  #include <stdlib.h>
> >  #include <linux/zalloc.h>
> >  
> > +#ifdef HAVE_KVM_STAT_SUPPORT
> > +
> >  #define KVM_EVENT_NAME_LEN	40
> >  
> >  struct evsel;
> > -- 
> > 2.34.1
> > 

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

end of thread, other threads:[~2024-08-19  2:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09 11:53 [PATCH] perf kvm: move HAVE_KVM_STAT_SUPPORT down Xu Yang
2024-08-16 17:31 ` Namhyung Kim
2024-08-19  2:14   ` Xu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox