Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp359409ybz; Tue, 21 Apr 2020 23:01:00 -0700 (PDT) X-Google-Smtp-Source: APiQypJ6T6dNgjmsTtPqvXGeWVVy4uF6XkhGlhTvDcnLYP4i7etO8ySjgmCjzau8ytM/TsmyCsIi X-Received: by 2002:a17:906:131b:: with SMTP id w27mr24454023ejb.230.1587535260550; Tue, 21 Apr 2020 23:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587535260; cv=none; d=google.com; s=arc-20160816; b=w7rPRcYPYdvga+mY203rvhLIddvwoF00PlqXf5bm6ssO2t1OfKelAdjaaRS6lPkBHo nDvGamhEtX7zZGCj2AaF95ffe01QvfhotHHHJ7q6W8KbZUUKFSMh0epRfBAPZatQH17N a8bk1y/h4/ijvjZLHv4eOxSPB7QRLi/AtiFpDn6fcC/mYCPex+CtfGuwAcPidaOC843P qMmAqa5YStfxfcs82tecFf4i43DhMnAXXBd1HQTbVVtedfj6+QrQubuwOE3aRdOFfYpn o3Jr6IAu9inNmDltf03g+0GJrbnqjAeApkZwmRH7flYCcYhjIEM5qx9F5alEC8DKYGCS bbBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=seiSfwWiNI4V0jqT1v3MtfXuAE1wvYt6UInOKdV98Wk=; b=nvuOyoreiY9IaiqA2tTypGSo+3qhcPQaT9mc3ZM8MWg0ClJyyd5Z3gHSQJAh2wUxuc 6dA1pHd1ZHRozGpI3G/zHAkW4z6ckS1K5OB6B3dVDnSQPbE5yAylEaxISujY/XYIoy5r k6XAJEsFRSOVk9DyjFUBdKPrCG/oo1azVVV/1yHycH0eGL6h2WXAazeK+JaDc38+sboc MTC297tqmlaTChm+BZWtj7kD1DTIIcsVAXTmnx8kdpSKuDUSG/1ueexeSJwV75HZOjg7 xPyPkPi2/yimMXmuJkFt3Tu8VdHmLWamZ52mnb8+Booo4fc0FwAv70vY7KrX11uvd+Wh Uwvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="PG/TXKE7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by15si3102526ejb.229.2020.04.21.23.00.37; Tue, 21 Apr 2020 23:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="PG/TXKE7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726403AbgDVF7h (ORCPT + 99 others); Wed, 22 Apr 2020 01:59:37 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:45784 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbgDVF7g (ORCPT ); Wed, 22 Apr 2020 01:59:36 -0400 Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com [209.85.221.177]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 03M5x5WX002217; Wed, 22 Apr 2020 14:59:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 03M5x5WX002217 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587535146; bh=seiSfwWiNI4V0jqT1v3MtfXuAE1wvYt6UInOKdV98Wk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PG/TXKE7hKFrVuqz/bSJuLMe3Vge/PVEObk1aIfOzVm/PXK1EVk8jzvXFOk23CecV m9+VpUyPQXSP34q189gqyAMKfzgfz0O/3Pyg+NpCHc+UwVgLE5BYsFTCJDdUh7Fhq8 PwDWO7SX8FM8sHgvH4BLcVINGQHcoln6nmHExKegguLvbi4Bq759CV6WwC08uVUot6 gSy8wDf/nc6LeuUoyIS1itzC++4D2ZhFDJoB5Z0/hlsHSQXq3Waz7WM9K1JsjLdO6t Ry9sm9qTQibIaRA5/+CUBM30w3Y68Ke9JF67lTGRYKSjNa2CjMV96pfTp1adrJFKc1 rn0cD6RgDqwXw== X-Nifty-SrcIP: [209.85.221.177] Received: by mail-vk1-f177.google.com with SMTP id n128so331631vke.5; Tue, 21 Apr 2020 22:59:06 -0700 (PDT) X-Gm-Message-State: AGi0PubXWXXbbf61jaJKNvrLj+4bPZP72DzYiVgK2qkClK0ABEWXDK4Y RAcwFbVqdyVpN6ivqXBx06EhrwOJopDuaE+0C0o= X-Received: by 2002:a1f:5c03:: with SMTP id q3mr18921288vkb.66.1587535145254; Tue, 21 Apr 2020 22:59:05 -0700 (PDT) MIME-Version: 1.0 References: <20200421212004.6146-1-robh@kernel.org> In-Reply-To: <20200421212004.6146-1-robh@kernel.org> From: Masahiro Yamada Date: Wed, 22 Apr 2020 14:58:29 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] dt-bindings: Fix command line length limit calling dt-mk-schema To: Rob Herring Cc: DTML , Linux Kernel Mailing List , Laurent Pinchart Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, On Wed, Apr 22, 2020 at 6:20 AM Rob Herring wrote: > > As the number of schemas has increased, we're starting to hit the error > "execvp: /bin/sh: Argument list too long". This is due to passing all the > schema files on the command line to dt-mk-schema. It currently is only > with out of tree builds and is intermittent depending on the file path > lengths. > > Commit 2ba06cd8565b ("kbuild: Always validate DT binding examples") made > hitting this proplem more likely since the example validation now always > gets the full list of schemas. > > Fix this by putting the schema file list into a temp file and using xargs. > > Reported-by: Laurent Pinchart > Cc: Masahiro Yamada > Signed-off-by: Rob Herring > --- > Documentation/devicetree/bindings/.gitignore | 2 +- > Documentation/devicetree/bindings/Makefile | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/.gitignore b/Documentation/devicetree/bindings/.gitignore > index 5c6d8ea1a09c..0a6aef915fa4 100644 > --- a/Documentation/devicetree/bindings/.gitignore > +++ b/Documentation/devicetree/bindings/.gitignore > @@ -1,3 +1,3 @@ > # SPDX-License-Identifier: GPL-2.0-only > *.example.dts > -processed-schema*.yaml > +processed-schema*.yaml* > diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile > index 1df680d07461..1c1cad860b7c 100644 > --- a/Documentation/devicetree/bindings/Makefile > +++ b/Documentation/devicetree/bindings/Makefile > @@ -14,7 +14,8 @@ $(obj)/%.example.dts: $(src)/%.yaml FORCE > DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml > > quiet_cmd_mk_schema = SCHEMA $@ > - cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) > + cmd_mk_schema = $(file >$@.tmp, $(real-prereqs)) \ > + cat $@.tmp | xargs $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ > The built-in function $(file ...) is supported on GNU Make 4.0 or later. The current minimal version is GNU Make 3.81. If you want to use this function, you must update Documentation/process/changes.rst first. I am pretty sure some conservative distros still stick to GNU Make 3.8* but I am open to raising the minimal version if it is useful. But, does this code work in the first place? When a very long command is given, xargs splits it into smaller chunks, and invokes the command multiple times, right? So, it boils down to this question: Are the following two commands work equivalently? "dt-mk-schema -o processed-schema-examples.yaml foo.yaml && dt-mk-schema -o processed-schema-examples.yaml bar.yaml && dt-mk-schema -o processed-schema-examples.yaml baz.yaml" "dt-mk-schema -o processed-schema-examples.yaml foo.yaml bar.yaml baz.yaml" I think the answer is no. I confirmed the produced processed-schema-examples.yaml is broken. In a normal case, it is more than 50000 lines, but if xargs split the command, it is much smaller. masahiro@oscar:~/ref/linux$ make -j24 O=foo/bar dt_binding_check masahiro@oscar:~/ref/linux$ wc foo/bar/Documentation/devicetree/bindings/processed-schema-examples.yaml 51461 115967 1516186 foo/bar/Documentation/devicetree/bindings/processed-schema-examples.yaml masahiro@oscar:~/ref/this/is/a/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/src/path/to/linux$ make -j24 O=foo/bar dt_binding_check masahiro@oscar:~/ref/this/is/a/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/src/path/to/linux$ wc foo/bar/Documentation/devicetree/bindings/processed-schema-examples.yaml 9625 21510 291993 foo/bar/Documentation/devicetree/bindings/processed-schema-examples.yaml Can dt-mk-schema read the list of schema files by other means? > DT_DOCS = $(addprefix $(src)/, \ > $(shell \ > -- > 2.20.1 > -- Best Regards Masahiro Yamada