mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 15:32:04 +02:00
kbuild: Mark the gzip recipes as recursive
Since commit48ebe1cbbe("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 every recipe that can run cmd_gzip as recursive with "+", as commitecab4115c4("kbuild: mark `rustc` (and others) invocations as recursive") did for rustc. Besides the $(call if_changed,gzip) rules, this covers those that choose gzip through a variable: the built-in initramfs in usr/Makefile (which rcutorture's kvm.sh builds), the EFI zboot image, and the arm, csky, and mips compressed images. As with rustc, "make -n" now runs these recipes, including those that choose through a variable when they select another compressor. Also update the gzip entry in Documentation/kbuild/makefiles.rst, as suggested in review. Tested with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64, on ARCH=x86_64, arm64, and arm defconfig, and ARCH=x86_64 defconfig with a built-in initramfs: none of them prints the warning, and pigz gets the free job slots (-p 54, 64, and 50 for the kernel image). Without this change, the x86_64 builds print it for the kernel image and for the initramfs. Reported-by: Paul E. McKenney <paulmck@kernel.org> Closes: https://lore.kernel.org/all/0ddb5e5e-f801-444c-aa98-0cfe814a3026@paulmck-laptop/ Fixes:48ebe1cbbe("kbuild: compress the kernel with pigz if available") Assisted-by: LLM Reviewed-by: Nicolas Schier <n.schier@fritz.com> Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Signed-off-by: Kees Cook <kees@kernel.org> Tested-by: Paul E. McKenney <paulmck@kernel.org> Link: https://patch.msgid.link/20261010081914.540611-1-kees@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
This commit is contained in:
parent
7202c08793
commit
0d4d70da34
|
|
@ -1452,13 +1452,16 @@ 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. Prefix the
|
||||
recipe line with '+' so that GNU Make passes it the jobserver, which
|
||||
scripts/jobserver-exec needs to run pigz (if available) on the free job
|
||||
slots.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
|
|||
@$(check_for_bad_syms)
|
||||
|
||||
$(obj)/piggy_data: $(obj)/../Image FORCE
|
||||
$(call if_changed,$(compress-y))
|
||||
+$(call if_changed,$(compress-y))
|
||||
|
||||
$(obj)/piggy.o: $(obj)/piggy_data
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ compress-$(CONFIG_KERNEL_XZ) = xzkern
|
|||
compress-$(CONFIG_KERNEL_LZ4) = lz4
|
||||
|
||||
$(obj)/zImage: $(obj)/Image FORCE
|
||||
$(call if_changed,$(compress-y))
|
||||
+$(call if_changed,$(compress-y))
|
||||
@echo ' Kernel: $@ is ready'
|
||||
|
||||
UIMAGE_ARCH = sandbox
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ tool_$(CONFIG_KERNEL_ZSTD) = zstd22_with_size
|
|||
targets += vmlinux.bin.z
|
||||
|
||||
$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
|
||||
$(call if_changed,$(tool_y))
|
||||
+$(call if_changed,$(tool_y))
|
||||
|
||||
targets += piggy.o dummy.o
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ zboot-method-$(CONFIG_KERNEL_ZSTD) := zstd22_with_size
|
|||
zboot-size-len-$(CONFIG_KERNEL_ZSTD) := 4
|
||||
|
||||
$(obj)/vmlinuz: $(obj)/vmlinux.bin FORCE
|
||||
$(call if_changed,$(zboot-method-y))
|
||||
+$(call if_changed,$(zboot-method-y))
|
||||
|
||||
# avoid eager evaluation to prevent references to non-existent build artifacts
|
||||
OBJCOPYFLAGS_vmlinuz.o = -I binary -O $(EFI_ZBOOT_BFD_TARGET) $(EFI_ZBOOT_OBJCOPY_FLAGS) \
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ $(obj)/initramfs_data.cpio: $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_
|
|||
endif
|
||||
|
||||
$(obj)/initramfs_inc_data: $(cpio-data) FORCE
|
||||
$(call if_changed,$(compress-y))
|
||||
+$(call if_changed,$(compress-y))
|
||||
|
||||
targets += initramfs_data.cpio initramfs_inc_data
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user