[backport PATCH 0/2] stable v5.15, v5.10 and v5.4: fix perf build errors

Anders Roxell posted 2 patches 2 years, 8 months ago
tools/build/Makefile.feature                        |  1 +
tools/build/feature/Makefile                        |  4 ++++
tools/build/feature/test-all.c                      |  4 ++++
tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
tools/perf/Makefile.config                          |  8 ++++++++
tools/perf/util/annotate.c                          |  7 ++++---
6 files changed, 34 insertions(+), 3 deletions(-)
create mode 100644 tools/build/feature/test-disassembler-init-styled.c
[backport PATCH 0/2] stable v5.15, v5.10 and v5.4: fix perf build errors
Posted by Anders Roxell 2 years, 8 months ago
Hi,

I would like to see these patches backported. They are needed so perf
can be cross compiled with gcc on v5.15, v5.10 and v5.4.
I built it with tuxmake [1] here are two example commandlines:
tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig defconfig perf
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig defconfig perf

Tried to build perf with both gcc-11 and gcc-12.

Patch 'tools perf: Fix compilation error with new binutils'
and 'tools build: Add feature test for init_disassemble_info API changes'
didn't apply cleanly, thats why I send these in a patchset.

When apply 'tools build: Add feature test for
init_disassemble_info API changes' to 5.4 it will be a minor merge
conflict, do you want me to send this patch in two separate patches one
for 5.4 and another for v5.10?

The sha for these two patches in mainline are.
cfd59ca91467 tools build: Add feature test for init_disassemble_info API changes
83aa0120487e tools perf: Fix compilation error with new binutils

The above patches solves these:
util/annotate.c: In function 'symbol__disassemble_bpf':
util/annotate.c:1729:9: error: too few arguments to function 'init_disassemble_info'
 1729 |         init_disassemble_info(&info, s,
      |         ^~~~~~~~~~~~~~~~~~~~~


Please apply these to v5.10 and v5.4
a45b3d692623 tools include: add dis-asm-compat.h to handle version differences
d08c84e01afa perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK>

The above patches solves these:
/home/anders/src/kernel/stable-5.10/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
   43 |         (void) (&_max1 == &_max2);              \
      |                        ^~
builtin-sched.c:673:34: note: in expansion of macro 'max'
  673 |                         (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
      |                                  ^~~


Please apply these to v5.15, v5.10 and v5.4
8e8bf60a6754 perf build: Fixup disabling of -Wdeprecated-declarations for the python scripting engine
4ee3c4da8b1b perf scripting python: Do not build fail on deprecation warnings
63a4354ae75c perf scripting perl: Ignore some warnings to keep building with perl headers

Build error that the above 3 patches solves are:
/usr/lib/x86_64-linux-gnu/perl/5.36/CORE/handy.h:125:23: error: cast from function call of type 'STRLEN' {aka 'long unsigned int'} to non-matching type '_Bool' [-Werror=bad-function-cast]
  125 | #define cBOOL(cbool) ((bool) (cbool))
      |                       ^

Cheers,
Anders
[1] https://tuxmake.org/

Andres Freund (2):
  tools perf: Fix compilation error with new binutils
  tools build: Add feature test for init_disassemble_info API changes

 tools/build/Makefile.feature                        |  1 +
 tools/build/feature/Makefile                        |  4 ++++
 tools/build/feature/test-all.c                      |  4 ++++
 tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
 tools/perf/Makefile.config                          |  8 ++++++++
 tools/perf/util/annotate.c                          |  7 ++++---
 6 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 tools/build/feature/test-disassembler-init-styled.c

--
2.39.2
Re: [backport PATCH 0/2] stable v5.15, v5.10 and v5.4: fix perf build errors
Posted by Greg KH 2 years, 8 months ago
On Mon, Apr 17, 2023 at 02:29:41PM +0200, Anders Roxell wrote:
> Hi,
> 
> I would like to see these patches backported. They are needed so perf
> can be cross compiled with gcc on v5.15, v5.10 and v5.4.
> I built it with tuxmake [1] here are two example commandlines:
> tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig defconfig perf
> tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig defconfig perf
> 
> Tried to build perf with both gcc-11 and gcc-12.
> 
> Patch 'tools perf: Fix compilation error with new binutils'
> and 'tools build: Add feature test for init_disassemble_info API changes'
> didn't apply cleanly, thats why I send these in a patchset.
> 
> When apply 'tools build: Add feature test for
> init_disassemble_info API changes' to 5.4 it will be a minor merge
> conflict, do you want me to send this patch in two separate patches one
> for 5.4 and another for v5.10?
> 
> The sha for these two patches in mainline are.
> cfd59ca91467 tools build: Add feature test for init_disassemble_info API changes
> 83aa0120487e tools perf: Fix compilation error with new binutils
> 
> The above patches solves these:
> util/annotate.c: In function 'symbol__disassemble_bpf':
> util/annotate.c:1729:9: error: too few arguments to function 'init_disassemble_info'
>  1729 |         init_disassemble_info(&info, s,
>       |         ^~~~~~~~~~~~~~~~~~~~~
> 
> 
> Please apply these to v5.10 and v5.4
> a45b3d692623 tools include: add dis-asm-compat.h to handle version differences
> d08c84e01afa perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK>
> 
> The above patches solves these:
> /home/anders/src/kernel/stable-5.10/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
>    43 |         (void) (&_max1 == &_max2);              \
>       |                        ^~
> builtin-sched.c:673:34: note: in expansion of macro 'max'
>   673 |                         (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
>       |                                  ^~~
> 
> 
> Please apply these to v5.15, v5.10 and v5.4
> 8e8bf60a6754 perf build: Fixup disabling of -Wdeprecated-declarations for the python scripting engine
> 4ee3c4da8b1b perf scripting python: Do not build fail on deprecation warnings
> 63a4354ae75c perf scripting perl: Ignore some warnings to keep building with perl headers

Can you please provide patch series of these upstream commits backported
to the relevant branchs that you wish to see them in?  You have 2
patches in this series without git commit ids, and I have no idea where
to apply them, or not apply them...

Or better yet, just use the latest version of perf as was pointed out,
on these old kernel releases.

thanks,

greg k-h
Re: [backport PATCH 0/2] stable v5.15, v5.10 and v5.4: fix perf build errors
Posted by Anders Roxell 2 years, 8 months ago
On Tue, 18 Apr 2023 at 11:04, Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, Apr 17, 2023 at 02:29:41PM +0200, Anders Roxell wrote:
> > Hi,
> >
> > I would like to see these patches backported. They are needed so perf
> > can be cross compiled with gcc on v5.15, v5.10 and v5.4.
> > I built it with tuxmake [1] here are two example commandlines:
> > tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig defconfig perf
> > tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig defconfig perf
> >
> > Tried to build perf with both gcc-11 and gcc-12.
> >
> > Patch 'tools perf: Fix compilation error with new binutils'
> > and 'tools build: Add feature test for init_disassemble_info API changes'
> > didn't apply cleanly, thats why I send these in a patchset.
> >
> > When apply 'tools build: Add feature test for
> > init_disassemble_info API changes' to 5.4 it will be a minor merge
> > conflict, do you want me to send this patch in two separate patches one
> > for 5.4 and another for v5.10?
> >
> > The sha for these two patches in mainline are.
> > cfd59ca91467 tools build: Add feature test for init_disassemble_info API changes
> > 83aa0120487e tools perf: Fix compilation error with new binutils
> >
> > The above patches solves these:
> > util/annotate.c: In function 'symbol__disassemble_bpf':
> > util/annotate.c:1729:9: error: too few arguments to function 'init_disassemble_info'
> >  1729 |         init_disassemble_info(&info, s,
> >       |         ^~~~~~~~~~~~~~~~~~~~~
> >
> >
> > Please apply these to v5.10 and v5.4
> > a45b3d692623 tools include: add dis-asm-compat.h to handle version differences
> > d08c84e01afa perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK>
> >
> > The above patches solves these:
> > /home/anders/src/kernel/stable-5.10/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
> >    43 |         (void) (&_max1 == &_max2);              \
> >       |                        ^~
> > builtin-sched.c:673:34: note: in expansion of macro 'max'
> >   673 |                         (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
> >       |                                  ^~~
> >
> >
> > Please apply these to v5.15, v5.10 and v5.4
> > 8e8bf60a6754 perf build: Fixup disabling of -Wdeprecated-declarations for the python scripting engine
> > 4ee3c4da8b1b perf scripting python: Do not build fail on deprecation warnings
> > 63a4354ae75c perf scripting perl: Ignore some warnings to keep building with perl headers
>
> Can you please provide patch series of these upstream commits backported
> to the relevant branchs that you wish to see them in?  You have 2
> patches in this series without git commit ids, and I have no idea where
> to apply them, or not apply them...

Yes, apologies, I will get that fixed up.

>
> Or better yet, just use the latest version of perf as was pointed out,
> on these old kernel releases.

Makes sense, we can do this. Is this the preferred way going forward?

Cheers,
Anders
Re: [backport PATCH 0/2] stable v5.15, v5.10 and v5.4: fix perf build errors
Posted by Ian Rogers 2 years, 8 months ago
On Thu, Apr 20, 2023 at 11:24 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> On Tue, 18 Apr 2023 at 11:04, Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Mon, Apr 17, 2023 at 02:29:41PM +0200, Anders Roxell wrote:
> > > Hi,
> > >
> > > I would like to see these patches backported. They are needed so perf
> > > can be cross compiled with gcc on v5.15, v5.10 and v5.4.
> > > I built it with tuxmake [1] here are two example commandlines:
> > > tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig defconfig perf
> > > tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig defconfig perf
> > >
> > > Tried to build perf with both gcc-11 and gcc-12.
> > >
> > > Patch 'tools perf: Fix compilation error with new binutils'
> > > and 'tools build: Add feature test for init_disassemble_info API changes'
> > > didn't apply cleanly, thats why I send these in a patchset.
> > >
> > > When apply 'tools build: Add feature test for
> > > init_disassemble_info API changes' to 5.4 it will be a minor merge
> > > conflict, do you want me to send this patch in two separate patches one
> > > for 5.4 and another for v5.10?
> > >
> > > The sha for these two patches in mainline are.
> > > cfd59ca91467 tools build: Add feature test for init_disassemble_info API changes
> > > 83aa0120487e tools perf: Fix compilation error with new binutils
> > >
> > > The above patches solves these:
> > > util/annotate.c: In function 'symbol__disassemble_bpf':
> > > util/annotate.c:1729:9: error: too few arguments to function 'init_disassemble_info'
> > >  1729 |         init_disassemble_info(&info, s,
> > >       |         ^~~~~~~~~~~~~~~~~~~~~
> > >
> > >
> > > Please apply these to v5.10 and v5.4
> > > a45b3d692623 tools include: add dis-asm-compat.h to handle version differences
> > > d08c84e01afa perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK>
> > >
> > > The above patches solves these:
> > > /home/anders/src/kernel/stable-5.10/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
> > >    43 |         (void) (&_max1 == &_max2);              \
> > >       |                        ^~
> > > builtin-sched.c:673:34: note: in expansion of macro 'max'
> > >   673 |                         (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
> > >       |                                  ^~~
> > >
> > >
> > > Please apply these to v5.15, v5.10 and v5.4
> > > 8e8bf60a6754 perf build: Fixup disabling of -Wdeprecated-declarations for the python scripting engine
> > > 4ee3c4da8b1b perf scripting python: Do not build fail on deprecation warnings
> > > 63a4354ae75c perf scripting perl: Ignore some warnings to keep building with perl headers
> >
> > Can you please provide patch series of these upstream commits backported
> > to the relevant branchs that you wish to see them in?  You have 2
> > patches in this series without git commit ids, and I have no idea where
> > to apply them, or not apply them...
>
> Yes, apologies, I will get that fixed up.
>
> >
> > Or better yet, just use the latest version of perf as was pointed out,
> > on these old kernel releases.
>
> Makes sense, we can do this. Is this the preferred way going forward?

Fwiw, it definitely has my vote.

Thanks,
Ian

> Cheers,
> Anders
Re: [backport PATCH 0/2] stable v5.15, v5.10 and v5.4: fix perf build errors
Posted by Ian Rogers 2 years, 8 months ago
On Mon, Apr 17, 2023 at 5:30 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> Hi,
>
> I would like to see these patches backported. They are needed so perf
> can be cross compiled with gcc on v5.15, v5.10 and v5.4.

Thanks Anders, why not just use the latest perf for these kernels?
Perhaps this discussion is relevant:
https://lore.kernel.org/linux-perf-users/0b1c5f9af241327786a996a3ddd61602b5a15987.camel@decadent.org.uk/

Thanks,
Ian

> I built it with tuxmake [1] here are two example commandlines:
> tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig defconfig perf
> tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig defconfig perf
>
> Tried to build perf with both gcc-11 and gcc-12.
>
> Patch 'tools perf: Fix compilation error with new binutils'
> and 'tools build: Add feature test for init_disassemble_info API changes'
> didn't apply cleanly, thats why I send these in a patchset.
>
> When apply 'tools build: Add feature test for
> init_disassemble_info API changes' to 5.4 it will be a minor merge
> conflict, do you want me to send this patch in two separate patches one
> for 5.4 and another for v5.10?
>
> The sha for these two patches in mainline are.
> cfd59ca91467 tools build: Add feature test for init_disassemble_info API changes
> 83aa0120487e tools perf: Fix compilation error with new binutils
>
> The above patches solves these:
> util/annotate.c: In function 'symbol__disassemble_bpf':
> util/annotate.c:1729:9: error: too few arguments to function 'init_disassemble_info'
>  1729 |         init_disassemble_info(&info, s,
>       |         ^~~~~~~~~~~~~~~~~~~~~
>
>
> Please apply these to v5.10 and v5.4
> a45b3d692623 tools include: add dis-asm-compat.h to handle version differences
> d08c84e01afa perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK>
>
> The above patches solves these:
> /home/anders/src/kernel/stable-5.10/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
>    43 |         (void) (&_max1 == &_max2);              \
>       |                        ^~
> builtin-sched.c:673:34: note: in expansion of macro 'max'
>   673 |                         (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
>       |                                  ^~~
>
>
> Please apply these to v5.15, v5.10 and v5.4
> 8e8bf60a6754 perf build: Fixup disabling of -Wdeprecated-declarations for the python scripting engine
> 4ee3c4da8b1b perf scripting python: Do not build fail on deprecation warnings
> 63a4354ae75c perf scripting perl: Ignore some warnings to keep building with perl headers
>
> Build error that the above 3 patches solves are:
> /usr/lib/x86_64-linux-gnu/perl/5.36/CORE/handy.h:125:23: error: cast from function call of type 'STRLEN' {aka 'long unsigned int'} to non-matching type '_Bool' [-Werror=bad-function-cast]
>   125 | #define cBOOL(cbool) ((bool) (cbool))
>       |                       ^
>
> Cheers,
> Anders
> [1] https://tuxmake.org/
>
> Andres Freund (2):
>   tools perf: Fix compilation error with new binutils
>   tools build: Add feature test for init_disassemble_info API changes
>
>  tools/build/Makefile.feature                        |  1 +
>  tools/build/feature/Makefile                        |  4 ++++
>  tools/build/feature/test-all.c                      |  4 ++++
>  tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
>  tools/perf/Makefile.config                          |  8 ++++++++
>  tools/perf/util/annotate.c                          |  7 ++++---
>  6 files changed, 34 insertions(+), 3 deletions(-)
>  create mode 100644 tools/build/feature/test-disassembler-init-styled.c
>
> --
> 2.39.2
>