All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix compilation on powerpc
@ 2021-09-28 19:52 Jiri Olsa
  2021-09-28 20:39 ` Mark Wielaard
  2021-09-30 10:03 ` kajoljain
  0 siblings, 2 replies; 5+ messages in thread
From: Jiri Olsa @ 2021-09-28 19:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Mark Wielaard, Sukadev Bhattiprolu, lkml, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Namhyung Kim, Alexander Shishkin,
	Michael Petlan, Ian Rogers, linux-perf-users

Got following build fail on powerpc:

    CC      arch/powerpc/util/skip-callchain-idx.o
  In function ‘check_return_reg’,
      inlined from ‘check_return_addr’ at arch/powerpc/util/skip-callchain-idx.c:213:7,
      inlined from ‘arch_skip_callchain_idx’ at arch/powerpc/util/skip-callchain-idx.c:265:7:
  arch/powerpc/util/skip-callchain-idx.c:54:18: error: ‘dwarf_frame_register’ accessing 96 bytes \
  in a region of size 64 [-Werror=stringop-overflow=]
     54 |         result = dwarf_frame_register(frame, ra_regno, ops_mem, &ops, &nops);
        |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/powerpc/util/skip-callchain-idx.c: In function ‘arch_skip_callchain_idx’:
  arch/powerpc/util/skip-callchain-idx.c:54:18: note: referencing argument 3 of type ‘Dwarf_Op *’
  In file included from /usr/include/elfutils/libdwfl.h:32,
                   from arch/powerpc/util/skip-callchain-idx.c:10:
  /usr/include/elfutils/libdw.h:1069:12: note: in a call to function ‘dwarf_frame_register’
   1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
        |            ^~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

The dwarf_frame_register args changed with [1],
Updating ops_mem accordingly.

[1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=5621fe5443da23112170235dd5cac161e5c75e65

Cc: Mark Wielaard <mjw@redhat.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
index 3018a054526a..20cd6244863b 100644
--- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
+++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
@@ -45,7 +45,7 @@ static const Dwfl_Callbacks offline_callbacks = {
  */
 static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
 {
-	Dwarf_Op ops_mem[2];
+	Dwarf_Op ops_mem[3];
 	Dwarf_Op dummy;
 	Dwarf_Op *ops = &dummy;
 	size_t nops;
-- 
2.31.1


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

* Re: [PATCH] perf tools: Fix compilation on powerpc
  2021-09-28 19:52 [PATCH] perf tools: Fix compilation on powerpc Jiri Olsa
@ 2021-09-28 20:39 ` Mark Wielaard
  2021-10-27 19:59   ` Arnaldo Carvalho de Melo
  2021-09-30 10:03 ` kajoljain
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2021-09-28 20:39 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Sukadev Bhattiprolu, lkml,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Michael Petlan, Ian Rogers, linux-perf-users

Hi,

On Tue, Sep 28, 2021 at 09:52:53PM +0200, Jiri Olsa wrote:
> Got following build fail on powerpc:
> 
>     CC      arch/powerpc/util/skip-callchain-idx.o
>   In function ‘check_return_reg’,
>       inlined from ‘check_return_addr’ at arch/powerpc/util/skip-callchain-idx.c:213:7,
>       inlined from ‘arch_skip_callchain_idx’ at arch/powerpc/util/skip-callchain-idx.c:265:7:
>   arch/powerpc/util/skip-callchain-idx.c:54:18: error: ‘dwarf_frame_register’ accessing 96 bytes \
>   in a region of size 64 [-Werror=stringop-overflow=]
>      54 |         result = dwarf_frame_register(frame, ra_regno, ops_mem, &ops, &nops);
>         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/powerpc/util/skip-callchain-idx.c: In function ‘arch_skip_callchain_idx’:
>   arch/powerpc/util/skip-callchain-idx.c:54:18: note: referencing argument 3 of type ‘Dwarf_Op *’
>   In file included from /usr/include/elfutils/libdwfl.h:32,
>                    from arch/powerpc/util/skip-callchain-idx.c:10:
>   /usr/include/elfutils/libdw.h:1069:12: note: in a call to function ‘dwarf_frame_register’
>    1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
>         |            ^~~~~~~~~~~~~~~~~~~~
>   cc1: all warnings being treated as errors
> 
> The dwarf_frame_register args changed with [1],
> Updating ops_mem accordingly.
> 
> [1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=5621fe5443da23112170235dd5cac161e5c75e65

The warning (new with GCC11) and the fix are correct.

The code probably worked fine before because the next var on the stack
was the dummy Dwarf_Op which would have been as if the ops_mem[2] was
actually ops_mem[3] already. You don't need the dummy var now and
Dwarf_Op *ops doesn't need to be initialized (the dwarf_frame_register
will initialize it).

Note that [1] didn't change the args of the dwarf_frame_register, but
did fix a similar bug in one of the elfutils own tests (and updated
the comment on the function to hopefully be more clear).

Cheers,

Mark

> Cc: Mark Wielaard <mjw@redhat.com>
> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
>  tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> index 3018a054526a..20cd6244863b 100644
> --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> @@ -45,7 +45,7 @@ static const Dwfl_Callbacks offline_callbacks = {
>   */
>  static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
>  {
> -	Dwarf_Op ops_mem[2];
> +	Dwarf_Op ops_mem[3];
>  	Dwarf_Op dummy;
>  	Dwarf_Op *ops = &dummy;
>  	size_t nops;
> -- 
> 2.31.1
> 

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

* Re: [PATCH] perf tools: Fix compilation on powerpc
  2021-09-28 19:52 [PATCH] perf tools: Fix compilation on powerpc Jiri Olsa
  2021-09-28 20:39 ` Mark Wielaard
@ 2021-09-30 10:03 ` kajoljain
  1 sibling, 0 replies; 5+ messages in thread
From: kajoljain @ 2021-09-30 10:03 UTC (permalink / raw)
  To: Jiri Olsa, Arnaldo Carvalho de Melo
  Cc: Mark Wielaard, Sukadev Bhattiprolu, lkml, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Namhyung Kim, Alexander Shishkin,
	Michael Petlan, Ian Rogers, linux-perf-users



On 9/29/21 1:22 AM, Jiri Olsa wrote:
> Got following build fail on powerpc:
> 
>     CC      arch/powerpc/util/skip-callchain-idx.o
>   In function ‘check_return_reg’,
>       inlined from ‘check_return_addr’ at arch/powerpc/util/skip-callchain-idx.c:213:7,
>       inlined from ‘arch_skip_callchain_idx’ at arch/powerpc/util/skip-callchain-idx.c:265:7:
>   arch/powerpc/util/skip-callchain-idx.c:54:18: error: ‘dwarf_frame_register’ accessing 96 bytes \
>   in a region of size 64 [-Werror=stringop-overflow=]
>      54 |         result = dwarf_frame_register(frame, ra_regno, ops_mem, &ops, &nops);
>         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/powerpc/util/skip-callchain-idx.c: In function ‘arch_skip_callchain_idx’:
>   arch/powerpc/util/skip-callchain-idx.c:54:18: note: referencing argument 3 of type ‘Dwarf_Op *’
>   In file included from /usr/include/elfutils/libdwfl.h:32,
>                    from arch/powerpc/util/skip-callchain-idx.c:10:
>   /usr/include/elfutils/libdw.h:1069:12: note: in a call to function ‘dwarf_frame_register’
>    1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
>         |            ^~~~~~~~~~~~~~~~~~~~
>   cc1: all warnings being treated as errors
> 
> The dwarf_frame_register args changed with [1],
> Updating ops_mem accordingly.
> 
> [1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=5621fe5443da23112170235dd5cac161e5c75e65

Hi Jiri,
	Thanks for the patch. I was able to reproduce this issue with gcc11 and
verified that with your change we no longer seeing this error.

Reviewed-by: Kajol Jain<kjain@linux.ibm.com>
Tested-by: Kajol Jain<kjain@linuxibm.com>

Thanks,
Kajol Jain

> 
> Cc: Mark Wielaard <mjw@redhat.com>
> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
>  tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> index 3018a054526a..20cd6244863b 100644
> --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> @@ -45,7 +45,7 @@ static const Dwfl_Callbacks offline_callbacks = {
>   */
>  static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
>  {
> -	Dwarf_Op ops_mem[2];
> +	Dwarf_Op ops_mem[3];
>  	Dwarf_Op dummy;
>  	Dwarf_Op *ops = &dummy;
>  	size_t nops;
> 

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

* Re: [PATCH] perf tools: Fix compilation on powerpc
  2021-09-28 20:39 ` Mark Wielaard
@ 2021-10-27 19:59   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-10-27 19:59 UTC (permalink / raw)
  To: Mark Wielaard
  Cc: Jiri Olsa, Sukadev Bhattiprolu, lkml, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Namhyung Kim, Alexander Shishkin,
	Michael Petlan, Ian Rogers, linux-perf-users

Em Tue, Sep 28, 2021 at 10:39:05PM +0200, Mark Wielaard escreveu:
> Hi,
> 
> On Tue, Sep 28, 2021 at 09:52:53PM +0200, Jiri Olsa wrote:
> > Got following build fail on powerpc:
> > 
> >     CC      arch/powerpc/util/skip-callchain-idx.o
> >   In function ‘check_return_reg’,
> >       inlined from ‘check_return_addr’ at arch/powerpc/util/skip-callchain-idx.c:213:7,
> >       inlined from ‘arch_skip_callchain_idx’ at arch/powerpc/util/skip-callchain-idx.c:265:7:
> >   arch/powerpc/util/skip-callchain-idx.c:54:18: error: ‘dwarf_frame_register’ accessing 96 bytes \
> >   in a region of size 64 [-Werror=stringop-overflow=]
> >      54 |         result = dwarf_frame_register(frame, ra_regno, ops_mem, &ops, &nops);
> >         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >   arch/powerpc/util/skip-callchain-idx.c: In function ‘arch_skip_callchain_idx’:
> >   arch/powerpc/util/skip-callchain-idx.c:54:18: note: referencing argument 3 of type ‘Dwarf_Op *’
> >   In file included from /usr/include/elfutils/libdwfl.h:32,
> >                    from arch/powerpc/util/skip-callchain-idx.c:10:
> >   /usr/include/elfutils/libdw.h:1069:12: note: in a call to function ‘dwarf_frame_register’
> >    1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
> >         |            ^~~~~~~~~~~~~~~~~~~~
> >   cc1: all warnings being treated as errors
> > 
> > The dwarf_frame_register args changed with [1],
> > Updating ops_mem accordingly.
> > 
> > [1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=5621fe5443da23112170235dd5cac161e5c75e65
> 
> The warning (new with GCC11) and the fix are correct.

I'm taking this as an Acked-by, ok?

- Arnaldo
 
> The code probably worked fine before because the next var on the stack
> was the dummy Dwarf_Op which would have been as if the ops_mem[2] was
> actually ops_mem[3] already. You don't need the dummy var now and
> Dwarf_Op *ops doesn't need to be initialized (the dwarf_frame_register
> will initialize it).
> 
> Note that [1] didn't change the args of the dwarf_frame_register, but
> did fix a similar bug in one of the elfutils own tests (and updated
> the comment on the function to hopefully be more clear).
> 
> Cheers,
> 
> Mark
> 
> > Cc: Mark Wielaard <mjw@redhat.com>
> > Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> > ---
> >  tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> > index 3018a054526a..20cd6244863b 100644
> > --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> > +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> > @@ -45,7 +45,7 @@ static const Dwfl_Callbacks offline_callbacks = {
> >   */
> >  static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
> >  {
> > -	Dwarf_Op ops_mem[2];
> > +	Dwarf_Op ops_mem[3];
> >  	Dwarf_Op dummy;
> >  	Dwarf_Op *ops = &dummy;
> >  	size_t nops;
> > -- 
> > 2.31.1
> > 

-- 

- Arnaldo

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

* [PATCH] perf tools: Fix compilation on powerpc
@ 2009-11-24  4:19 Paul Mackerras
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Mackerras @ 2009-11-24  4:19 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Frederic Weisbecker, Arnaldo Carvalho de Melo

Currently, perf fails to compile on powerpc with this error:

    CC util/header.o
In file included from util/../perf.h:17,
                 from util/header.c:9:
util/../../../arch/powerpc/include/asm/unistd.h:360:27: error: linux/linkage.h: No such file or directory
make: *** [util/header.o] Error 1

The reason is that we still have a #define __KERNEL__ in effect at the
point where <asm/unistd.h> gets included, which means we get extra
stuff that we don't need or want.

This fixes the problem by undefining __KERNEL__ once we have included
the file for which we need __KERNEL__ defined.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 tools/perf/util/include/linux/bitops.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
index ace57c3..8d63116 100644
--- a/tools/perf/util/include/linux/bitops.h
+++ b/tools/perf/util/include/linux/bitops.h
@@ -7,6 +7,8 @@
 #define CONFIG_GENERIC_FIND_FIRST_BIT
 #include "../../../../include/linux/bitops.h"
 
+#undef __KERNEL__
+
 static inline void set_bit(int nr, unsigned long *addr)
 {
 	addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);

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

end of thread, other threads:[~2021-10-27 20:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 19:52 [PATCH] perf tools: Fix compilation on powerpc Jiri Olsa
2021-09-28 20:39 ` Mark Wielaard
2021-10-27 19:59   ` Arnaldo Carvalho de Melo
2021-09-30 10:03 ` kajoljain
  -- strict thread matches above, loose matches on Subject: below --
2009-11-24  4:19 Paul Mackerras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.