Skip to content

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

Merged
DjDeveloperr merged 2 commits into
mainfrom
ci/b1-dt-check-changed-dtbs-v3-20261202
Dec 1, 2026
Merged

DjDeveloperr merged 2 commits into
mainfrom
ci/b1-dt-check-changed-dtbs-v3-20261202

Conversation

@RyanTheTide

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.

Also: make -k in both passes, so one DTB that fails to build no longer stops the others; a failed checkout/defconfig has its own status (it was 2, which is also make's error code); HEAD warnings of a board that did not build at BASE are listed but not counted as new, so a change that repairs a broken board is not failed for that board's existing warnings. The work directory is made absolute, because kbuild resolves a relative O= against the -C tree.

Replaces #3804 (one signed commit; covers DjDeveloperr's and CX-REVIEW's findings there).

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.
  • DjDeveloperr's case: base with a broken t8112-j413.dts (DTB build fails), clean head: exit 0, the board and its -fw27 variant listed as not compared (62 lines). The old script exits 1 here on the buildbox: without -k the base pass stops early and 341 warnings look new. The reverse (head broken) still exits 1 ("HEAD device trees do not build").
  • 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 first, without schema
checks, 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 schema warnings. dtc's own warnings
still come from the compile-only pass for every DTB, so a source line
or DTC_FLAGS change that leaves the bytes alone is still seen. A change
to the bindings, scripts/ or any Makefile/Kbuild file, a DTB build
failure, or a DTB missing from the build validates every Apple DTB as
before.

Also:
- make -k in both passes: one DTB that fails to build no longer stops
  the others being built and validated, which made their warnings look
  new (or removed) on the other side;
- a failed checkout or defconfig has its own status, distinct from
  make's exit codes (a base-only DTB build failure was taken for a
  failed checkout);
- the HEAD warnings of a board that did not build at BASE are listed
  but not counted as new, so a change repairing a broken board is not
  failed for that board's existing warnings;
- the work directory is made absolute, since kbuild resolves a
  relative O= against the -C tree.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@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.

The new unbuilt-at-BASE filter can also erase a new warning for a board that builds on both sides. I ran the exact filter with board.dtb built at BASE, only board-fw.dtb unbuilt, and a new normalized schema warning on board.dtb. The sibling maps to board.dtb, so the filter moves that warning out of new.warn. Preserve the original board identity through this filter, or suppress only if no family member built at BASE.

@github-actions github-actions Bot added 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 d445f2a1: not ready yet

Check Detail
CI at head running running: dt-checks, host-tests
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head no no line with the head SHA d445f2a1, 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.

@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.

scripts/dtc/apple-dt-check.sh:274–280 can hide a new schema warning on a DTB that built successfully at BASE. The skip list maps each missing DTB to its family, then removes every new warning with that family's prefix. I reproduced it with board.dtb building on both revisions, board-fw27.dtb failing only at BASE, and a new HEAD-only warning emitted by board.dtb. The old script exits 1. This head moves that warning to uncompared.warn and exits 0. Keep the original DTB identity until this exclusion is applied, or fail conservatively when only part of a family built at BASE. The separate setup status addresses the earlier exit-code collision.

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Dec 1, 2026
…BASE

Warnings are reported under the family (base board) name, so the
exclusion for DTBs that did not build at BASE removed every new warning
of the family. A new warning from a member that did build at BASE (for
example board.dtb, when only board-fw27.dtb failed at BASE) went to
uncompared.warn and the check passed.

Leave a family out of the comparison only when none of its DTBs built
at BASE. A family that only partly built at BASE is compared as usual.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr re your review at 0ae16a6 (apple-dt-check.sh:274–280 hides a new warning from a family member that built at BASE). Fixed in d445f2a, using your second option. A family is left out of the comparison only when none of its DTBs built at BASE. If only part of a family built at BASE, it's compared as usual, so a new warning from board.dtb fails the check even when board-fw27.dtb failed at BASE. The summary line now names the families that weren't compared.

I didn't keep the per-DTB identity: extraction folds a variant's warnings into its base board's name before the comparison, so failing conservatively is the smaller change.

Checked by running the script's exclusion block, unchanged, on synthetic BASE/HEAD inputs:

case 0ae16a6 d445f2a
your repro: board.dtb built at BASE, board-fw27.dtb failed at BASE, new board.dtb warning hidden (uncompared) counted as new
whole family failed at BASE not compared not compared
lone non-variant board failed at BASE not compared not compared
everything built all compared all compared

@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.

Re-tested the warning comparison at this commit. A new warning now fails the check when either the base board or its firmware variant built at BASE. A wholly unbuilt family is excluded, and new warnings from other boards still fail the check. The previous false pass is fixed. No runtime change.

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@DjDeveloperr
DjDeveloperr merged commit fe7d114 into main Dec 1, 2026
7 checks passed
@DjDeveloperr
DjDeveloperr deleted the ci/b1-dt-check-changed-dtbs-v3-20261202 branch December 1, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants