Skip to content

drm/asahi: gate G17 KUnit helpers on built-in KUnit - #492

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/g17-kunit-only-helpers-werror-t3164
Oct 27, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/g17-kunit-only-helpers-werror-t3164

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

The shipping Asahi configuration uses CONFIG_KUNIT=m. Four G17 helpers compile under that setting although their only callers are inside #[kunit_tests], whose macro requires CONFIG_KUNIT="y". CONFIG_WERROR=y then rejects the unused items.

Gate the helpers on the same built-in-KUnit setting as their callers. Built-in KUnit retains the helpers; production behavior is unchanged. Introduced by a36e352, 014605a, and 64f717d in linux #423.

Validation of this exact source tree (a668914cb2e6; original buildbox fix 5135c9d4 and published 91c4792 have identical trees):

  • Complete ARM64 shipping-config Image and all modules: PASS with CONFIG_WERROR=y, CONFIG_KUNIT=m, CONFIG_DRM_ASAHI=m. Rust 1.97.1, Clang 22.1.6, bindgen 0.73.2; no KRUSTFLAGS/lint waiver. Full module build includes PMP and completes MODPOST.
  • ARM64 QEMU Asahi KUnit with CONFIG_WERROR=y, CONFIG_KUNIT=y, CONFIG_DRM_ASAHI=y: 147 passed, 0 failed, crashed, skipped, or errors. Includes G17 QID/admission accounting, deadlines, shared capacity, recovery safety, and completion-index suites. The profile retains fleet G16 support and disables experimental G15 like the shipping config; auxiliary-bus support is selected through the in-tree Rust auxiliary sample.
  • git diff --check: PASS.

The author's Rust 1.99 targeted build reproduces the four errors without this fix and builds with it using KRUSTFLAGS=-Adeprecated. Without that override it reports 12 deprecation errors. Ten fetch_update call sites already exist in pre-merge af80fbe; the arm64 minimum Rust remains 1.85. The direct unqualified pass above is for Rust 1.97.1 and does not claim Rust 1.99 compatibility.

Ready for review. This fix alone does not clear the separate distro qualification hold.

The kunit_tests macro compiles its test modules only when CONFIG_KUNIT is
y. With CONFIG_KUNIT=m the four test-only G17 helpers remain compiled and
produce dead-code warnings, breaking a CONFIG_WERROR build.

Use the same built-in KUnit condition for the helpers as for their callers.

Fixes: a36e352 ("drm/asahi: size the G17 compute QID budget by open logical queues")
Fixes: 014605a ("drm/asahi: add G17 resource wait domains and use them for queue creation")
Fixes: 64f717d ("drm/asahi: wait for G17 compute capacity on the release that frees it")
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Thanks for catching this. These four constructors come from my #423 test commits, and gating them on CONFIG_KUNIT = "y" to match #[kunit_tests] is the right fix.

Part of your pending verification:

  • Built-in KUnit lane: with this diff applied to the omacom 7.2.11 port of the same G17 code (drm/asahi: G17 (Neo, T8140) driver update for 7.2.11 omacom/linux-aurora#229, whose four touched files match), the full omacom KUnit suite passes: 1695 passed, 3 skipped, 0 failed. That includes asahi_g17_compute_deadline, asahi_g17_shared_capacity, asahi_g17_admission_deadline and asahi_g17_admission_accounting.
  • Shipping combination: I'm building drivers/gpu/drm/asahi/ from integration/aurora (9cbdd07) plus this diff with CONFIG_KUNIT=m, CONFIG_WERROR=y and CONFIG_DRM_ASAHI=m, and will post the result here.

The same four helpers are in omacom #229, so it gets the same fix.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Shipping-combination build result. I built drivers/gpu/drm/asahi/ from integration/aurora 9cbdd07 with CONFIG_KUNIT=m, CONFIG_WERROR=y and CONFIG_DRM_ASAHI=m (the Neo 7.3 config otherwise), using rustc 1.99.0, the channel the packages pin:

result
without this PR 4 errors, -D warnings: constant `COMPUTE_FLOOR` is never used and three associated function `new` is never used
with this PR builds clean

A separate WERROR problem with 1.99.0. Both builds above pass KRUSTFLAGS=-Adeprecated. Without it, CONFIG_WERROR=y stops earlier on 12 deprecation warnings: use of deprecated method `Atomic::fetch_update`: renamed to `try_update` for consistency. They aren't only G17: g17/completion.rs, sync_input.rs, feed.rs (2), freelist.rs, queue/compute/exit.rs, plus g15/queue.rs, g15/vm.rs, g16/queue.rs, g16/vm.rs and m3/agx_memory_stats.rs. So a WERROR build on the pinned toolchain needs those moved to try_update (or the lint allowed) as well. If the distro qualification includes a WERROR lane, that's the next thing it would hit. I can send that rename as its own PR if you want it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants