Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1507505rdb; Sat, 18 Nov 2023 21:35:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtTwwN9NZyahXmEZ6H7ry6URS5q0LAmnylBrv2AulXSLzQ+cg2WS39HcFgPPPatDOytmpm X-Received: by 2002:a05:6830:1488:b0:6cd:2082:bfa0 with SMTP id s8-20020a056830148800b006cd2082bfa0mr4333017otq.28.1700372110245; Sat, 18 Nov 2023 21:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700372110; cv=none; d=google.com; s=arc-20160816; b=NnA4qzyQ/cNX4XP+GGyWsp+K9fghKdA14HmQE3Zfr91gQItZsxlP5dlppvu9/Co7/F 8kbuKQhoBu9BmJx+2h1tDga1yfnJlq6Rk/Zg9edpJbN+uvLppVh94okn/4N2XXVcO4Ps pt1SshXFueRYpdRpUYCutMvwmqCRGzhd4xVmj7LHzEC9WnEgqdEXqoAhmv4bgK7j890m eTuNgAq5pbt/yHJkyrcCpEi1+l6ZSgpDpxVa2TFnE7sm/jZezckxUuM28wPnvkLbtlZS a7PfQFjPh0Ln1JByzx+EIgRDSqRHLEvEYUC7Etmks+jfQz9YrIYXgiVAfkRromhuTtg+ YC7w== 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=l6KRPb5rQ42LF8Lv9fAhfJaMEF/I+z3SQmWO22W1Y5Y=; fh=MvfJMdVRrePe/l5NnvKVA1++6t22EBfcVd/W7TxEL1w=; b=gWUQmlMPNwd5jJHEEJffScNe5fdShvvkPlqVqYbG4KJkqI5kVTW88ie9fyXhTCzbFH AP09qBJFAz130q+ICO4hQ8R9a6v/uV9siw2BFxPbF4HZ0VWSMFaYzxcVQoF0IVbNOME5 aMjtFsrJiHtOfPoEidSvPBC3U7BO6q1KGHiNtDsN6Oa3EIJjL9W46yYU5WWGfQHpjHXM j7UigmHAh7iZZABDFy4apr7VUxnm382cpWpHDHALxd4pd2aJS4ysXxvKfYQZc6p2rKuG VrEOq9Ybk6je5jNWB/VBYESSCVVk5yJMCrBbTVpgOXC7F/SDvPtLsdBFQc738mFD//7v vL4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T7mlj5GU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e9-20020a170902d38900b001c9c3f327e1si5478338pld.191.2023.11.18.21.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:35:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T7mlj5GU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id E9F1A80A919F; Sat, 18 Nov 2023 21:35:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbjKSFfE (ORCPT + 99 others); Sun, 19 Nov 2023 00:35:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjKSFfC (ORCPT ); Sun, 19 Nov 2023 00:35:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F4FE0 for ; Sat, 18 Nov 2023 21:34:59 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4417EC433C8; Sun, 19 Nov 2023 05:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700372099; bh=08ranJTDZ/V2FeaQz06DOfRs9FrKM8GbfKs8aPV/pJ0=; h=From:To:Cc:Subject:Date:From; b=T7mlj5GUg5Ir2bPEcJD672ID2zy1JFi6zQqSV/b06D0APxoOpxxRwLqkZJo9U/gho 4E91B5jnTQfg0EBCqq1aoHQ0G6MupKhi48gJ9n8a+NUPdQMXzBG4GYyUfsymrpMiTe QsasBKKCtXNl8rpQMWS7/R0Q4OzHmkr0g0hmPJpXeWu7ENeLji/9yYUc91/hGQo7jh OpGS3IipJk87W9vaifTYcSBrnn0q5dvfpkAPg/c4+xqrCHCEWOdJX5jmaDL4eXunKR aGDZVSLbP/6TnwyngJZ80Gl7jXmPNAi4g2GwixD6/udG90dSATaW7GkozapYOMzo8O dzFGWJ6aDxc1w== From: Masahiro Yamada To: Huacai Chen , WANG Xuerui , loongarch@lists.linux.dev Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Ard Biesheuvel , Simon Glass , Masahiro Yamada Subject: [PATCH] loongarch: add dependency between vmlinuz.efi and vmlinux.efi Date: Sun, 19 Nov 2023 14:34:48 +0900 Message-Id: <20231119053448.2367725-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 18 Nov 2023 21:35:09 -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=loongarch vmlinux.efi vmlinuz.efi [ snip ] SORTTAB vmlinux OBJCOPY arch/loongarch/boot/vmlinux.efi OBJCOPY arch/loongarch/boot/vmlinux.efi PAD arch/loongarch/boot/vmlinux.bin GZIP arch/loongarch/boot/vmlinuz OBJCOPY arch/loongarch/boot/vmlinuz.o LD arch/loongarch/boot/vmlinuz.efi.elf OBJCOPY arch/loongarch/boot/vmlinuz.efi The log "OBJCOPY arch/loongarch/boot/vmlinux.efi" is displayed twice. It indicates that two threads simultaneously enter arch/loongarch/boot/ and write to arch/loongarch/boot/vmlinux.efi. It occasionally leads to a build failure: $ make -j$(nproc) ARCH=loongarch vmlinux.efi vmlinuz.efi [ snip ] SORTTAB vmlinux OBJCOPY arch/loongarch/boot/vmlinux.efi PAD arch/loongarch/boot/vmlinux.bin truncate: Invalid number: ‘arch/loongarch/boot/vmlinux.bin’ make[2]: *** [drivers/firmware/efi/libstub/Makefile.zboot:13: arch/loongarch/boot/vmlinux.bin] Error 1 make[2]: *** Deleting file 'arch/loongarch/boot/vmlinux.bin' make[1]: *** [arch/loongarch/Makefile:146: vmlinuz.efi] Error 2 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:234: __sub-make] Error 2 vmlinuz.efi depends on vmlinux.efi, but such a dependency is not specified in arch/loongarch/Makefile. Signed-off-by: Masahiro Yamada --- arch/loongarch/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index 9eeb0c05f3f4..6022bf3d30c9 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -142,6 +142,7 @@ vdso-install-y += arch/loongarch/vdso/vdso.so.dbg all: $(notdir $(KBUILD_IMAGE)) +vmlinuz.efi: vmlinux.efi vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@ -- 2.40.1