arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh | 1 - arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 1 - 2 files changed, 2 deletions(-)
We've been observing rare non-deterministic kconfig failures during
olddefconfig, where ARCH_USING_PATCHABLE_FUNCTION_ENTRY was getting
disabled and with it number of other config options that depend on it.
The reason is that gcc-check-fpatchable-function-entry.sh can fail
if `grep -q` (or scripts/dummy-tools/gcc) is fast enough to exit while
there is still someone writing on other side of pipe. `pipefail`
propagates that error up to kconfig.
This can be seen for example with:
# (set -e; set -o pipefail; yes | grep -q y); echo $?
141
or by running the actual check script in loop extensively:
----------------------------- 8< -------------------------------
function kconfig()
{
for i in `seq 1 100`; do
arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh \
./scripts/dummy-tools/gcc -mlittle-endian \
|| { echo "Oops"; exit 1; }
done
}
for ((i=0; i<$(nproc); i++)); do kconfig & done
wait; echo "Done"
----------------------------- >8 -------------------------------
Fixes: 0f71dcfb4aef ("powerpc/ftrace: Add support for -fpatchable-function-entry")
Fixes: b71c9ffb1405 ("powerpc: Add arch/powerpc/tools directory")
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh | 1 -
arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 1 -
2 files changed, 2 deletions(-)
diff --git a/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh b/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh
index 06706903503b..baed467a016b 100755
--- a/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh
+++ b/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-2.0
set -e
-set -o pipefail
# To debug, uncomment the following line
# set -x
diff --git a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh
index 73e331e7660e..6193b0ed0c77 100755
--- a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh
+++ b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-2.0
set -e
-set -o pipefail
# To debug, uncomment the following line
# set -x
--
2.47.1
On 8/26/25 5:54 AM, Jan Stancek wrote: > We've been observing rare non-deterministic kconfig failures during > olddefconfig, where ARCH_USING_PATCHABLE_FUNCTION_ENTRY was getting > disabled and with it number of other config options that depend on it. > > The reason is that gcc-check-fpatchable-function-entry.sh can fail > if `grep -q` (or scripts/dummy-tools/gcc) is fast enough to exit while > there is still someone writing on other side of pipe. `pipefail` > propagates that error up to kconfig. > > This can be seen for example with: > # (set -e; set -o pipefail; yes | grep -q y); echo $? > 141 > > or by running the actual check script in loop extensively: > ----------------------------- 8< ------------------------------- > function kconfig() > { > for i in `seq 1 100`; do > arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh \ > ./scripts/dummy-tools/gcc -mlittle-endian \ > || { echo "Oops"; exit 1; } > done > } > > for ((i=0; i<$(nproc); i++)); do kconfig & done > wait; echo "Done" > ----------------------------- >8 ------------------------------- > > Fixes: 0f71dcfb4aef ("powerpc/ftrace: Add support for -fpatchable-function-entry") > Fixes: b71c9ffb1405 ("powerpc: Add arch/powerpc/tools directory") > Signed-off-by: Jan Stancek <jstancek@redhat.com> > --- > arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh | 1 - > arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 1 - > 2 files changed, 2 deletions(-) > > diff --git a/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh b/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh > index 06706903503b..baed467a016b 100755 > --- a/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh > +++ b/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh > @@ -2,7 +2,6 @@ > # SPDX-License-Identifier: GPL-2.0 > > set -e > -set -o pipefail > > # To debug, uncomment the following line > # set -x > diff --git a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh > index 73e331e7660e..6193b0ed0c77 100755 > --- a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh > +++ b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh > @@ -2,7 +2,6 @@ > # SPDX-License-Identifier: GPL-2.0 > > set -e > -set -o pipefail > > # To debug, uncomment the following line > # set -x Acked-by: Joe Lawrence <joe.lawrence@redhat.com> This bug manifests when automated scripts expect to run a kernel build after `make olddefconfig`. I reported this to Jan when I found that kpatch-build [1] instances were hanging (expecting to hear from a user that would never answer :( [1] https://github.com/dynup/kpatch/blob/master/kpatch-build/kpatch-build -- Joe
On Thu, Aug 28, 2025 at 3:32 PM Joe Lawrence <joe.lawrence@redhat.com> wrote: > > On 8/26/25 5:54 AM, Jan Stancek wrote: > > We've been observing rare non-deterministic kconfig failures during > > olddefconfig, where ARCH_USING_PATCHABLE_FUNCTION_ENTRY was getting > > disabled and with it number of other config options that depend on it. > > > > The reason is that gcc-check-fpatchable-function-entry.sh can fail > > if `grep -q` (or scripts/dummy-tools/gcc) is fast enough to exit while > > there is still someone writing on other side of pipe. `pipefail` > > propagates that error up to kconfig. > > > > This can be seen for example with: > > # (set -e; set -o pipefail; yes | grep -q y); echo $? > > 141 > > > > or by running the actual check script in loop extensively: > > ----------------------------- 8< ------------------------------- > > function kconfig() > > { > > for i in `seq 1 100`; do > > arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh \ > > ./scripts/dummy-tools/gcc -mlittle-endian \ > > || { echo "Oops"; exit 1; } > > done > > } > > > > for ((i=0; i<$(nproc); i++)); do kconfig & done > > wait; echo "Done" > > ----------------------------- >8 ------------------------------- > > > > Fixes: 0f71dcfb4aef ("powerpc/ftrace: Add support for -fpatchable-function-entry") > > Fixes: b71c9ffb1405 ("powerpc: Add arch/powerpc/tools directory") > > Signed-off-by: Jan Stancek <jstancek@redhat.com> > > --- > > arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh | 1 - > > arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 1 - > > 2 files changed, 2 deletions(-) > > > > diff --git a/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh b/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh > > index 06706903503b..baed467a016b 100755 > > --- a/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh > > +++ b/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh > > @@ -2,7 +2,6 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > > set -e > > -set -o pipefail > > > > # To debug, uncomment the following line > > # set -x > > diff --git a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh > > index 73e331e7660e..6193b0ed0c77 100755 > > --- a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh > > +++ b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh > > @@ -2,7 +2,6 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > > set -e > > -set -o pipefail > > > > # To debug, uncomment the following line > > # set -x > > Acked-by: Joe Lawrence <joe.lawrence@redhat.com> > > This bug manifests when automated scripts expect to run a kernel build > after `make olddefconfig`. I reported this to Jan when I found that Right, maybe we can still add that too. Reported-by: Joe Lawrence <joe.lawrence@redhat.com> Would anyone else also care to review, please? Thanks, Jan > kpatch-build [1] instances were hanging (expecting to hear from a user > that would never answer :( > > [1] https://github.com/dynup/kpatch/blob/master/kpatch-build/kpatch-build > -- > Joe >
© 2016 - 2025 Red Hat, Inc.