From patchwork Sun Nov 19 05:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13460323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F882C072A2 for ; Sun, 19 Nov 2023 05:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=76YuQ1FLPUmCf8jDfP8diKbzHUMK562/chxy77Ku9H4=; b=WL1fyPph02tcNb jyHScZFGM4t5HA2UFlyLRv2uwacZynZHR6KI0k9YuAqE4CXHQAzwQXfj9N8AqOO8kK+EPbzqAz/w3 SnNfBfB09p1nINXszeC56QLu4+rsbiVMVy42nARbx4McssT30vrXTVyLqYEU2WEdSzczKcToBND+E QNax9EXmRPNTdDsnpVNKpmk7boVoTmzSSMRwJEcM7ybaXS2x2LrefUM1Axdu6En8jQ82QzTU8AqkF xbrmH/kfvPJLm8OCjlybS5CIjnR1lFukayz6oozPlMkCqNxEMAGfkuixf4RWnyYaMH3pc1e+3TOA3 NKSgO7o3vfCACYE2u0Dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r4aQN-009YYp-06; Sun, 19 Nov 2023 05:32:51 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r4aQJ-009YY8-2s for linux-arm-kernel@lists.infradead.org; Sun, 19 Nov 2023 05:32:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5BD12CE0AF2; Sun, 19 Nov 2023 05:32:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 804EAC433C8; Sun, 19 Nov 2023 05:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700371962; bh=q2CXtWLrjQSU6v2TX31hrhnxbzzNC8tayyo4CW4QiQ8=; h=From:To:Cc:Subject:Date:From; b=ItDSwe0zoyH4wntxB9RCiIScC/C0hCDFUdKwnxIxYka4Xz4fvaa32WQWrFSIiYIYd vWcE4aAfT9Wgg23v4MfW8VUihBekREtO54dJtkZwFoOXcVszl/+zidshJIwNaBT6gd nki+xx+tneERWHUHySGpex4G5FjcIgrNN5RBEM5nqfP/w1k5aBb1gPzi9Zzl87+wXG ZD03ZNOuXISAzNWzGhGPINirZDCxo0tvKj4ca7bmWAk8uFkCh+Gie3b7s4ABx0v4k9 FovgdsxuhzciXu/QpuXG0X36U5oEWS6sLL/o/tj5zvC/EvNuWJBl/fEhH/4FANjgV/ aQ5LIUjFHOwqQ== From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Ard Biesheuvel , Simon Glass , Masahiro Yamada Subject: [PATCH] arm64: add dependency between vmlinuz.efi and Image Date: Sun, 19 Nov 2023 14:32:34 +0900 Message-Id: <20231119053234.2367621-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231118_213248_124513_53CFD647 X-CRM114-Status: GOOD ( 10.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A common issue in Makefile is a race in parallel building. You need to be careful to prevent multiple threads from writing to the same file simultaneously. Commit 3939f3345050 ("ARM: 8418/1: add boot image dependencies to not generate invalid images") addressed such a bad scenario. A similar symptom occurs with the following command: $ make -j$(nproc) ARCH=arm64 Image vmlinuz.efi [ snip ] SORTTAB vmlinux OBJCOPY arch/arm64/boot/Image OBJCOPY arch/arm64/boot/Image AS arch/arm64/boot/zboot-header.o PAD arch/arm64/boot/vmlinux.bin GZIP arch/arm64/boot/vmlinuz OBJCOPY arch/arm64/boot/vmlinuz.o LD arch/arm64/boot/vmlinuz.efi.elf OBJCOPY arch/arm64/boot/vmlinuz.efi The log "OBJCOPY arch/arm64/boot/Image" is displayed twice. It indicates that two threads simultaneously enter arch/arm64/boot/ and write to arch/arm64/boot/Image. It occasionally leads to a build failure: $ make -j$(nproc) ARCH=arm64 Image vmlinuz.efi [ snip ] SORTTAB vmlinux OBJCOPY arch/arm64/boot/Image PAD arch/arm64/boot/vmlinux.bin truncate: Invalid number: 'arch/arm64/boot/vmlinux.bin' make[2]: *** [drivers/firmware/efi/libstub/Makefile.zboot:13: arch/arm64/boot/vmlinux.bin] Error 1 make[2]: *** Deleting file 'arch/arm64/boot/vmlinux.bin' make[1]: *** [arch/arm64/Makefile:163: vmlinuz.efi] Error 2 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:234: __sub-make] Error 2 vmlinuz.efi depends on Image, but such a dependency is not specified in arch/arm64/Makefile. Signed-off-by: Masahiro Yamada Acked-by: Ard Biesheuvel Reviewed-by: SImon Glass --- arch/arm64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 4a1ad3248c2d..47ecc4cff9d2 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -158,7 +158,7 @@ endif all: $(notdir $(KBUILD_IMAGE)) - +vmlinuz.efi: Image Image vmlinuz.efi: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@