From patchwork Wed Mar 4 03:20:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11419251 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3701E1395 for ; Wed, 4 Mar 2020 03:20:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 127A220842 for ; Wed, 4 Mar 2020 03:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583292055; bh=fxNureI0SDMgNHiWeGL7qS5Vck84hlUIsKAyHtA/trs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iEag66+NS2wMo+f+khF6DUoxuGYBdc+W1nr6o9xh6HfH/80tg5qSQV/CIrZzhy7Gd QqAL085TlLCqBiiplyfyP58DIkRA0yNOgp2nagMogL9C+YJriy4zzvqN8ZXEapgGrG Pyd+OkrLI7lbDJDTht1v0p6DgLXA2cQo5xvE/3BY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387488AbgCDDUv (ORCPT ); Tue, 3 Mar 2020 22:20:51 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:63010 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387400AbgCDDUv (ORCPT ); Tue, 3 Mar 2020 22:20:51 -0500 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id 0243Kef4018747; Wed, 4 Mar 2020 12:20:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 0243Kef4018747 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1583292043; bh=j/IEXPyN2YTrKsama+5BMbGYiocPgs/XNZE+gIHR2cA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTXMER0/QLCdEHNuzY3kb6EAOgk8Xb1FCck1+8E3Vfb9UvnmM4t2vJQEJLG7/1RZc QIw3hiPC+fMK2r6RokLrKcykZ4Gj/ZCkb01kLcu5NcTDTOcPo8etJNtWgqypLGeIP7 3+3kPVAkwf3nYqzOxSNprLzAi22qAuXZMZVlJFjKPj2SdveH8BhAM4efooY0vbVWM1 Op2cLYSogk3tDbY8mmFrA1vTRHJOCZp8eg4vzAwvUl162qJUt8A2lZPu2EkkzIsn4w hLHbDWnuah52ycOZLHxOiDLEtU/bPgi+Hylh8J0t2WEPDWZCQZJByERfnZ0RcDkDi3 p6CxSY1HCFv/A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH 1/3] kbuild: avoid concurrency issue in parallel building dtbs and dtbs_check Date: Wed, 4 Mar 2020 12:20:36 +0900 Message-Id: <20200304032038.14424-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200304032038.14424-1-masahiroy@kernel.org> References: <20200304032038.14424-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 'make dtbs_check' checks the shecma in addition to building *.dtb files, in other words, 'make dtbs_check' is a super-set of 'make dtbs'. So, you do not have to do 'make dtbs dtbs_check', but I want to keep the build system robust in any use. Currently, 'dtbs' and 'dtbs_check' are independent of each other. In parallel building, two threads descend into arch/*/boot/dts/, one for dtbs and the other for dtbs_check, then end up with building the same DTB simultaneously. This commit fixes the concurrency issue. Otherwise, I see build errors like follows: $ make ARCH=arm64 defconfig $ make -j16 ARCH=arm64 DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/psci.yaml dtbs dtbs_check DTC arch/arm64/boot/dts/qcom/sdm845-cheza-r2.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-evk.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb DTC arch/arm64/boot/dts/zte/zx296718-pcbox.dtb DTC arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1254-revA.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dtb DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-inx.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb CHECK arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml fixdep: error opening file: arch/arm64/boot/dts/allwinner/.sun50i-h6-orangepi-lite2.dtb.d: No such file or directory make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb] Error 2 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb' make[2]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-kd.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p231.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1275-revA.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dtb fixdep: parse error; no targets found make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb] Error 1 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb' make[1]: *** [scripts/Makefile.build:505: arch/arm64/boot/dts/allwinner] Error 2 make[1]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb Signed-off-by: Masahiro Yamada Reviewed-by: Rob Herring --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1a1a0d271697..e94d4fe3ef77 100644 --- a/Makefile +++ b/Makefile @@ -1240,11 +1240,15 @@ ifneq ($(dtstree),) $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ PHONY += dtbs dtbs_install dtbs_check -dtbs dtbs_check: include/config/kernel.release scripts_dtc +dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) +ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) +dtbs: dt_binding_check +endif + dtbs_check: export CHECK_DTBS=1 -dtbs_check: dt_binding_check +dtbs_check: dtbs dtbs_install: $(Q)$(MAKE) $(dtbinst)=$(dtstree) From patchwork Wed Mar 4 03:20:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11419253 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E066D1395 for ; Wed, 4 Mar 2020 03:20:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF98320842 for ; Wed, 4 Mar 2020 03:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583292057; bh=8YUvdXDezoM5CG8QuAI/vtOsPmLff3AbFDzYAgMXRnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Yvyv7574jyfGIoUfbsdTZdkGFdO6DQVw3JyBqDw1kFiUIzXwWjrcnmVmlocY3hZ7D ihlF1Wy5wDMXxd4guGhSEpE8vZlDNq/bfZjStTCnYvT4NFUJiR7YoCzhwcvw1661uP GFHVojZkxkjx/P/A3VSyF9RrUvJMOT3WY0RFcaeA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387610AbgCDDUy (ORCPT ); Tue, 3 Mar 2020 22:20:54 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:63149 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387400AbgCDDUy (ORCPT ); Tue, 3 Mar 2020 22:20:54 -0500 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id 0243Kef5018747; Wed, 4 Mar 2020 12:20:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 0243Kef5018747 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1583292044; bh=/spgZZY+Twg+pGNj9Te1pbXdg5mt/UTIkgaSlvJsHmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z0SgdyPncXlNCxZ7MMLUxqgz3G6Rg6uOG8/JSaN54eaMY7VO+t9rJHP3QP8wCk1mP eBxK/mMFmhnZrsAVM4bUfx92LMdcn95mrX5uGZRG+IdzqpDTYCBuIUPMEZPwBJ9XIA DpZ/zJKkpQ9J2xgl7xMBqBjIOlPaETqpHf9UnO2EnET3lRmKQCUXMUPyKOrRKXo+5y 9XA4/9eq/1EcOxDDdimOXxi6a9/c7/240pgbcI90l/AQ4xRbvKprdLSoliA3weGR9L WWmS1rAl95GpG+K8Y3C9aQlvjnu+02QEgQqdtt7buuA3Rw7eGakdg7yQ36GyG6HJiL 1Z/Ok/ji2Advw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Mark Rutland , Maxime Ripard , Michal Marek Subject: [PATCH 2/3] kbuild: allow to run dt_binding_check and dtbs_check in a single command Date: Wed, 4 Mar 2020 12:20:37 +0900 Message-Id: <20200304032038.14424-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200304032038.14424-1-masahiroy@kernel.org> References: <20200304032038.14424-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Since commit 93512dad334d ("dt-bindings: Improve validation build error handling"), 'make dtbs_check' does not validate the schema fully. If you want to check everything, you need to run two commands. $ make ARCH=arm dt_binding_check $ make ARCH=arm dtbs_check They are exclusive each other, so you cannot do like this: $ make ARCH=arm dt_binding_check dtbs_check In this case, dt-doc-validate and dt-extract-example are skipped because CHECK_DTBS is set. Let's make it possible to run those two targets simultaneously. It will be useful for schema writers. Signed-off-by: Masahiro Yamada Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/Makefile | 8 +++----- Documentation/devicetree/writing-schema.rst | 4 ++++ Makefile | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index b62c0470f122..1df680d07461 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -26,10 +26,9 @@ DT_DOCS = $(addprefix $(src)/, \ DT_SCHEMA_FILES ?= $(DT_DOCS) -ifeq ($(CHECK_DTBS),) -extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) -extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) -extra-y += processed-schema-examples.yaml +extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) +extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) +extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml override DTC_FLAGS := \ -Wno-avoid_unnecessary_addr_size \ @@ -37,7 +36,6 @@ override DTC_FLAGS := \ $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE $(call if_changed,mk_schema) -endif $(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE diff --git a/Documentation/devicetree/writing-schema.rst b/Documentation/devicetree/writing-schema.rst index 7635ab230456..220cf464ed77 100644 --- a/Documentation/devicetree/writing-schema.rst +++ b/Documentation/devicetree/writing-schema.rst @@ -147,6 +147,10 @@ Note that ``dtbs_check`` will skip any binding schema files with errors. It is necessary to use ``dt_binding_check`` to get all the validation errors in the binding schema files. +It is possible to run both in a single command:: + + make dt_binding_check dtbs_check + It is also possible to run checks with a single schema file by setting the ``DT_SCHEMA_FILES`` variable to a specific schema file. diff --git a/Makefile b/Makefile index e94d4fe3ef77..7dec7b343842 100644 --- a/Makefile +++ b/Makefile @@ -1244,10 +1244,10 @@ dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) +export CHECK_DTBS=y dtbs: dt_binding_check endif -dtbs_check: export CHECK_DTBS=1 dtbs_check: dtbs dtbs_install: @@ -1263,6 +1263,10 @@ PHONY += scripts_dtc scripts_dtc: scripts_basic $(Q)$(MAKE) $(build)=scripts/dtc +ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),) +export CHECK_DT_BINDING=y +endif + PHONY += dt_binding_check dt_binding_check: scripts_dtc $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings From patchwork Wed Mar 4 03:20:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11419257 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5B8F1395 for ; Wed, 4 Mar 2020 03:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4A3220836 for ; Wed, 4 Mar 2020 03:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583292085; bh=jlGFdpxOfvdd0i8pDFg4Q34tKK6XUXIDfN/KhrQlXj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2Saux9btSuX10g3YCg7c1tHKf5Rq9+iEEFxdB2P7VdI5tA2S0IM3OrXcFdzKzp69i PRiZR3EcyifPsqveouZO4sdrxcNPesiTLXgmWFc9ZZq0yyVOTSAvYcSzAw5FPWsu44 n29HNNqjqs7XJO2v7kRjSdlVO7NAD3RhzNYYPD88= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387610AbgCDDVZ (ORCPT ); Tue, 3 Mar 2020 22:21:25 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:64195 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387400AbgCDDVZ (ORCPT ); Tue, 3 Mar 2020 22:21:25 -0500 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id 0243Kef6018747; Wed, 4 Mar 2020 12:20:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 0243Kef6018747 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1583292045; bh=v2vJfpnqozXNkEifp79FluQTimJVampIAlakCpTKI9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nKKD3muBJ0m/YtVBc8JE/Aa5V22EojkwDntV6b7YPhjlSrnAfwn7kf5+Dnz6XgstE zoCnF0F0WglpiFMNLmDan8WZbUAjY4qqrp1oQx1YTRxArHcoFdMyPIytG3DROCfJQ1 TjboNnqww42k7q5gwnpA/5H9h+r86AwbiQ+VKXAO4nIj65miHrEKwMSZAbWYTSkB/w qsZ/H6c3ckDabFevv5dN8DmYVk7UquO16Oc/6ZtJK5A57gx3K8Rfi0Oq63GHy4R4WU MsrupfHEyH5E1k8Xwp5BuKeP/cLirWfT07iaooAZoGT+Tqj5mIYFJ3AK69OqXtVLcf 8fAAxrt8UXvBA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Frank Rowand , Michal Marek Subject: [PATCH 3/3] kbuild: allow to run dt_binding_check without kernel configuration Date: Wed, 4 Mar 2020 12:20:38 +0900 Message-Id: <20200304032038.14424-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200304032038.14424-1-masahiroy@kernel.org> References: <20200304032038.14424-1-masahiroy@kernel.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The dt_binding_check target is located outside of the 'ifneq ($(dtstree),) ... endif' block. Hence, you can run 'make dt_binding_check' on any architecture. This makes a perfect sense because the dt-schema is arch-agnostic. The only one problem I see is that scripts/dtc/dtc is not always built. For example, ARCH=x86 defconfig does not define CONFIG_DTC. Kbuild descends into scripts/dtc/, but does nothing. Then, it fails to build *.example.dt.yaml files. Let's build scripts/dtc/dtc forcibly when running dt_binding_check. The dt-schema does not depend on any CONFIG option either, so you should be able to run dt_binding_check without the .config file. Going forward, you can directly run 'make dt_binding_check' in a pristine source tree. Signed-off-by: Masahiro Yamada Reviewed-by: Rob Herring --- Makefile | 2 +- scripts/dtc/Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7dec7b343842..190f595c7bfc 100644 --- a/Makefile +++ b/Makefile @@ -255,7 +255,7 @@ clean-targets := %clean mrproper cleandocs no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers headers_% archheaders archscripts \ - %asm-generic kernelversion %src-pkg + %asm-generic kernelversion %src-pkg dt_binding_check no-sync-config-targets := $(no-dot-config-targets) install %install \ kernelrelease single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/ diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 3acbb410904c..2f3c3a7e1620 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -1,8 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # scripts/dtc makefile -hostprogs := dtc -always-$(CONFIG_DTC) := $(hostprogs) +hostprogs := dtc +always-$(CONFIG_DTC) += $(hostprogs) +always-$(CHECK_DT_BINDING) += $(hostprogs) dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ srcpos.o checks.o util.o