kbuild: Give jobserver-exec recipes the jobserver
Subsystems (16)
cover kbuild: Give jobserver-exec recipes the jobserver
Hi!
Paul reported a build failure on CentOS Stream 9 with linux-next[1]: the kernel builds, but scripts/jobserver-exec prints
WARNING: Unable to reopen jobserver read-side pipe: FileNotFoundError(2, 'No such file or directory')
and rcutorture's build check counts the "Error" in that line. CentOS's make 4.3 carries a backport of the fix for GNU Make bug 58232, so sub-makes, like the top-level make, give the jobserver pipe only to recipes marked recursive, while MAKEFLAGS still names it. The new pigz step (1/2) and the older Clang LTO initcall ordering step (2/2) run jobserver-exec from recipes without "+", so pigz gets one thread and the initcall script caps its children at the CPU count instead of the free job slots. Mark both recipes recursive, as was done for rustc.
Thanks!
-Kees
[1] https://lore.kernel.org/all/0ddb5e5e-f801-444c-aa98-0cfe814a3026@paulmck-laptop/
Kees Cook (2):
kbuild: Mark the kernel image gzip recipes as recursive
kbuild: Mark the initcall ordering recipe as recursive
arch/alpha/boot/Makefile | 4 ++-- arch/arc/boot/Makefile | 2 +- arch/arm64/boot/Makefile | 2 +- arch/microblaze/boot/Makefile | 2 +- arch/mips/boot/Makefile | 2 +- arch/nios2/boot/Makefile | 2 +- arch/parisc/boot/compressed/Makefile | 2 +- arch/riscv/boot/Makefile | 2 +- arch/s390/boot/Makefile | 2 +- arch/sh/boot/Makefile | 2 +- arch/sh/boot/compressed/Makefile | 2 +- arch/sparc/boot/Makefile | 4 ++-- arch/x86/boot/compressed/Makefile | 2 +- arch/xtensa/boot/Makefile | 2 +- scripts/Makefile.vmlinux_o | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/2 kbuild: Mark the kernel image gzip recipes as recursive
Since commit 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if available"), cmd_gzip runs pigz through scripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:
WARNING: Unable to reopen jobserver read-side pipe: FileNotFoundError(2, 'No such file or directory')
Mark the gzip recipes as recursive with "+", as commit ecab4115c44cc ("kbuild: mark rustc (and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.
Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
--- arch/alpha/boot/Makefile | 4 ++-- arch/arc/boot/Makefile | 2 +- arch/arm64/boot/Makefile | 2 +- arch/microblaze/boot/Makefile | 2 +- arch/mips/boot/Makefile | 2 +- arch/nios2/boot/Makefile | 2 +- arch/parisc/boot/compressed/Makefile | 2 +- arch/riscv/boot/Makefile | 2 +- arch/s390/boot/Makefile | 2 +- arch/sh/boot/Makefile | 2 +- arch/sh/boot/compressed/Makefile | 2 +- arch/sparc/boot/Makefile | 4 ++-- arch/x86/boot/compressed/Makefile | 2 +- arch/xtensa/boot/Makefile | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-)
arch/alpha/boot/Makefile +2 -2
@@ -40,7 +40,7 @@ endif # Compressed kernel image $(obj)/vmlinux.gz: $(obj)/vmlinux FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) @echo ' Kernel $@ is ready' $(obj)/main.o: $(obj)/ksize.h
@@ -85,7 +85,7 @@ $(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE $(call if_changed,objstrip) $(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE $(call if_changed,objstrip)
arch/arc/boot/Makefile +1 -1
@@ -23,7 +23,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE $(call if_changed,lzma)
arch/arm64/boot/Makefile +1 -1
@@ -26,7 +26,7 @@ $(obj)/Image.bz2: $(obj)/Image FORCE $(call if_changed,bzip2) $(obj)/Image.gz: $(obj)/Image FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/Image.lz4: $(obj)/Image FORCE $(call if_changed,lz4)
arch/microblaze/boot/Makefile +1 -1
@@ -14,7 +14,7 @@ $(obj)/linux.bin.ub: $(obj)/linux.bin FORCE $(call if_changed,uimage) $(obj)/linux.bin.gz: $(obj)/linux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) quiet_cmd_strip = STRIP $< $@$2 cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
arch/mips/boot/Makefile +1 -1
@@ -63,7 +63,7 @@ $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE $(call if_changed,lzma)
arch/nios2/boot/Makefile +1 -1
@@ -18,7 +18,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmImage: $(obj)/vmlinux.gz FORCE $(call if_changed,uimage)
arch/parisc/boot/compressed/Makefile +1 -1
@@ -55,7 +55,7 @@ suffix-$(CONFIG_KERNEL_LZO) := lzo suffix-$(CONFIG_KERNEL_XZ) := xz $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
arch/riscv/boot/Makefile +1 -1
@@ -23,7 +23,7 @@ $(obj)/Image: vmlinux FORCE $(call if_changed,objcopy) $(obj)/Image.gz: $(obj)/Image FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/loader.o: $(src)/loader.S $(obj)/Image
arch/s390/boot/Makefile +1 -1
@@ -117,7 +117,7 @@ suffix-$(CONFIG_KERNEL_XZ) := .xz suffix-$(CONFIG_KERNEL_ZSTD) := .zst $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
arch/sh/boot/Makefile +1 -1
@@ -66,7 +66,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2)
arch/sh/boot/compressed/Makefile +1 -1
@@ -39,7 +39,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
arch/sparc/boot/Makefile +2 -2
@@ -23,7 +23,7 @@ ifeq ($(CONFIG_SPARC64),y) # Actual linking $(obj)/zImage: $(obj)/image FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) @$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')' $(obj)/vmlinux.aout: vmlinux FORCE
@@ -45,7 +45,7 @@ $(obj)/image.bin: $(obj)/image FORCE $(call if_changed,objcopy) $(obj)/image.gz: $(obj)/image.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR) UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
arch/x86/boot/compressed/Makefile +1 -1
@@ -133,7 +133,7 @@ vmlinux.bin.all-y := $(obj)/vmlinux.bin vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
arch/xtensa/boot/Makefile +1 -1
@@ -36,7 +36,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) boot-elf: $(obj)/vmlinux.bin boot-redboot: $(obj)/vmlinux.bin.gz
Signature · 1 line
2.55.0
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 24 lines
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Reported-by Paul E. McKenney <[email protected]>Fixes 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if available")Assisted-by LLMSigned-off-by Kees Cook <[email protected]>
Quoted 16 lines
--- arch/alpha/boot/Makefile | 4 ++-- arch/arc/boot/Makefile | 2 +- arch/arm64/boot/Makefile | 2 +- arch/microblaze/boot/Makefile | 2 +- arch/mips/boot/Makefile | 2 +- arch/nios2/boot/Makefile | 2 +- arch/parisc/boot/compressed/Makefile | 2 +- arch/riscv/boot/Makefile | 2 +- arch/s390/boot/Makefile | 2 +- arch/sh/boot/Makefile | 2 +- arch/sh/boot/compressed/Makefile | 2 +- arch/sparc/boot/Makefile | 4 ++-- arch/x86/boot/compressed/Makefile | 2 +- arch/xtensa/boot/Makefile | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-)
Before it gets lost, we should also update the documentation bit that references $(if_changed,gzip):
Documentation/kbuild/makefiles.rst +3 -2
@@ -1452,13 +1452,14 @@ objcopy OBJCOPYFLAGS_$@ may be used to set additional options. gzip - Compress target. Use maximum compression to compress target. + Compress target. Use maximum compression to compress target. Add '+' prefix + to allow parallel gzip compression via pigz (if available). Example:: #arch/x86/boot/compressed/Makefile $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) dtc Create flattened device tree blob object suitable for linking
Signature · 1 line
Nicolas
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
In reply to Kees CookQuoted 19 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Quoted 5 lines
Reported-by Paul E. McKenney <[email protected]>Fixes 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if available")Assisted-by LLMSigned-off-by Kees Cook <[email protected]>
Nice find!
Sorry for breaking your build Paul ;)
--
Cheers, Lorenzo
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 26 lines · Lorenzo Stoakes (ARM)
Quoted 19 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Quoted 5 lines
Reported-by Paul E. McKenney <[email protected]>Fixes 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if available")Assisted-by LLMSigned-off-by Kees Cook <[email protected]>
Quoted 5 lines
Nice find!
Sorry for breaking your build Paul ;)
Hey, this was the fastest bisection that I have ever done by far!
Normally it takes hours per step, but this was about 40 seconds per step. ;-)
Thanx, Paul
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
In reply to Kees CookQuoted 10 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')
Quoted 8 lines
Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Thank you, Kees!
My initial test of this patch (using rcutorture) still showed the failure. I am running GCC 11.5.0 and without any patches to "make". I take it that I need to find and apply CentOS Stream 9's make-4.3-cloexec.patch?
But if I use "make -j" instead of rcutorture, this patch does work fine. Even with "make -j632".
I put rcutorture in the background using nohup and full redirection, but "nohup make -j632 > /tmp/Make.out 2>&1 < /dev/null &" works just fine. And running rcutorture in the foreground still fails.
Very strange.
So I guess I could give a Tested-by for builds using straight-up make, but not from rcutorture. ;-)
Thanx, Paul
Quoted 225 lines
Reported-by Paul E. McKenney <[email protected]>Fixes 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if available")Assisted-by LLMSigned-off-by Kees Cook <[email protected]>--- arch/alpha/boot/Makefile | 4 ++-- arch/arc/boot/Makefile | 2 +- arch/arm64/boot/Makefile | 2 +- arch/microblaze/boot/Makefile | 2 +- arch/mips/boot/Makefile | 2 +- arch/nios2/boot/Makefile | 2 +- arch/parisc/boot/compressed/Makefile | 2 +- arch/riscv/boot/Makefile | 2 +- arch/s390/boot/Makefile | 2 +- arch/sh/boot/Makefile | 2 +- arch/sh/boot/compressed/Makefile | 2 +- arch/sparc/boot/Makefile | 4 ++-- arch/x86/boot/compressed/Makefile | 2 +- arch/xtensa/boot/Makefile | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-)arch/alpha/boot/Makefile +2
-2@@ -40,7 +40,7 @@ endif # Compressed kernel image $(obj)/vmlinux.gz: $(obj)/vmlinux FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) @echo ' Kernel $@ is ready' $(obj)/main.o: $(obj)/ksize.h@@ -85,7 +85,7 @@ $(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE $(call if_changed,objstrip) $(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE $(call if_changed,objstrip)arch/arc/boot/Makefile +1
-1@@ -23,7 +23,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE $(call if_changed,lzma)arch/arm64/boot/Makefile +1
-1@@ -26,7 +26,7 @@ $(obj)/Image.bz2: $(obj)/Image FORCE $(call if_changed,bzip2) $(obj)/Image.gz: $(obj)/Image FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/Image.lz4: $(obj)/Image FORCE $(call if_changed,lz4)arch/microblaze/boot/Makefile +1
-1@@ -14,7 +14,7 @@ $(obj)/linux.bin.ub: $(obj)/linux.bin FORCE $(call if_changed,uimage) $(obj)/linux.bin.gz: $(obj)/linux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) quiet_cmd_strip = STRIP $< $@$2 cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \arch/mips/boot/Makefile +1
-1@@ -63,7 +63,7 @@ $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE $(call if_changed,lzma)arch/nios2/boot/Makefile +1
-1@@ -18,7 +18,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmImage: $(obj)/vmlinux.gz FORCE $(call if_changed,uimage)arch/parisc/boot/compressed/Makefile +1
-1@@ -55,7 +55,7 @@ suffix-$(CONFIG_KERNEL_LZO) := lzo suffix-$(CONFIG_KERNEL_XZ) := xz $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCEarch/riscv/boot/Makefile +1
-1@@ -23,7 +23,7 @@ $(obj)/Image: vmlinux FORCE $(call if_changed,objcopy) $(obj)/Image.gz: $(obj)/Image FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/loader.o: $(src)/loader.S $(obj)/Imagearch/s390/boot/Makefile +1
-1@@ -117,7 +117,7 @@ suffix-$(CONFIG_KERNEL_XZ) := .xz suffix-$(CONFIG_KERNEL_ZSTD) := .zst $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCEarch/sh/boot/Makefile +1
-1@@ -66,7 +66,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2)arch/sh/boot/compressed/Makefile +1
-1@@ -39,7 +39,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCEarch/sparc/boot/Makefile +2
-2@@ -23,7 +23,7 @@ ifeq ($(CONFIG_SPARC64),y) # Actual linking $(obj)/zImage: $(obj)/image FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) @$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')' $(obj)/vmlinux.aout: vmlinux FORCE@@ -45,7 +45,7 @@ $(obj)/image.bin: $(obj)/image FORCE $(call if_changed,objcopy) $(obj)/image.gz: $(obj)/image.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR) UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)arch/x86/boot/compressed/Makefile +1
-1@@ -133,7 +133,7 @@ vmlinux.bin.all-y := $(obj)/vmlinux.bin vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE $(call if_changed,bzip2_with_size) $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCEarch/xtensa/boot/Makefile +1
-1@@ -36,7 +36,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) + +$(call if_changed,gzip) boot-elf: $(obj)/vmlinux.bin boot-redboot: $(obj)/vmlinux.bin.gzSignature · 1 line
2.55.0
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.
Quoted 8 lines
Quoted 4 lines
Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Thank you, Kees!
My initial test of this patch (using rcutorture) still showed the failure.
Oh! So the patch didn't fix it for you?
Quoted 5 lines
I am running GCC 11.5.0 and without any patches to "make". I take it that I need to find and apply CentOS Stream 9's make-4.3-cloexec.patch?
But if I use "make -j" instead of rcutorture, this patch does work fine. Even with "make -j632".
Without rcutorture was "make -jNN" broken for you without this patch?
Quoted 5 lines
I put rcutorture in the background using nohup and full redirection, but "nohup make -j632 >
/tmp/Make.out2>&1 </dev/null&" works just fine. And running rcutorture in the foreground still fails.Very strange.
O_O It only breaks ... when backgrounded? Oh my. Okay, I will try to figure that out.
Signature · 1 line
Kees Cook
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 35 lines · Kees Cook
Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Quoted 8 lines
Quoted 4 lines
Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Thank you, Kees!
My initial test of this patch (using rcutorture) still showed the failure.
Oh! So the patch didn't fix it for you?
Quoted 5 lines
I am running GCC 11.5.0 and without any patches to "make". I take it that I need to find and apply CentOS Stream 9's make-4.3-cloexec.patch?
But if I use "make -j" instead of rcutorture, this patch does work fine. Even with "make -j632".
Without rcutorture was "make -jNN" broken for you without this patch?
Quoted 8 lines
Quoted 5 lines
I put rcutorture in the background using nohup and full redirection, but "nohup make -j632 >
/tmp/Make.out2>&1 </dev/null&" works just fine. And running rcutorture in the foreground still fails.Very strange.
O_OIt only breaks ... when backgrounded? Oh my. Okay, I will try to figure that out.
Apologies, let me present my results in a more organized fashion:
foreground background -next Fix -next Fix make -jN Bug Good Bug Good kvm.sh [1] Bug Bug Bug Bug
[1] tools/testing/selftests/rcutorture/bin/kvm.sh --build-only --allcpus --configs TREE02 --trust-make
Here, -next is next-20261008, and Fix is with your patch on it.
Just as mystifying to me, to be honest!
Thanx, Paul
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 54 lines · Paul E. McKenney
Quoted 35 lines · Kees Cook
Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Quoted 8 lines
Quoted 4 lines
Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Thank you, Kees!
My initial test of this patch (using rcutorture) still showed the failure.
Oh! So the patch didn't fix it for you?
Quoted 5 lines
I am running GCC 11.5.0 and without any patches to "make". I take it that I need to find and apply CentOS Stream 9's make-4.3-cloexec.patch?
But if I use "make -j" instead of rcutorture, this patch does work fine. Even with "make -j632".
Without rcutorture was "make -jNN" broken for you without this patch?
Quoted 8 lines
Quoted 5 lines
I put rcutorture in the background using nohup and full redirection, but "nohup make -j632 >
/tmp/Make.out2>&1 </dev/null&" works just fine. And running rcutorture in the foreground still fails.Very strange.
O_OIt only breaks ... when backgrounded? Oh my. Okay, I will try to figure that out.Apologies, let me present my results in a more organized fashion:
foreground background -next Fix -next Fix make -jN Bug Good Bug Good kvm.sh [1] Bug Bug Bug Bug
Quoted 5 lines
[1]
tools/testing/selftests/rcutorture/bin/kvm.sh--build-only --allcpus --configs TREE02 --trust-makeHere, -next is next-20261008, and Fix is with your patch on it.
Just as mystifying to me, to be honest!
Ah, I think I found it, but I'm not sure why kvm.sh tripped it but bare "make" didn't. I missed the non-literal forms:
$(call if_changed,$(compress-y))
I'll send a v2 with docs updated too.
Signature · 1 line
Kees Cook
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 59 lines · Kees Cook
Quoted 58 lines · Paul E. McKenney
Quoted 35 lines · Kees Cook
Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Kees Cook
Since commit
48ebe1cbbeb51("kbuild: compress the kernel with pigz if available"),cmd_gzipruns pigz throughscripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints:WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')Mark the gzip recipes as recursive with "+", as commit
ecab4115c44cc("kbuild: markrustc(and others) invocations as recursive") did for rustc. As with those, "make -n" now runs them.Quoted 8 lines
Quoted 4 lines
Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without this change the warning appears and pigz runs with "-p 1"; with it there is no warning, and pigz runs with "-p 54" and "-p 64".
Thank you, Kees!
My initial test of this patch (using rcutorture) still showed the failure.
Oh! So the patch didn't fix it for you?
Quoted 5 lines
I am running GCC 11.5.0 and without any patches to "make". I take it that I need to find and apply CentOS Stream 9's make-4.3-cloexec.patch?
But if I use "make -j" instead of rcutorture, this patch does work fine. Even with "make -j632".
Without rcutorture was "make -jNN" broken for you without this patch?
Quoted 8 lines
Quoted 5 lines
I put rcutorture in the background using nohup and full redirection, but "nohup make -j632 >
/tmp/Make.out2>&1 </dev/null&" works just fine. And running rcutorture in the foreground still fails.Very strange.
O_OIt only breaks ... when backgrounded? Oh my. Okay, I will try to figure that out.Apologies, let me present my results in a more organized fashion:
foreground background -next Fix -next Fix make -jN Bug Good Bug Good kvm.sh [1] Bug Bug Bug Bug[1]
tools/testing/selftests/rcutorture/bin/kvm.sh--build-only --allcpus --configs TREE02 --trust-makeHere, -next is next-20261008, and Fix is with your patch on it.
Quoted 8 lines
Quoted 1 line
Just as mystifying to me, to be honest!
Ah, I think I found it, but I'm not sure why
kvm.shtripped it but bare "make" didn't. I missed the non-literal forms:$(call if_changed,$(compress-y))I'll send a v2 with docs updated too.
Done for the day, but I will test tomorrow. Again, thank you!
Thanx, Paul
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
In reply to Paul E. McKenneyQuoted 8 lines · Paul E. McKenney
foreground background -next Fix -next Fix make -jN Bug Good Bug Good kvm.sh [1] Bug Bug Bug Bug[1]
tools/testing/selftests/rcutorture/bin/kvm.sh--build-only --allcpus --configs TREE02 --trust-make
Thanks for the details! IIUC, the difference is the config, not foreground vs background. kvm-build.sh adds CONFIG_INITRAMFS_SOURCE, which is compressed with gzip by default. The usr/Makefile target picks that compressor through a variable, so v1 missed it. Your plain "make -jN" builds probably had no built-in initramfs, so the kernel image was the only place where pigz ran, which v1 did cover.
Hopefully v2 has all the missed targets fixed now:
https://lore.kernel.org/lkml/[email protected]/T/#m3b466b33f835119bfbd0c1b3c48d2a8a87f31691
-Kees
Signature · 1 line
Kees Cook
Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive
Quoted 8 lines · Kees Cook
Quoted 7 lines · Paul E. McKenney
foreground background -next Fix -next Fix make -jN Bug Good Bug Good kvm.sh [1] Bug Bug Bug Bug
Quoted 8 lines
Quoted 1 line
[1]
tools/testing/selftests/rcutorture/bin/kvm.sh--build-only --allcpus --configs TREE02 --trust-makeThanks for the details! IIUC, the difference is the config, not foreground vs background.
kvm-build.shaddsCONFIG_INITRAMFS_SOURCE, which is compressed with gzip by default. The usr/Makefile target picks that compressor through a variable, so v1 missed it. Your plain "make -jN" builds probably had no built-in initramfs, so the kernel image was the only place where pigz ran, which v1 did cover.
I don't feel quite so bad for not having any idea why running "make" from kvm.sh would make a difference. ;-)
Quoted 2 lines
Hopefully v2 has all the missed targets fixed now:
https://lore.kernel.org/lkml/[email protected]/T/#m3b466b33f835119bfbd0c1b3c48d2a8a87f31691
It does work for me, thank you very much!!!
Thanx, Paul
PATCH 2/2 kbuild: Mark the initcall ordering recipe as recursive
In reply to Kees Cookgenerate_initcall_order.pl, which orders initcalls for Clang LTO, forks a child per input file, up to the job count scripts/jobserver-exec passes it in PARALLELISM. It used to run from link-vmlinux.sh, which the top-level Makefile invokes as a recursive recipe, but commit 5d45950dfbb15 ("kbuild: move vmlinux.o link to scripts/Makefile.vmlinux_o") moved it into a recipe without "+".
GNU Make passes the jobserver pipe only to recipes it treats as recursive, and the make 4.3 in CentOS Stream 9 also hides it in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it and prints:
WARNING: Unable to reopen jobserver read-side pipe: FileNotFoundError(2, 'No such file or directory')
PARALLELISM is then left unset, and the script caps its children at the number of online CPUs instead of the free job slots.
Mark the recipe as recursive again.
Tested ARCH=x86_64 defconfig with CONFIG_LTO_CLANG_THIN=y, LLVM=1 (Clang 24.0.0git), and GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch.
--- scripts/Makefile.vmlinux_o | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.vmlinux_o +1 -1
@@ -19,7 +19,7 @@ quiet_cmd_gen_initcalls_lds = GEN $@ .tmp_initcalls.lds: $(srctree)/scripts/generate_initcall_order.pl \ vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE - $(call if_changed,gen_initcalls_lds) + +$(call if_changed,gen_initcalls_lds) targets := .tmp_initcalls.lds
Signature · 1 line
2.55.0
Re: [PATCH v1 2/2] kbuild: Mark the initcall ordering recipe as recursive
Quoted 35 lines
generate_initcall_order.pl, which orders initcalls for Clang LTO, forks a child per input file, up to the job count
scripts/jobserver-execpasses it in PARALLELISM. It used to run fromlink-vmlinux.sh, which the top-levelMakefileinvokes as a recursive recipe, but commit5d45950dfbb15("kbuild: move vmlinux.o link toscripts/Makefile.vmlinux_o") moved it into a recipe without "+".GNU Make passes the jobserver pipe only to recipes it treats as recursive, and the make 4.3 in CentOS Stream 9 also hides it in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it and prints:
WARNING: Unable to reopen jobserver read-side pipe:
FileNotFoundError(2, 'No such file or directory')PARALLELISM is then left unset, and the script caps its children at the number of online CPUs instead of the free job slots.
Mark the recipe as recursive again.
Tested ARCH=x86_64 defconfig with
CONFIG_LTO_CLANG_THIN=y, LLVM=1 (Clang 24.0.0git), and GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch.Fixes 5d45950dfbb15 ("kbuild: move vmlinux.o link to scripts/Makefile.vmlinux_o")Assisted-by LLMSigned-off-by Kees Cook <[email protected]>--- scripts/Makefile.vmlinux_o | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/Makefile.vmlinux_o +0
-0
scripts/Makefile.vmlinux_o quiet_cmd_gen_initcalls_lds = GEN $@ · line 22
Quoted 5 lines
scripts/Makefile.vmlinux_o +1
-1@@ -19,7 +19,7 @@ quiet_cmd_gen_initcalls_lds = GEN $@ .tmp_initcalls.lds: $(srctree)/scripts/generate_initcall_order.pl \ vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE - $(call if_changed,gen_initcalls_lds) + +$(call if_changed,gen_initcalls_lds)
b4 hinted me on [1], where a similar fix was rejected; but as we know have more arguments to generate_initcall_order.pl ($(KBUILD_VMLINUX_LIBS)), the situation is slightly different.
Thanks!
[1]: https://lore.kernel.org/all/CAK7LNARCM=rUm8mA8GRQ7ufeyfneGf4OEvHmESKt=zuxs2KrHw@mail.gmail.com/
Signature · 1 line
Nicolas