Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1507524rdb; Sat, 18 Nov 2023 21:35:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqCxVnAZv19PoW4Hbjnk1TkPtPUsq4ha26N7LrxXzaQ/SGkgYllQphPxu+bh5j/F9y74SU X-Received: by 2002:a17:90b:4c06:b0:280:e2e1:f955 with SMTP id na6-20020a17090b4c0600b00280e2e1f955mr4315025pjb.35.1700372114892; Sat, 18 Nov 2023 21:35:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700372114; cv=none; d=google.com; s=arc-20160816; b=Idgu++tmNTJsUKwrFOBMO0UQINnsVT2qeVJvZb38E0bc9sXwJzgM3vA9VGq4LWeEnQ GJpCiDAOsJAGzimKTK3gLpVIl5bN7CLpBcy7q/JZeClVhQHCrY44afKg0WV6fkxlysOp gio2skXiW08kniP4F0VqRIvZA+OB6nw2qI2bcXnJBJ5SnKn81jqSJXt0Bpv/OZTROtQu m/1jU7y1USFqGfc6eKyKPXfZELLmvHUmElJYdhdzJVMq93RuYejOlfMl956JZZylGTo7 78R0A9jaGUoiXMgY1ry6LmU4s/L8IsN5Mc8PPYNVchWx5L3mr6inSpbYLkJKudZWpeAW ZgSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GPjdsfzbrbUFfk7o9ze/O23Z6E5ApTEVq6Pkph/sMws=; fh=GeJieWW4jDIDNfHqRzF3dI8+P7tNbQC1QYKJZDE2I3I=; b=KGzGHUDqF/F27UAUYMkL1nvq2IgmkDU/aZs86MnSpzTVxVHJcF/Oas2fb6rdmBfSja ksCfZXGtz2BWPv33k5msJCSh725UYHfhy5KgqUT2dssvwsbSWQ6GS+JoFc/R/XTZShvk Rl2H2Bkvm4Ir3bUOAoq7DJo8Ym6hzLTvHm5QEqqh0v5+TjTGRDW3OhTVZmUy/IsiqkJD Ybb+xAEW8n2OMiZEqTfyj8X9pTIVS8IAMaKspF2J/BJ1klu8EH67Fynrw/A3IpuHdM2O LCowRJ7ff9s6V+Gm6vLrmeThrVO8ajziDNCYBGG5VGIGWj7fH4V545Je3sXoFXpa7OKT J4Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ItDSwe0z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id 59-20020a17090a09c100b002791035445esi5482800pjo.76.2023.11.18.21.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:35:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ItDSwe0z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3CF59808EF7E; Sat, 18 Nov 2023 21:35:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbjKSFcs (ORCPT + 99 others); Sun, 19 Nov 2023 00:32:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjKSFcq (ORCPT ); Sun, 19 Nov 2023 00:32:46 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CDAE182 for ; Sat, 18 Nov 2023 21:32:43 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 18 Nov 2023 21:35:12 -0800 (PST) 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 --- 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)/$@ -- 2.40.1