Skip to content

scripts/dtc: apple-dt-check: validate only the DTBs a change alters - #3804

Closed
RyanTheTide wants to merge 2 commits into
mainfrom
ci/b1-dt-check-changed-dtbs-20261202
Closed

RyanTheTide wants to merge 2 commits into
mainfrom
ci/b1-dt-check-changed-dtbs-20261202

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What: scripts/dtc/apple-dt-check.sh (the Device tree checks job) ran CHECK_DTBS on all 141 Apple DTBs at both base and head for every DT change. On the box runners that's up to ~40 minutes per job, mostly dt-validate. It now compiles every Apple DTB at both revisions without schema checks first, then validates only the DTBs whose compiled bytes differ, widened to their firmware-profile variant family (a variant's warnings are reported under its base board's name). An identical DTB against identical bindings gives identical warnings, so the new/removed lists don't change. dtc's own warnings (from the first, compile-only pass) are still compared for every DTB, as before. The script falls back to validating every DTB, as before, when any of these happen:

  • a binding, anything under scripts/, or any Makefile/Kbuild file changes (a Makefile can change DTC_FLAGS without changing DTB bytes);
  • a DTB fails to build;
  • a listed DTB has no build output.

The work directory is made absolute, because kbuild resolves a relative O= against the -C tree.

Tested: buildbox, dtschema 2026.9, old script (main cafee219) vs this one on the same base/head:

  • arm64: dts: apple: t6030-j514s: enable CLKREQ# on internal PCIe links #3793 merge ref (t6030-j514s.dts only): 1 of 141 DTBs checked. 0 new / 0 removed, same as old. base and head warning lines for that board are identical to the old run's (59). 108 s vs 191 s.
  • T8112 PCIe-C: 32-bit tunnel DART, DMA windows and s2idle hold (first M2 eGPU) #3625 merge ref (t8112.dtsi): 8 of 141 DTBs checked (the T8112 boards). 0/0, same as old. Warning lines identical for the 8 boards. 158 s vs 252 s.
  • Synthetic: an undocumented property added to the variant t8122-j613-25g83.dts checks 2 DTBs (the variant and its base board) and reports the same 2 new warnings under t8122-j613.dtb as the old script (new.warn identical). Exit 1 in both.
  • CX-REVIEW's case: -Wunit_address_vs_reg added to DTC_FLAGS_t6031-j514c (byte-identical DTBs) gives 4 new warnings, exit 1, through the Makefile fallback. With that fallback disabled, the build-log path alone finds the same 4 in 32 s.
  • A relative work directory (which hashed nothing before the absolute-path fix) now builds and hashes all 141.
    The buildbox has 32 threads. Runner VMs have far fewer, so validation is a bigger share of the job there and the saving is larger.

Risk: two-way. Only scripts/dtc/apple-dt-check.sh changes. A wrong selection could miss a new warning; the fallbacks above cover the inputs that can change warnings without changing DTB bytes (bindings, dtschema and dtc scripts). This PR changes scripts/, so its own run validates every DTB. Revert: git revert -m 1 <merge-sha>.

Not yet: the dtschema version is pinned by pip at run time and is the same for base and head in one job, so it doesn't affect the comparison.

Device tree checks ran CHECK_DTBS (dt-validate) on all 141 Apple DTBs
at both the base and the head of every change. Schema validation is
most of the job's time, and a runner spends up to ~40 minutes on it
even for a one-board change.

Compile every Apple DTB at both revisions without schema checks first
and validate only the DTBs whose compiled bytes differ, widened to
their firmware-profile variant family (a variant's warnings are
reported under its base board's name). An identical DTB against
identical bindings gives identical warnings, so the new/removed lists
are unchanged. A change to the bindings, scripts/ or the top Makefile,
a DTB build failure, or a DTB missing from the build validates every
Apple DTB as before. The work directory is made absolute, since kbuild
resolves a relative O= against the -C tree.
@RyanTheTide
RyanTheTide requested review from a team as code owners December 1, 2026 16:07

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced a warning the hash filter drops. On the current t6031-j514c DTS, adding -Wunit_address_vs_reg to DTC_FLAGS_t6031-j514c in arch/arm64/boot/dts/apple/Makefile emits unit_address_vs_reg for /soc/smc@2a4400000/gpio@67500000 with byte-identical DTBs. The old gate includes that compiler warning. This head neither triggers the full-check fallback for that Makefile nor extracts warnings from the first-pass build log, so it skips the board. Include DT build Makefiles in the full-check fallback.

A Makefile can turn on a dtc warning (DTC_FLAGS_<board>) without
changing any DTB's bytes, so the changed-DTB selection skipped a board
the full check would have reported: with -Wunit_address_vs_reg added
for t6031-j514c, its unit_address_vs_reg warnings went missing.

Feed the first pass's build log, which has dtc's own warnings for
every Apple DTB, into each side's warning list, and validate every DTB
again when any Makefile or Kbuild file changes.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback conflates GNU make's DTB build error (exit 2) with prepare()'s checkout/defconfig sentinel. I reproduced a base-only DTB failure with successful checkout/defconfig and a clean head: the old script exits 0, while this head says BASE could not be checked out and exits 1 with zero new warnings. Please give setup failure a separate status, while retaining the full-validation fallback on either build failure. Both commits also need their human Signed-off-by trailers.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at 2c7b62e6: not ready yet

Check Detail
CI at head ok 6 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head no no line with the head SHA 2c7b62e6, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · . Only scripts/dtc/apple-dt-check.sh changes. A wrong selection could miss a new warning; the fallbacks above cover the inputs that can change warnings without changing DTB bytes (bindings, dtschema and dtc scripts). This PR changes scripts/, so its own run validates every DTB. Revert: git revert -m 1 <merge-sha>.

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #3826: one commit with its Signed-off-by, plus the fixes for both review findings. The checkout/defconfig failure now has its own status, distinct from make's exit 2. make -k keeps one broken DTB from hiding the others. A board that didn't build at BASE is listed and not counted. Dj's base-only failure case now exits 0.

@RyanTheTide RyanTheTide closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants