Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1624375rdb; Sun, 19 Nov 2023 04:03:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHa2TW814v0VqWAr80Lj+TZKecr+arc7smeEzaNbdD/BizAwoli3cK2vzwCe+PXAcUZECAY X-Received: by 2002:a17:90b:106:b0:27d:1862:a494 with SMTP id p6-20020a17090b010600b0027d1862a494mr2684331pjz.11.1700395414607; Sun, 19 Nov 2023 04:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700395414; cv=none; d=google.com; s=arc-20160816; b=pgTxa2ylgV5zLY/B+IJTD45Ne45MpCGguPC+WjYfD2+c6eHve5JM4IX+TgotpyX3Ma PNe3rvog27Sk4J7yfr2iBWaWGb14ApYL8sSv4IFSQF+hE59LQxLHZZuE77s9xnNivE5l nqiL8k1Vxz6rG2IC260gVeZE6eiK2guXMnOABWHYECiN8oKAdEee3bBVtGoyNQuctbNw gTdnVY1z/TS78Am0FUY2ySXX25BQK3owUrJP1Ag7J62SBep9iCI348LmCEq583jVEwY5 /dH96oP4U3H2BxOf1bqshyDvprelcWujiCpzL5s22eaprYb7l045Pd3hozFYBxmiS0C+ xqfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UDuA4lworoG8dSjStIFW10oH0YfWe1f5i+4c54nSBCQ=; fh=DzN8lPRVB8YEWZ5l8kJDNCGUlUHLtB5W7IDQf0R64Ug=; b=SLi5MqlHTC/yeLTO5NL8vE5RkwoKdl4n9DS/Bz+cJfg7PMvPK2bnfTmGAXRALa0gJI ize6NeTrn5g5FqpjKFYyKdRrbhCbYI/irRd04P60mjYiiTzByEQkzGDbDRw1AKab8PSs RgMlbdQuqNXXRTBV2TLI6kI91DngaJrNxx+kZybQEG4rNRbKBNjI7tL+9fMm7V3Fh6mQ S6I/HVs4NK+cuQ0Hlbi54mWazVc8Pol5zEwFn1khzRqyF0zY95aodqoG2sZSCGnCZ3cI tbFpDWfvfbzsRpy99VfV9Me9HKyprdyxVTThl2DdNWw/WbCr42EvR+6ifH4VsGicGmwu tnAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNFulk5i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id z23-20020a17090a541700b0028074aabfecsi8028550pjh.128.2023.11.19.04.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 04:03:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNFulk5i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 95259805ECC2; Sun, 19 Nov 2023 04:03:33 -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 S230027AbjKSL7a (ORCPT + 99 others); Sun, 19 Nov 2023 06:59:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjKSL73 (ORCPT ); Sun, 19 Nov 2023 06:59:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20F9D8 for ; Sun, 19 Nov 2023 03:59:25 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E990C433C9; Sun, 19 Nov 2023 11:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700395165; bh=mgjBe9NyXgnGxQbQgYIlmqSGb5CeQDsjaIIrZhyneCw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tNFulk5iOsBbkFYne6Kojs1mmSNu569//aRQSIzuF+M3mgugaM/aTwyHMoLFWS7M8 9yttTyEgVqKYN8RewwjlKLcrjaqsuIhUdXJgNvjH1jnbQ8+apTh1ClYl0i2iJFR0WB IVEdVXt8Fafalt918MqPCO90K0WqZ7fCOEmeGvQcURoWjRK/78XQsI9ZMdG1c0tQhG nxGIJUF9Ui8uKxj3hRDcDv9A50JFJaY4C0cyHtFSC8z77qpqa1DPEHw1NS4q3iElkS uokZM/CP6Flfdj3AgZTPOiTOp0qlp0tl67yCHZRP0keh/c+7kuiUR35fSBk1nqlqE6 I6fjSUXYu3gAQ== Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-53e70b0a218so4943056a12.2; Sun, 19 Nov 2023 03:59:25 -0800 (PST) X-Gm-Message-State: AOJu0YyrF3uHg/GAnaB118EsrMzpJy1XfiK63rnt020wttxki0LPOZm0 hp5L0wFNirLBH/iOTqy8PrKv8xo6euSm2WLxJtc= X-Received: by 2002:aa7:d454:0:b0:548:4f58:4c98 with SMTP id q20-20020aa7d454000000b005484f584c98mr3457877edr.29.1700395163796; Sun, 19 Nov 2023 03:59:23 -0800 (PST) MIME-Version: 1.0 References: <20231119053448.2367725-1-masahiroy@kernel.org> In-Reply-To: <20231119053448.2367725-1-masahiroy@kernel.org> From: Huacai Chen Date: Sun, 19 Nov 2023 19:59:11 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] loongarch: add dependency between vmlinuz.efi and vmlinux.efi To: Masahiro Yamada Cc: WANG Xuerui , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Ard Biesheuvel , Simon Glass Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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]); Sun, 19 Nov 2023 04:03:33 -0800 (PST) Hi, Masahiro, On Sun, Nov 19, 2023 at 1:35=E2=80=AFPM Masahiro Yamada wrote: > > 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=3Dloongarch 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=3Dloongarch vmlinux.efi vmlinuz.efi > [ snip ] > SORTTAB vmlinux > OBJCOPY arch/loongarch/boot/vmlinux.efi > PAD arch/loongarch/boot/vmlinux.bin > truncate: Invalid number: =E2=80=98arch/loongarch/boot/vmlinux.bin=E2= =80=99 > 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 +=3D arch/loongarch/vdso/vdso.so.dbg > > all: $(notdir $(KBUILD_IMAGE)) > > +vmlinuz.efi: vmlinux.efi > vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux > $(Q)$(MAKE) $(build)=3D$(boot) $(bootvars-y) $(boot)/$@ It is a little strange, because in drivers/firmware/efi/libstub/Makefile.zboot: vmlinuz.efi depends on vmlinuz.efi.elf, vmlinuz.efi.elf depends on vmlinuz.o, vmlinuz.o depends on vmlinuz, vmlinuz depends on vmlinux.bin, vmlinux.bin depends on $(EFI_ZBOOT_PAYLOAD). in arch/loongarch/boot/Makefile, EFI_ZBOOT_PAYLOAD :=3D vmlinux.efi So I think vmlinuz.efi has already depend on vmlinux.efi. Huacai > > -- > 2.40.1 > >