linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix compile error for x86
@ 2022-08-22  9:25 Yang Jihong
  2022-08-22 10:37 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Yang Jihong @ 2022-08-22  9:25 UTC (permalink / raw)
  To: bp, ndesaulniers, nathan, alexandre.belloni, mingo, acme,
	namhyung, jolsa, linux-perf-users, linux-kernel

Commit a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO") eradicates
CC_HAS_ASM_GOTO, perf on x86 call asm_volatile_goto when compiling __GEN_RMWcc.
However, asm_volatile_goto is not declared, which causes compilation error:

In file included from /home/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:7,
                 from /home/linux/tools/include/asm/atomic.h:6,
                 from /home/linux/tools/include/linux/atomic.h:5,
                 from /home/linux/tools/include/linux/refcount.h:41,
                 from /home/linux/tools/lib/perf/include/internal/cpumap.h:5,
                 from /home/linux/tools/perf/util/cpumap.h:7,
                 from /home/linux/tools/perf/util/env.h:7,
                 from /home/linux/tools/perf/util/header.h:12,
                 from pmu-events/pmu-events.c:9:
/home/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h: In function ‘atomic_dec_and_test’:
/home/linux/tools/include/asm/../../arch/x86/include/asm/rmwcc.h:7:2: error: implicit declaration of function ‘asm_volatile_goto’ [-Werror=implicit-function-declaration]
  asm_volatile_goto (fullop "; j" cc " %l[cc_label]"  \
  ^~~~~~~~~~~~~~~~~

Solution:
Define asm_volatile_goto in compiler_types.h if not declared.

Currently, only x86 architecture uses asm_volatile_goto.
Theoretically, this patch affects only the x86 architecture.

Fixes: a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/include/linux/compiler_types.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/compiler_types.h
index 24ae3054f304..1bdd834bdd57 100644
--- a/tools/include/linux/compiler_types.h
+++ b/tools/include/linux/compiler_types.h
@@ -36,4 +36,8 @@
 #include <linux/compiler-gcc.h>
 #endif
 
+#ifndef asm_volatile_goto
+#define asm_volatile_goto(x...) asm goto(x)
+#endif
+
 #endif /* __LINUX_COMPILER_TYPES_H */
-- 
2.30.GIT


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

* Re: [PATCH] perf tools: Fix compile error for x86
  2022-08-22  9:25 [PATCH] perf tools: Fix compile error for x86 Yang Jihong
@ 2022-08-22 10:37 ` Ingo Molnar
  2022-08-22 13:14   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2022-08-22 10:37 UTC (permalink / raw)
  To: Yang Jihong
  Cc: bp, ndesaulniers, nathan, alexandre.belloni, acme, namhyung,
	jolsa, linux-perf-users, linux-kernel


* Yang Jihong <yangjihong1@huawei.com> wrote:

> Commit a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO") eradicates
> CC_HAS_ASM_GOTO, perf on x86 call asm_volatile_goto when compiling __GEN_RMWcc.
> However, asm_volatile_goto is not declared, which causes compilation error:
> 
> In file included from /home/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:7,
>                  from /home/linux/tools/include/asm/atomic.h:6,
>                  from /home/linux/tools/include/linux/atomic.h:5,
>                  from /home/linux/tools/include/linux/refcount.h:41,
>                  from /home/linux/tools/lib/perf/include/internal/cpumap.h:5,
>                  from /home/linux/tools/perf/util/cpumap.h:7,
>                  from /home/linux/tools/perf/util/env.h:7,
>                  from /home/linux/tools/perf/util/header.h:12,
>                  from pmu-events/pmu-events.c:9:
> /home/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h: In function ‘atomic_dec_and_test’:
> /home/linux/tools/include/asm/../../arch/x86/include/asm/rmwcc.h:7:2: error: implicit declaration of function ‘asm_volatile_goto’ [-Werror=implicit-function-declaration]
>   asm_volatile_goto (fullop "; j" cc " %l[cc_label]"  \
>   ^~~~~~~~~~~~~~~~~
> 
> Solution:
> Define asm_volatile_goto in compiler_types.h if not declared.
> 
> Currently, only x86 architecture uses asm_volatile_goto.
> Theoretically, this patch affects only the x86 architecture.
> 
> Fixes: a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
>  tools/include/linux/compiler_types.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/compiler_types.h
> index 24ae3054f304..1bdd834bdd57 100644
> --- a/tools/include/linux/compiler_types.h
> +++ b/tools/include/linux/compiler_types.h
> @@ -36,4 +36,8 @@
>  #include <linux/compiler-gcc.h>
>  #endif
>  
> +#ifndef asm_volatile_goto
> +#define asm_volatile_goto(x...) asm goto(x)
> +#endif

Tested-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

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

* Re: [PATCH] perf tools: Fix compile error for x86
  2022-08-22 10:37 ` Ingo Molnar
@ 2022-08-22 13:14   ` Arnaldo Carvalho de Melo
  2022-08-22 16:45     ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-22 13:14 UTC (permalink / raw)
  To: Linus Torvalds, Ingo Molnar
  Cc: Yang Jihong, bp, ndesaulniers, nathan, alexandre.belloni,
	namhyung, jolsa, linux-perf-users, linux-kernel

Em Mon, Aug 22, 2022 at 12:37:53PM +0200, Ingo Molnar escreveu:
> 
> * Yang Jihong <yangjihong1@huawei.com> wrote:
> 
> > Commit a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO") eradicates
> > CC_HAS_ASM_GOTO, perf on x86 call asm_volatile_goto when compiling __GEN_RMWcc.
> > However, asm_volatile_goto is not declared, which causes compilation error:
> > 
> > In file included from /home/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:7,
> >                  from /home/linux/tools/include/asm/atomic.h:6,
> >                  from /home/linux/tools/include/linux/atomic.h:5,
> >                  from /home/linux/tools/include/linux/refcount.h:41,
> >                  from /home/linux/tools/lib/perf/include/internal/cpumap.h:5,
> >                  from /home/linux/tools/perf/util/cpumap.h:7,
> >                  from /home/linux/tools/perf/util/env.h:7,
> >                  from /home/linux/tools/perf/util/header.h:12,
> >                  from pmu-events/pmu-events.c:9:
> > /home/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h: In function ‘atomic_dec_and_test’:
> > /home/linux/tools/include/asm/../../arch/x86/include/asm/rmwcc.h:7:2: error: implicit declaration of function ‘asm_volatile_goto’ [-Werror=implicit-function-declaration]
> >   asm_volatile_goto (fullop "; j" cc " %l[cc_label]"  \
> >   ^~~~~~~~~~~~~~~~~
> > 
> > Solution:
> > Define asm_volatile_goto in compiler_types.h if not declared.
> > 
> > Currently, only x86 architecture uses asm_volatile_goto.
> > Theoretically, this patch affects only the x86 architecture.
> > 
> > Fixes: a0a12c3ed057 ("asm goto: eradicate CC_HAS_ASM_GOTO")
> > Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> > ---
> >  tools/include/linux/compiler_types.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/compiler_types.h
> > index 24ae3054f304..1bdd834bdd57 100644
> > --- a/tools/include/linux/compiler_types.h
> > +++ b/tools/include/linux/compiler_types.h
> > @@ -36,4 +36,8 @@
> >  #include <linux/compiler-gcc.h>
> >  #endif
> >  
> > +#ifndef asm_volatile_goto
> > +#define asm_volatile_goto(x...) asm goto(x)
> > +#endif
> 
> Tested-by: Ingo Molnar <mingo@kernel.org>

Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Linus, I'll prep a pull req later today or you can apply this so that we
can reduce the window where tools/perf/ isn't building.

- Arnaldo

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

* Re: [PATCH] perf tools: Fix compile error for x86
  2022-08-22 13:14   ` Arnaldo Carvalho de Melo
@ 2022-08-22 16:45     ` Linus Torvalds
  2022-08-22 19:37       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2022-08-22 16:45 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Yang Jihong, bp, ndesaulniers, nathan,
	alexandre.belloni, namhyung, jolsa, linux-perf-users,
	linux-kernel

On Mon, Aug 22, 2022 at 6:14 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Linus, I'll prep a pull req later today or you can apply this so that we
> can reduce the window where tools/perf/ isn't building.

Ok, I took that patch directly. Thanks,

              Linus

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

* Re: [PATCH] perf tools: Fix compile error for x86
  2022-08-22 16:45     ` Linus Torvalds
@ 2022-08-22 19:37       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-22 19:37 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, Yang Jihong, bp, ndesaulniers, nathan,
	alexandre.belloni, namhyung, jolsa, linux-perf-users,
	linux-kernel

Em Mon, Aug 22, 2022 at 09:45:02AM -0700, Linus Torvalds escreveu:
> On Mon, Aug 22, 2022 at 6:14 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > Linus, I'll prep a pull req later today or you can apply this so that we
> > can reduce the window where tools/perf/ isn't building.
> 
> Ok, I took that patch directly. Thanks,

Great, thanks, rebased my local branch, re-tested, all is ok.

- Arnaldo

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

end of thread, other threads:[~2022-08-22 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22  9:25 [PATCH] perf tools: Fix compile error for x86 Yang Jihong
2022-08-22 10:37 ` Ingo Molnar
2022-08-22 13:14   ` Arnaldo Carvalho de Melo
2022-08-22 16:45     ` Linus Torvalds
2022-08-22 19:37       ` Arnaldo Carvalho de Melo

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).