From patchwork Tue Apr 9 14:57:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10891407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8B32922 for ; Tue, 9 Apr 2019 14:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C516B2000A for ; Tue, 9 Apr 2019 14:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B675E279E0; Tue, 9 Apr 2019 14:59:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D58B2000A for ; Tue, 9 Apr 2019 14:59:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hDsBj-0006jt-Pq; Tue, 09 Apr 2019 14:57:27 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hDsBi-0006jo-TL for xen-devel@lists.xenproject.org; Tue, 09 Apr 2019 14:57:26 +0000 X-Inumbo-ID: c91a070a-5ad7-11e9-92d7-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c91a070a-5ad7-11e9-92d7-bc764e045a96; Tue, 09 Apr 2019 14:57:25 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Tue, 09 Apr 2019 08:57:24 -0600 Message-Id: <5CACB2D10200007800225EDC@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Tue, 09 Apr 2019 08:57:21 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] x86: fix build race when generating temporary object files X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The rules to generate xen-syms and xen.efi may run in parallel, but both recursively invoke $(MAKE) to build symbol/relocation table temporary object files. These recursive builds would both re-generate the .*.d2 files (where needed). Both would in turn invoke the same rule, thus allowing for a race on the .*.d2.tmp intermediate files. The dependency files of the temporary .xen*.o files live in xen/ rather than xen/arch/x86/ anyway, so won't be included no matter what. Take the opportunity and delete them, as the just re-generated .xen*.S files will trigger a proper re-build of the .xen*.o ones anyway. Empty the DEPS variable in case the set of goals consists of just those temporary object files, thus eliminating the race. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -145,7 +145,7 @@ $(TARGET)-syms: prelink.o xen.lds $(NM) -pa --format=sysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --xensyms --sysv --sort \ >$(@D)/$(@F).map - rm -f $(@D)/.$(@F).[0-9]* + rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* note.o: $(TARGET)-syms $(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(BASEDIR)/xen-syms $@.bin @@ -208,7 +208,7 @@ $(TARGET).efi: prelink-efi.o $(note_file if $(guard) false; then rm -f $@; echo 'EFI support disabled'; \ else $(NM) -pa --format=sysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --xensyms --sysv --sort >$(@D)/$(@F).map; fi - rm -f $(@D)/.$(@F).[0-9]* + rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: $(BASEDIR)/arch/x86/efi/built_in.o efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ; @@ -253,3 +253,9 @@ clean:: rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin rm -f note.o + +# Suppress loading of DEPS files for internal, temporary target files. This +# then also suppresses re-generation of the respective .*.d2 files. +ifeq ($(filter-out .xen%.o,$(notdir $(MAKECMDGOALS))),) +DEPS:= +endif