* [PATCH v1] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h @ 2020-09-16 7:42 Tony Ambardar 2020-09-17 0:07 ` [PATCH v2] " Tony Ambardar 0 siblings, 1 reply; 13+ messages in thread From: Tony Ambardar @ 2020-09-16 7:42 UTC (permalink / raw) To: Michael Ellerman Cc: Tony Ambardar, linux-kernel, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev A few archs like powerpc have different errno.h values for macros EDEADLOCK and EDEADLK. In code including both libc and linux versions of errno.h, this can result in multiple definitions of EDEADLOCK in the include chain. Definitions to the same value (e.g. seen with mips) do not raise warnings, but on powerpc there are redefinitions changing the value, which raise warnings and errors (if using "-Werror"). Guard against these redefinitions to avoid build errors like the following, first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with musl 1.1.24: In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, from ../../include/linux/err.h:8, from libbpf.c:29: ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] #define EDEADLOCK EDEADLK In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, from libbpf.c:26: toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition #define EDEADLOCK 58 cc1: all warnings being treated as errors make[5]: *** [target-powerpc_8540_musl/bpftools-5.8.9/tools/build/Makefile.build:97: /home/kodidev/openwrt-project/build_dir/target-powerpc_8540_musl/bpftools-minimal/bpftools-5.8.9//libbpf/staticobjs/libbpf.o] Error 1 Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm") Reported-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> --- arch/powerpc/include/uapi/asm/errno.h | 1 + tools/arch/powerpc/include/uapi/asm/errno.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h index cc79856896a1..4ba87de32be0 100644 --- a/arch/powerpc/include/uapi/asm/errno.h +++ b/arch/powerpc/include/uapi/asm/errno.h @@ -2,6 +2,7 @@ #ifndef _ASM_POWERPC_ERRNO_H #define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK #include <asm-generic/errno.h> #undef EDEADLOCK diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h index cc79856896a1..4ba87de32be0 100644 --- a/tools/arch/powerpc/include/uapi/asm/errno.h +++ b/tools/arch/powerpc/include/uapi/asm/errno.h @@ -2,6 +2,7 @@ #ifndef _ASM_POWERPC_ERRNO_H #define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK #include <asm-generic/errno.h> #undef EDEADLOCK -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-16 7:42 [PATCH v1] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h Tony Ambardar @ 2020-09-17 0:07 ` Tony Ambardar 2020-09-17 11:55 ` Michael Ellerman 2020-09-17 13:54 ` [PATCH v3] " Tony Ambardar 0 siblings, 2 replies; 13+ messages in thread From: Tony Ambardar @ 2020-09-17 0:07 UTC (permalink / raw) To: Michael Ellerman Cc: Tony Ambardar, linux-kernel, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev A few archs like powerpc have different errno.h values for macros EDEADLOCK and EDEADLK. In code including both libc and linux versions of errno.h, this can result in multiple definitions of EDEADLOCK in the include chain. Definitions to the same value (e.g. seen with mips) do not raise warnings, but on powerpc there are redefinitions changing the value, which raise warnings and errors (if using "-Werror"). Guard against these redefinitions to avoid build errors like the following, first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with musl 1.1.24: In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, from ../../include/linux/err.h:8, from libbpf.c:29: ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] #define EDEADLOCK EDEADLK In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, from libbpf.c:26: toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition #define EDEADLOCK 58 cc1: all warnings being treated as errors Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm") Reported-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> --- v1 -> v2: * clean up commit description formatting --- arch/powerpc/include/uapi/asm/errno.h | 1 + tools/arch/powerpc/include/uapi/asm/errno.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h index cc79856896a1..4ba87de32be0 100644 --- a/arch/powerpc/include/uapi/asm/errno.h +++ b/arch/powerpc/include/uapi/asm/errno.h @@ -2,6 +2,7 @@ #ifndef _ASM_POWERPC_ERRNO_H #define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK #include <asm-generic/errno.h> #undef EDEADLOCK diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h index cc79856896a1..4ba87de32be0 100644 --- a/tools/arch/powerpc/include/uapi/asm/errno.h +++ b/tools/arch/powerpc/include/uapi/asm/errno.h @@ -2,6 +2,7 @@ #ifndef _ASM_POWERPC_ERRNO_H #define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK #include <asm-generic/errno.h> #undef EDEADLOCK -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 0:07 ` [PATCH v2] " Tony Ambardar @ 2020-09-17 11:55 ` Michael Ellerman 2020-09-17 13:42 ` Tony Ambardar ` (2 more replies) 2020-09-17 13:54 ` [PATCH v3] " Tony Ambardar 1 sibling, 3 replies; 13+ messages in thread From: Michael Ellerman @ 2020-09-17 11:55 UTC (permalink / raw) To: Tony Ambardar Cc: linux-arch, Tony Ambardar, Arnd Bergmann, linux-kernel, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev [ Cc += linux-arch & Arnd ] Hi Tony, This looks OK to me, but I'm always a bit nervous about changes in uapi. I've Cc'ed linux-arch and Arnd who look after the asm-generic headers, which this is slightly related to, just in case. One minor comment below. Tony Ambardar <tony.ambardar@gmail.com> writes: > A few archs like powerpc have different errno.h values for macros > EDEADLOCK and EDEADLK. In code including both libc and linux versions of > errno.h, this can result in multiple definitions of EDEADLOCK in the > include chain. Definitions to the same value (e.g. seen with mips) do > not raise warnings, but on powerpc there are redefinitions changing the > value, which raise warnings and errors (if using "-Werror"). > > Guard against these redefinitions to avoid build errors like the following, > first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with > musl 1.1.24: > > In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, > from ../../include/linux/err.h:8, > from libbpf.c:29: > ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] > #define EDEADLOCK EDEADLK > > In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, > from libbpf.c:26: > toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition > #define EDEADLOCK 58 > > cc1: all warnings being treated as errors > > Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") > Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm") I suspect that's not the right commit to tag. It just moved errno.h from arch/powerpc/include/asm to arch/powerpc/include/uapi/asm. It's content was almost identical, and entirely identical as far as EDEADLOCK was concerned. Prior to that the file lived in asm-powerpc/errno.h, eg: $ git cat-file -p b8b572e1015f^:include/asm-powerpc/errno.h Before that it was include/asm-ppc64/errno.h, content still the same. To go back further we'd have to look at the historical git trees, which is probably overkill. I'm pretty sure it's always had this problem. So we should probably drop the Fixes tags and just Cc: stable, that means please backport it as far back as possible. cheers > Reported-by: Rosen Penev <rosenp@gmail.com> > Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> > --- > v1 -> v2: > * clean up commit description formatting > --- > arch/powerpc/include/uapi/asm/errno.h | 1 + > tools/arch/powerpc/include/uapi/asm/errno.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h > index cc79856896a1..4ba87de32be0 100644 > --- a/arch/powerpc/include/uapi/asm/errno.h > +++ b/arch/powerpc/include/uapi/asm/errno.h > @@ -2,6 +2,7 @@ > #ifndef _ASM_POWERPC_ERRNO_H > #define _ASM_POWERPC_ERRNO_H > > +#undef EDEADLOCK > #include <asm-generic/errno.h> > > #undef EDEADLOCK > diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h > index cc79856896a1..4ba87de32be0 100644 > --- a/tools/arch/powerpc/include/uapi/asm/errno.h > +++ b/tools/arch/powerpc/include/uapi/asm/errno.h > @@ -2,6 +2,7 @@ > #ifndef _ASM_POWERPC_ERRNO_H > #define _ASM_POWERPC_ERRNO_H > > +#undef EDEADLOCK > #include <asm-generic/errno.h> > > #undef EDEADLOCK > -- > 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 11:55 ` Michael Ellerman @ 2020-09-17 13:42 ` Tony Ambardar 2020-09-17 14:01 ` Arnd Bergmann [not found] ` <CAK8P3a3FVoDzNb1TOA6cRQDdEc+st7KkBL70t0FeStEziQG4+A__37056.5000850306$1600351707$gmane$org@mail.gmail.com> 2 siblings, 0 replies; 13+ messages in thread From: Tony Ambardar @ 2020-09-17 13:42 UTC (permalink / raw) To: Michael Ellerman Cc: linux-arch, Arnd Bergmann, linux-kernel, Rosen Penev, Paul Mackerras, bpf, linuxppc-dev On Thu, 17 Sep 2020 at 04:55, Michael Ellerman <mpe@ellerman.id.au> wrote: > > [ Cc += linux-arch & Arnd ] > > Hi Tony, > > This looks OK to me, but I'm always a bit nervous about changes in uapi. > I've Cc'ed linux-arch and Arnd who look after the asm-generic headers, > which this is slightly related to, just in case. > I agree with the caution and would welcome any other insights. > One minor comment below. > > Tony Ambardar <tony.ambardar@gmail.com> writes: > > A few archs like powerpc have different errno.h values for macros > > EDEADLOCK and EDEADLK. In code including both libc and linux versions of > > errno.h, this can result in multiple definitions of EDEADLOCK in the > > include chain. Definitions to the same value (e.g. seen with mips) do > > not raise warnings, but on powerpc there are redefinitions changing the > > value, which raise warnings and errors (if using "-Werror"). > > > > Guard against these redefinitions to avoid build errors like the following, > > first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with > > musl 1.1.24: > > > > In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, > > from ../../include/linux/err.h:8, > > from libbpf.c:29: > > ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] > > #define EDEADLOCK EDEADLK > > > > In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, > > from libbpf.c:26: > > toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition > > #define EDEADLOCK 58 > > > > cc1: all warnings being treated as errors > > > > Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") > > Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm") > > I suspect that's not the right commit to tag. It just moved errno.h from > arch/powerpc/include/asm to arch/powerpc/include/uapi/asm. It's content > was almost identical, and entirely identical as far as EDEADLOCK was > concerned. > > Prior to that the file lived in asm-powerpc/errno.h, eg: > > $ git cat-file -p b8b572e1015f^:include/asm-powerpc/errno.h > > Before that it was include/asm-ppc64/errno.h, content still the same. > > To go back further we'd have to look at the historical git trees, which > is probably overkill. I'm pretty sure it's always had this problem. > > So we should probably drop the Fixes tags and just Cc: stable, that > means please backport it as far back as possible. > Yes, you're right. Those two commits were simply where I stopped tracing back the long chain. I'll drop them as you suggest and request a backport instead in the next version of the patch. Thanks for your feedback! > cheers > > > > Reported-by: Rosen Penev <rosenp@gmail.com> > > Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> > > --- > > v1 -> v2: > > * clean up commit description formatting > > --- > > arch/powerpc/include/uapi/asm/errno.h | 1 + > > tools/arch/powerpc/include/uapi/asm/errno.h | 1 + > > 2 files changed, 2 insertions(+) > > > > diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h > > index cc79856896a1..4ba87de32be0 100644 > > --- a/arch/powerpc/include/uapi/asm/errno.h > > +++ b/arch/powerpc/include/uapi/asm/errno.h > > @@ -2,6 +2,7 @@ > > #ifndef _ASM_POWERPC_ERRNO_H > > #define _ASM_POWERPC_ERRNO_H > > > > +#undef EDEADLOCK > > #include <asm-generic/errno.h> > > > > #undef EDEADLOCK > > diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h > > index cc79856896a1..4ba87de32be0 100644 > > --- a/tools/arch/powerpc/include/uapi/asm/errno.h > > +++ b/tools/arch/powerpc/include/uapi/asm/errno.h > > @@ -2,6 +2,7 @@ > > #ifndef _ASM_POWERPC_ERRNO_H > > #define _ASM_POWERPC_ERRNO_H > > > > +#undef EDEADLOCK > > #include <asm-generic/errno.h> > > > > #undef EDEADLOCK > > -- > > 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 11:55 ` Michael Ellerman 2020-09-17 13:42 ` Tony Ambardar @ 2020-09-17 14:01 ` Arnd Bergmann [not found] ` <CAK8P3a3FVoDzNb1TOA6cRQDdEc+st7KkBL70t0FeStEziQG4+A__37056.5000850306$1600351707$gmane$org@mail.gmail.com> 2 siblings, 0 replies; 13+ messages in thread From: Arnd Bergmann @ 2020-09-17 14:01 UTC (permalink / raw) To: Michael Ellerman Cc: linux-arch, Tony Ambardar, linux-kernel, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev On Thu, Sep 17, 2020 at 1:55 PM Michael Ellerman <mpe@ellerman.id.au> wrote: > > [ Cc += linux-arch & Arnd ] > > Hi Tony, > > This looks OK to me, but I'm always a bit nervous about changes in uapi. > I've Cc'ed linux-arch and Arnd who look after the asm-generic headers, > which this is slightly related to, just in case. > > One minor comment below. > > Tony Ambardar <tony.ambardar@gmail.com> writes: > > A few archs like powerpc have different errno.h values for macros > > EDEADLOCK and EDEADLK. In code including both libc and linux versions of > > errno.h, this can result in multiple definitions of EDEADLOCK in the > > include chain. Definitions to the same value (e.g. seen with mips) do > > not raise warnings, but on powerpc there are redefinitions changing the > > value, which raise warnings and errors (if using "-Werror"). > > > > Guard against these redefinitions to avoid build errors like the following, > > first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with > > musl 1.1.24: > > > > In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, > > from ../../include/linux/err.h:8, > > from libbpf.c:29: > > ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] > > #define EDEADLOCK EDEADLK > > > > In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, > > from libbpf.c:26: > > toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition > > #define EDEADLOCK 58 > > > > cc1: all warnings being treated as errors > > > > Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") > > Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm") > > I suspect that's not the right commit to tag. It just moved errno.h from > arch/powerpc/include/asm to arch/powerpc/include/uapi/asm. It's content > was almost identical, and entirely identical as far as EDEADLOCK was > concerned. > > Prior to that the file lived in asm-powerpc/errno.h, eg: > > $ git cat-file -p b8b572e1015f^:include/asm-powerpc/errno.h > > Before that it was include/asm-ppc64/errno.h, content still the same. > > To go back further we'd have to look at the historical git trees, which > is probably overkill. I'm pretty sure it's always had this problem. > > So we should probably drop the Fixes tags and just Cc: stable, that > means please backport it as far back as possible. I can see that the two numbers (35 and 58) were consistent across multiple architectures (i386, m68k, ppc32) up to linux-2.0.1, while other architectures had two unique numbers (alpha, mips, sparc) at the time, and sparc had BSD and Solaris compatible numbers in addition. In linux-2.0.2, alpha and i386 got changed to use 35 for both, but the other architectures remained unchanged. All later architectures followed x86 in using the same number for both. I foudn a message about tcl breaking at compile time when it changed: http://lkml.iu.edu/hypermail/linux/kernel/9607.3/0500.html The errno man page says they are supposed to be synonyms, and glibc defines it that way, while musl uses the numbers from the kernel. Arnd ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <CAK8P3a3FVoDzNb1TOA6cRQDdEc+st7KkBL70t0FeStEziQG4+A__37056.5000850306$1600351707$gmane$org@mail.gmail.com>]
* Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h [not found] ` <CAK8P3a3FVoDzNb1TOA6cRQDdEc+st7KkBL70t0FeStEziQG4+A__37056.5000850306$1600351707$gmane$org@mail.gmail.com> @ 2020-09-17 14:34 ` Andreas Schwab 2020-09-19 4:15 ` Tony Ambardar 0 siblings, 1 reply; 13+ messages in thread From: Andreas Schwab @ 2020-09-17 14:34 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arch, Tony Ambardar, linux-kernel, Rosen Penev, Paul Mackerras, bpf, linuxppc-dev On Sep 17 2020, Arnd Bergmann wrote: > The errno man page says they are supposed to be synonyms, > and glibc defines it that way, while musl uses the numbers > from the kernel. glibc also uses whatever the kernel defines. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 14:34 ` Andreas Schwab @ 2020-09-19 4:15 ` Tony Ambardar 0 siblings, 0 replies; 13+ messages in thread From: Tony Ambardar @ 2020-09-19 4:15 UTC (permalink / raw) To: Andreas Schwab Cc: linux-arch, Arnd Bergmann, linux-kernel, Rosen Penev, Paul Mackerras, bpf, linuxppc-dev On Thu, 17 Sep 2020 at 07:34, Andreas Schwab <schwab@linux-m68k.org> wrote: > > On Sep 17 2020, Arnd Bergmann wrote: > > > The errno man page says they are supposed to be synonyms, > > and glibc defines it that way, while musl uses the numbers > > from the kernel. > > glibc also uses whatever the kernel defines. > That's right, and from my investigation this isn't a libc issue. The various libc flavours simply try to follow POSIX and the PPC ABI and aren't doing anything wrong. See errno.h for example (https://man7.org/linux/man-pages/man3/errno.3.html): EDEADLK: Resource deadlock avoided (POSIX.1-2001). EDEADLOCK: On most architectures, a synonym for EDEADLK. On some architectures (e.g., Linux MIPS, PowerPC, SPARC), it is a separate error code "File locking deadlock error". The root cause is unique to the Linux PPC code in arch/powerpc/include/uapi/asm/errno.h: >/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >#ifndef _ASM_POWERPC_ERRNO_H >#define _ASM_POWERPC_ERRNO_H > >#include <asm-generic/errno.h> > >#undef EDEADLOCK >#define EDEADLOCK 58 /* File locking deadlock error */ > >#endif /* _ASM_POWERPC_ERRNO_H */ It includes "<asm-generic/errno.h>" to pull in various definitions but has the side-effect of redefining EDEADLOCK to a non-ABI value which conflicts with the libc errno.h, as I outline in the patch description. Other arches which also use different EDEADLOCK and EDEADLK values (mips,sparc) do not do this. They define EDEADLOCK *once*, with an ABI-consistent value, and don't have the same issue. The problem goes back a ways (as Arnd points out), affecting current stable and all LTS branches, so would be nice to get this sorted out. I'm certainly interested if there's a better way than proposed in this patch. > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 > "And now for something completely different." ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 0:07 ` [PATCH v2] " Tony Ambardar 2020-09-17 11:55 ` Michael Ellerman @ 2020-09-17 13:54 ` Tony Ambardar [not found] ` <20200921125452.32E0E21D7A@mail.kernel.org> ` (2 more replies) 1 sibling, 3 replies; 13+ messages in thread From: Tony Ambardar @ 2020-09-17 13:54 UTC (permalink / raw) To: Michael Ellerman Cc: linux-arch, Tony Ambardar, Arnd Bergmann, linux-kernel, Stable, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev A few archs like powerpc have different errno.h values for macros EDEADLOCK and EDEADLK. In code including both libc and linux versions of errno.h, this can result in multiple definitions of EDEADLOCK in the include chain. Definitions to the same value (e.g. seen with mips) do not raise warnings, but on powerpc there are redefinitions changing the value, which raise warnings and errors (if using "-Werror"). Guard against these redefinitions to avoid build errors like the following, first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with musl 1.1.24: In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, from ../../include/linux/err.h:8, from libbpf.c:29: ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] #define EDEADLOCK EDEADLK In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, from libbpf.c:26: toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition #define EDEADLOCK 58 cc1: all warnings being treated as errors CC: Stable <stable@vger.kernel.org> Reported-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> --- v1 -> v2: * clean up commit description formatting v2 -> v3: (per Michael Ellerman) * drop indeterminate 'Fixes' tags, request stable backports instead --- arch/powerpc/include/uapi/asm/errno.h | 1 + tools/arch/powerpc/include/uapi/asm/errno.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h index cc79856896a1..4ba87de32be0 100644 --- a/arch/powerpc/include/uapi/asm/errno.h +++ b/arch/powerpc/include/uapi/asm/errno.h @@ -2,6 +2,7 @@ #ifndef _ASM_POWERPC_ERRNO_H #define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK #include <asm-generic/errno.h> #undef EDEADLOCK diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h index cc79856896a1..4ba87de32be0 100644 --- a/tools/arch/powerpc/include/uapi/asm/errno.h +++ b/tools/arch/powerpc/include/uapi/asm/errno.h @@ -2,6 +2,7 @@ #ifndef _ASM_POWERPC_ERRNO_H #define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK #include <asm-generic/errno.h> #undef EDEADLOCK -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
[parent not found: <20200921125452.32E0E21D7A@mail.kernel.org>]
* Re: [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h [not found] ` <20200921125452.32E0E21D7A@mail.kernel.org> @ 2020-09-22 8:38 ` Tony Ambardar 0 siblings, 0 replies; 13+ messages in thread From: Tony Ambardar @ 2020-09-22 8:38 UTC (permalink / raw) To: Sasha Levin; +Cc: Paul Mackerras, linuxppc-dev, Arnd Bergmann, Stable On Mon, 21 Sep 2020 at 05:54, Sasha Levin <sashal@kernel.org> wrote: > > Hi > > [This is an automated email] > > This commit has been processed because it contains a -stable tag. > The stable tag indicates that it's relevant for the following trees: all > > The bot has tested the following trees: v5.8.10, v5.4.66, v4.19.146, v4.14.198, v4.9.236, v4.4.236. > > v5.8.10: Build OK! > v5.4.66: Build OK! > v4.19.146: Build OK! > v4.14.198: Failed to apply! Possible dependencies: > 7af7919f0f4b ("tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h") > 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") > a3f22d505f56 ("s390/perf: add callback to perf to enable using AUX buffer") > a81c42136604 ("perf s390: add regs_query_register_offset()") > a9fc2db0a8ab ("s390/perf: define common DWARF register string table") > f704ef44602f ("s390/perf: add support for perf_regs and libdw") > > v4.9.236: Failed to apply! Possible dependencies: > 0c744ea4f77d ("Linux 4.10-rc2") > 2bd6bf03f4c1 ("Linux 4.14-rc1") > 2ea659a9ef48 ("Linux 4.12-rc1") > 49def1853334 ("Linux 4.10-rc4") > 566cf877a1fc ("Linux 4.10-rc6") > 5771a8c08880 ("Linux v4.13-rc1") > 7089db84e356 ("Linux 4.10-rc8") > 7a308bb3016f ("Linux 4.10-rc5") > 7af7919f0f4b ("tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h") > 7ce7d89f4883 ("Linux 4.10-rc1") > 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") > a121103c9228 ("Linux 4.10-rc3") > a81c42136604 ("perf s390: add regs_query_register_offset()") > a9fc2db0a8ab ("s390/perf: define common DWARF register string table") > b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license") > c1ae3cfa0e89 ("Linux 4.11-rc1") > c470abd4fde4 ("Linux 4.10") > d5adbfcd5f7b ("Linux 4.10-rc7") > > v4.4.236: Failed to apply! Possible dependencies: > 0c4d40d58075 ("tools build: Add BPF feature check to test-all") > 1925459b4d92 ("tools build: Fix feature Makefile issues with 'O='") > 58683600dfe3 ("perf build: Use FEATURE-DUMP in bpf subproject") > 76ee2ff34274 ("tools build feature: Move dwarf post unwind choice output into perf") > 7af7919f0f4b ("tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h") > 8ee4646038e4 ("perf build: Add libcrypto feature detection") > 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's supported by perf") > 96b9e70b8e6c ("perf build: Introduce FEATURES_DUMP make variable") > 9fd4186ac19a ("tools build: Allow subprojects select all feature checkers") > abb26210a395 ("perf tools: Force fixdep compilation at the start of the build") > aeafd623f866 ("perf tools: Move headers check into bash script") > c053a1506fae ("perf build: Select all feature checkers for feature-dump") > d4dfdf00d43e ("perf jvmti: Plug compilation into perf build") > d58ac0bf8d1e ("perf build: Add clang and llvm compile and linking support") > d8ad6a15cc3a ("tools lib bpf: Don't do a feature check when cleaning") > e12b202f8fb9 ("perf jitdump: Build only on supported archs") > e26e63be64a1 ("perf build: Add sdt feature detection") > > > NOTE: The patch will not be queued to stable trees until it is upstream. > > How should we proceed with this patch? > [cc: linux-ppc, Arnd, Paul] The patch makes identical changes to 'arch/powerpc/include/uapi/asm/errno.h' and its copy 'tools/arch/powerpc/include/uapi/asm/errno.h' first created in kernel v4.16. Since it's the patch hunk for the latter file which is failing on backports to < v4.16, I would think it OK to skip that hunk where the latter file is missing. I'd prefer to let Michael decide the best course as he's still reviewing the patch. Thanks, Tony > -- > Thanks > Sasha ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 13:54 ` [PATCH v3] " Tony Ambardar [not found] ` <20200921125452.32E0E21D7A@mail.kernel.org> @ 2021-04-16 4:34 ` Tony Ambardar 2021-04-16 10:41 ` Michael Ellerman 2021-04-19 4:00 ` Michael Ellerman 2 siblings, 1 reply; 13+ messages in thread From: Tony Ambardar @ 2021-04-16 4:34 UTC (permalink / raw) To: Michael Ellerman Cc: linux-arch, Arnd Bergmann, LKML, Stable, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev Hello Michael, The latest version of this patch addressed all feedback I'm aware of when submitted last September, and I've seen no further comments from reviewers since then. Could you please let me know where this stands and if anything further is needed? Kind regards, Tony On Thu, 17 Sept 2020 at 06:54, Tony Ambardar <tony.ambardar@gmail.com> wrote: > > A few archs like powerpc have different errno.h values for macros > EDEADLOCK and EDEADLK. In code including both libc and linux versions of > errno.h, this can result in multiple definitions of EDEADLOCK in the > include chain. Definitions to the same value (e.g. seen with mips) do > not raise warnings, but on powerpc there are redefinitions changing the > value, which raise warnings and errors (if using "-Werror"). > > Guard against these redefinitions to avoid build errors like the following, > first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with > musl 1.1.24: > > In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, > from ../../include/linux/err.h:8, > from libbpf.c:29: > ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] > #define EDEADLOCK EDEADLK > > In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, > from libbpf.c:26: > toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition > #define EDEADLOCK 58 > > cc1: all warnings being treated as errors > > CC: Stable <stable@vger.kernel.org> > Reported-by: Rosen Penev <rosenp@gmail.com> > Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> > --- > v1 -> v2: > * clean up commit description formatting > > v2 -> v3: (per Michael Ellerman) > * drop indeterminate 'Fixes' tags, request stable backports instead > --- > arch/powerpc/include/uapi/asm/errno.h | 1 + > tools/arch/powerpc/include/uapi/asm/errno.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h > index cc79856896a1..4ba87de32be0 100644 > --- a/arch/powerpc/include/uapi/asm/errno.h > +++ b/arch/powerpc/include/uapi/asm/errno.h > @@ -2,6 +2,7 @@ > #ifndef _ASM_POWERPC_ERRNO_H > #define _ASM_POWERPC_ERRNO_H > > +#undef EDEADLOCK > #include <asm-generic/errno.h> > > #undef EDEADLOCK > diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h > index cc79856896a1..4ba87de32be0 100644 > --- a/tools/arch/powerpc/include/uapi/asm/errno.h > +++ b/tools/arch/powerpc/include/uapi/asm/errno.h > @@ -2,6 +2,7 @@ > #ifndef _ASM_POWERPC_ERRNO_H > #define _ASM_POWERPC_ERRNO_H > > +#undef EDEADLOCK > #include <asm-generic/errno.h> > > #undef EDEADLOCK > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2021-04-16 4:34 ` Tony Ambardar @ 2021-04-16 10:41 ` Michael Ellerman 2021-04-17 1:00 ` Tony Ambardar 0 siblings, 1 reply; 13+ messages in thread From: Michael Ellerman @ 2021-04-16 10:41 UTC (permalink / raw) To: Tony Ambardar Cc: linux-arch, Arnd Bergmann, LKML, Stable, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev Tony Ambardar <tony.ambardar@gmail.com> writes: > Hello Michael, > > The latest version of this patch addressed all feedback I'm aware of > when submitted last September, and I've seen no further comments from > reviewers since then. > > Could you please let me know where this stands and if anything further > is needed? Sorry, it's still sitting in my inbox :/ I was going to reply to suggest we split the tools change out. The headers under tools are usually updated by another maintainer, I think it might even be scripted. Anyway I've applied your patch and done that (dropped the change to tools/.../errno.h), which should also mean the stable backport is more likely to work automatically. It will hit mainline in v5.13-rc1 and then be backported to the stable trees. I don't think you actually need the tools version of the header updated to fix your bug? In which case we can probably just wait for it to be updated automatically when the tools headers are sync'ed with the kernel versions. cheers > On Thu, 17 Sept 2020 at 06:54, Tony Ambardar <tony.ambardar@gmail.com> wrote: >> >> A few archs like powerpc have different errno.h values for macros >> EDEADLOCK and EDEADLK. In code including both libc and linux versions of >> errno.h, this can result in multiple definitions of EDEADLOCK in the >> include chain. Definitions to the same value (e.g. seen with mips) do >> not raise warnings, but on powerpc there are redefinitions changing the >> value, which raise warnings and errors (if using "-Werror"). >> >> Guard against these redefinitions to avoid build errors like the following, >> first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with >> musl 1.1.24: >> >> In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5, >> from ../../include/linux/err.h:8, >> from libbpf.c:29: >> ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror] >> #define EDEADLOCK EDEADLK >> >> In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10, >> from libbpf.c:26: >> toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition >> #define EDEADLOCK 58 >> >> cc1: all warnings being treated as errors >> >> CC: Stable <stable@vger.kernel.org> >> Reported-by: Rosen Penev <rosenp@gmail.com> >> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com> >> --- >> v1 -> v2: >> * clean up commit description formatting >> >> v2 -> v3: (per Michael Ellerman) >> * drop indeterminate 'Fixes' tags, request stable backports instead >> --- >> arch/powerpc/include/uapi/asm/errno.h | 1 + >> tools/arch/powerpc/include/uapi/asm/errno.h | 1 + >> 2 files changed, 2 insertions(+) >> >> diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h >> index cc79856896a1..4ba87de32be0 100644 >> --- a/arch/powerpc/include/uapi/asm/errno.h >> +++ b/arch/powerpc/include/uapi/asm/errno.h >> @@ -2,6 +2,7 @@ >> #ifndef _ASM_POWERPC_ERRNO_H >> #define _ASM_POWERPC_ERRNO_H >> >> +#undef EDEADLOCK >> #include <asm-generic/errno.h> >> >> #undef EDEADLOCK >> diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h >> index cc79856896a1..4ba87de32be0 100644 >> --- a/tools/arch/powerpc/include/uapi/asm/errno.h >> +++ b/tools/arch/powerpc/include/uapi/asm/errno.h >> @@ -2,6 +2,7 @@ >> #ifndef _ASM_POWERPC_ERRNO_H >> #define _ASM_POWERPC_ERRNO_H >> >> +#undef EDEADLOCK >> #include <asm-generic/errno.h> >> >> #undef EDEADLOCK >> -- >> 2.25.1 >> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2021-04-16 10:41 ` Michael Ellerman @ 2021-04-17 1:00 ` Tony Ambardar 0 siblings, 0 replies; 13+ messages in thread From: Tony Ambardar @ 2021-04-17 1:00 UTC (permalink / raw) To: Michael Ellerman Cc: linux-arch, Arnd Bergmann, LKML, Stable, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev On Fri, 16 Apr 2021 at 03:41, Michael Ellerman <mpe@ellerman.id.au> wrote: > > Tony Ambardar <tony.ambardar@gmail.com> writes: > > Hello Michael, > > > > The latest version of this patch addressed all feedback I'm aware of > > when submitted last September, and I've seen no further comments from > > reviewers since then. > > > > Could you please let me know where this stands and if anything further > > is needed? > > Sorry, it's still sitting in my inbox :/ > > I was going to reply to suggest we split the tools change out. The > headers under tools are usually updated by another maintainer, I think > it might even be scripted. > > Anyway I've applied your patch and done that (dropped the change to > tools/.../errno.h), which should also mean the stable backport is more > likely to work automatically. > > It will hit mainline in v5.13-rc1 and then be backported to the stable > trees. > > I don't think you actually need the tools version of the header updated > to fix your bug? In which case we can probably just wait for it to be > updated automatically when the tools headers are sync'ed with the kernel > versions. > > cheers I appreciate the follow up. My original bug was indeed with the tools header but is being patched locally, so waiting for those headers to sync with the kernel versions is fine if it simplifies things overall. Thanks, Tony ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h 2020-09-17 13:54 ` [PATCH v3] " Tony Ambardar [not found] ` <20200921125452.32E0E21D7A@mail.kernel.org> 2021-04-16 4:34 ` Tony Ambardar @ 2021-04-19 4:00 ` Michael Ellerman 2 siblings, 0 replies; 13+ messages in thread From: Michael Ellerman @ 2021-04-19 4:00 UTC (permalink / raw) To: Michael Ellerman, Tony Ambardar Cc: linux-arch, Tony Ambardar, Arnd Bergmann, linux-kernel, Stable, Paul Mackerras, Rosen Penev, bpf, linuxppc-dev On Thu, 17 Sep 2020 06:54:37 -0700, Tony Ambardar wrote: > A few archs like powerpc have different errno.h values for macros > EDEADLOCK and EDEADLK. In code including both libc and linux versions of > errno.h, this can result in multiple definitions of EDEADLOCK in the > include chain. Definitions to the same value (e.g. seen with mips) do > not raise warnings, but on powerpc there are redefinitions changing the > value, which raise warnings and errors (if using "-Werror"). > > [...] Applied to powerpc/next. [1/1] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h https://git.kernel.org/powerpc/c/7de21e679e6a789f3729e8402bc440b623a28eae cheers ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-04-19 4:13 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-09-16 7:42 [PATCH v1] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h Tony Ambardar 2020-09-17 0:07 ` [PATCH v2] " Tony Ambardar 2020-09-17 11:55 ` Michael Ellerman 2020-09-17 13:42 ` Tony Ambardar 2020-09-17 14:01 ` Arnd Bergmann [not found] ` <CAK8P3a3FVoDzNb1TOA6cRQDdEc+st7KkBL70t0FeStEziQG4+A__37056.5000850306$1600351707$gmane$org@mail.gmail.com> 2020-09-17 14:34 ` Andreas Schwab 2020-09-19 4:15 ` Tony Ambardar 2020-09-17 13:54 ` [PATCH v3] " Tony Ambardar [not found] ` <20200921125452.32E0E21D7A@mail.kernel.org> 2020-09-22 8:38 ` Tony Ambardar 2021-04-16 4:34 ` Tony Ambardar 2021-04-16 10:41 ` Michael Ellerman 2021-04-17 1:00 ` Tony Ambardar 2021-04-19 4:00 ` Michael Ellerman
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).