Thread (4 messages) flat view 4 messages, 3 authors, 2021-03-11

Re: [PATCH] [RFC] dt-bindings: Consider DT_SCHEMA_FILES when finding all json-schema

From: Rob Herring <robh+dt@kernel.org>
Date: 2021-03-09 17:43:24
Also in: lkml

On Tue, Mar 9, 2021 at 4:21 AM Geert Uytterhoeven
[off-list ref] wrote:
Setting DT_SCHEMA_FILES allows the user to restrict the
"dt_binding_check" make target to a specified set of DT binding files.
However, yamllint is still run on all available files, which can take
quite some time.

Fix this by changing "find_cmd" to only return the specified files.
Note that this also affects the "cmd_chk_bindings" and "cmd_mk_schema"
rules.

This reduces the execution time of

    make dt_binding_check DT_SCHEMA_FILES=/path/to/json/schema/file

from ca. 22 to less than 2 seconds on an i7-8700K.
We could use xargs sharding like 'chk_bindings' does. That goes from
18s to 5s for me (i7-7700HQ). Good enough? Not sure why I didn't other
than thinking 20sec was fast enough.

Another option would be doing yamllint as part of cmd_extract_ex or we
could have a command line variable to disable yamllint.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Should this be restricted to cmd_yamllint?
I'm not sure which users of find_cmd do and do not need all files.
cmd_chk_bindings always does. cmd_mk_schema needs both. So I think
this doesn't work for all cases.
quoted hunk ↗ jump to hunk
---
 Documentation/devicetree/bindings/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
index 780e5618ec0ae2fc..60ac03bade2da0ad 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -22,10 +22,18 @@ $(obj)/%.example.dts: $(src)/%.yaml check_dtschema_version FORCE
 # Use full schemas when checking %.example.dts
 DT_TMP_SCHEMA := $(obj)/processed-schema-examples.json

+ifeq ($(DT_SCHEMA_FILES),)
+
 find_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \
                -name 'processed-schema*' ! \
                -name '*.example.dt.yaml' \)

+else
+
+find_cmd = echo $(addprefix $(srctree)/, $(DT_SCHEMA_FILES))
+
+endif
+
 quiet_cmd_yamllint = LINT    $(src)
       cmd_yamllint = ($(find_cmd) | \
                      xargs $(DT_SCHEMA_LINT) -f parsable -c $(srctree)/$(src)/.yamllint) || true
--
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help