From patchwork Fri Jul 8 11:27:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 71672 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp399776qgy; Fri, 8 Jul 2016 04:29:22 -0700 (PDT) X-Received: by 10.98.59.77 with SMTP id i74mr9025200pfa.45.1467977362053; Fri, 08 Jul 2016 04:29:22 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id o6si5425263pac.39.2016.07.08.04.29.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jul 2016 04:29:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLTxK-0008QT-F7; Fri, 08 Jul 2016 11:28:26 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLTxH-0008I4-Oz for linux-arm-kernel@lists.infradead.org; Fri, 08 Jul 2016 11:28:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D60A428; Fri, 8 Jul 2016 04:29:03 -0700 (PDT) Received: from e104818-lin.cambridge.arm.com (e104818-lin.cambridge.arm.com [10.1.203.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 73FF93F41F; Fri, 8 Jul 2016 04:28:02 -0700 (PDT) Date: Fri, 8 Jul 2016 12:27:59 +0100 From: Catalin Marinas To: Kevin Brodsky Subject: Re: [PATCH RESEND] arm64: fix vdso-offsets.h dependency Message-ID: <20160708112759.GA22099@e104818-lin.cambridge.arm.com> References: <1463071155-7435-1-git-send-email-kevin.brodsky@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1463071155-7435-1-git-send-email-kevin.brodsky@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160708_042823_832040_6A18AAC3 X-CRM114-Status: GOOD ( 18.97 ) X-Spam-Score: -8.3 (--------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-8.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.101.70 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Marek , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org On Thu, May 12, 2016 at 05:39:15PM +0100, Kevin Brodsky wrote: > I am not completely satisfied with the fix, since it uses a hack with > the prepare and prepare0 rules that should not be used in arch > Makefiles. However, all of my other attempts (including explicit > dependencies on gettimeofday.S, etc. in arm64/kernel/Makefile) failed > in some way. Hopefully, a Makefile wizard will come up with a better > solution. This is the patch I'm going to push to arm64 for-next/core. Thanks for the report and attempt at fixing it, it saved me from trying to understand what was going on: -------------8<------------------------------------ >From 19a5ab422b6ca3b3c8f656ca6d697dbfb577d360 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 8 Jul 2016 12:13:20 +0100 Subject: [PATCH] arm64: Fix vdso-offsets.h dependency arch/arm64/kernel/{vdso,signal}.c include generated/vdso-offsets.h, and therefore the symbol offsets must be generated before these files are compiled. The current rules in arm64/kernel/Makefile do not actually enforce this, because even though $(obj)/vdso is listed as a prerequisite for vdso-offsets.h, this does not result in the intended effect of building the vdso subdirectory (before all the other objects). As a consequence, depending on the order in which the rules are followed, vdso-offsets.h is updated or not before arm64/kernel/{vdso,signal}.o are built. The current rules also impose an unnecessary dependency on vdso-offsets.h for all arm64/kernel/*.o, resulting in unnecessary rebuilds. This patch removes the arch/arm64/kernel/vdso/vdso-offsets.h file generation, leaving only the include/generated/vdso-offsets.h one. It adds a forced dependency check of the vdso-offsets.h file in arch/arm64/kernel/Makefile which, if not up to date according to the arch/arm64/kernel/vdso/Makefile rules (depending on vdso.so.dbg), will trigger the vdso/ subdirectory build and vdso-offsets.h re-generation. Automatic kbuild dependency rules between kernel/{vdso,signal}.c rules and vdso-offsets.h will guarantee that the vDSO object is built first, followed by the generated symbol offsets header file. Reported-by: Kevin Brodsky Signed-off-by: Catalin Marinas --- arch/arm64/kernel/Makefile | 7 ++++--- arch/arm64/kernel/vdso/Makefile | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 7700c0c23962..b4f0a03dc830 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -54,6 +54,7 @@ obj-m += $(arm64-obj-m) head-y := head.o extra-y += $(head-y) vmlinux.lds -# vDSO - this must be built first to generate the symbol offsets -$(call objectify,$(arm64-obj-y)): $(obj)/vdso/vdso-offsets.h -$(obj)/vdso/vdso-offsets.h: $(obj)/vdso +# Check that the vDSO symbol offsets header file is up to date and re-generate +# it if necessary. +$(objtree)/include/generated/vdso-offsets.h: FORCE + $(Q)$(MAKE) $(build)=$(obj)/vdso $@ diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index b467fd0a384b..70fb663ddf7b 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -23,7 +23,7 @@ GCOV_PROFILE := n ccflags-y += -Wl,-shared obj-y += vdso.o -extra-y += vdso.lds vdso-offsets.h +extra-y += vdso.lds CPPFLAGS_vdso.lds += -P -C -U$(ARCH) # Force dependency (incbin is bad) @@ -42,11 +42,10 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh quiet_cmd_vdsosym = VDSOSYM $@ define cmd_vdsosym - $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \ - cp $@ include/generated/ + $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ endef -$(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE +$(objtree)/include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg $(call if_changed,vdsosym) # Assembly rules for the .S files