Repository navigation
iommu: apple-dart, drm/apple: build under KASAN with CONFIG_WERROR (frame size, unused fixture) - #2924
Conversation
apple_dart_dcp_import() takes struct dcp_adt_tables by value, and its callers copy the 552-byte table description into a local 'bounds' only to change start and end. With the import inlined, the external and internal frontend prepare paths each carry several copies: 2144 bytes of stack under KASAN, which fails a CONFIG_WERROR build at the default 2048-byte frame limit. Pass the firmware description by const pointer with the table range as two arguments, and store the adjusted copy only in the imported DCP. apple_dart_dispext_prepare() drops to 944 bytes and apple_dart_frontend_prepare() to 976 (arm64, KASAN inline). No change in behaviour. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…he stack dcp_swapped() completes a swap whose completion arrived early on external desktop 26.x firmware by building a zeroed dc_swap_complete_resp on the stack and passing it to dcpep_cb_swap_complete(), which only reads its swap_id. The record is 0x730 bytes on those firmware versions, enough to put dcp_swapped() at 2080 bytes under KASAN and fail a CONFIG_WERROR build. Split the swap-id handling out of dcpep_cb_swap_complete() into dcp_swap_complete_id() and call that directly. dcp_swapped() drops to 96 bytes. The receive path is unchanged. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
av_lifetime_report_after_stop() keeps a struct apple_epic_service, pending-command table included, on the stack. Under KASAN that is a 2240-byte frame and a CONFIG_WERROR build fails. Allocate it with kunit_kzalloc() like the rest of the fixture (416 bytes). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Commit c7e3f37 ("drm/apple: read the panel colour target from raw ADT") removed the only user of panel_test_adt, so a CONFIG_WERROR build of the parser tests fails on -Wunused-const-variable. Remove the array and keep panel_test_mode, which the tests still use. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 7663a8b. Read all four commits at 7663a8b. No new heap or static storage on any kernel path: the DART change only passes the 552-byte table description by const pointer, so there is no allocation or concurrency question. The only new allocation is kunit_kzalloc() in a test. Behaviour is the same with or without KASAN.
|
There was a problem hiding this comment.
Formal adversarial §1–§6 pre-PR checklist review at 7663a8b04ed2bd380fe887c8357d9ad208b8fc19 (COMMENT — 0 code/policy blockers; waiting on CI).
Checklist Summary
- §1 (No model gating): Pass — no chip, SoC, board, or firmware-version gates introduced.
- §2 (Production-ready, no hacks): Pass — pure stack-frame reductions and removal of dead test fixture (
panel_test_adt, unused sincec7e3f37e7cb9). - §3 (Safety / correctness): Pass — verified all 4 commits introduce zero functional change:
drivers/iommu/apple-dart-dcp.h:apple_dart_dcp_import()takesconst struct dcp_adt_tables *firmwareplus explicitstart/end, stores*firmwareintodcp->firmwareand overridesdcp->firmware.start/endbeforeapple_dart_dcp_excluded_regions(dcp). Every formerbounds.start/bounds.endreference insideapple_dart_dcp_import()is updated consistently, and all 5 call sites (apple_dart_dcp_prepareSID23,apple_dart_dispext_prepareSID16/SID0,apple_dart_frontend_prepareSID0/SID16) pass identical ranges.drivers/gpu/drm/apple/iomfb_template.c:dcp_swap_complete_id()extracts the swap-ID completion path cleanly out ofdcpep_cb_swap_complete(), eliminating the 0x730-bytedc_swap_complete_respstack allocation indcp_swapped(). Each versionediomfb_v*.cincludesiomfb_template.conce as its own translation unit, sostatic void dcp_swap_complete_id()has no linkage collision.drivers/gpu/drm/apple/av-lifetime-test.c: movesstruct apple_epic_servicetokunit_kzalloc()withKUNIT_ASSERT_NOT_NULL().drivers/gpu/drm/apple/dcp-panel-test.h: removes unusedpanel_test_adt[]while retainingpanel_test_mode.
- §4 (Clean-room & attribution): Pass — all 4 commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:only (zero AI trailers in commits); PR body includesAssisted-by:. - §5 (Evidence): Waiting on CI — KASAN+UBSAN+PROVE_LOCKING+DEBUG_OBJECTS arm64 build (
CONFIG_WERROR=y,CONFIG_FRAME_WARN=2048) and QEMU KUnit run are well documented for this no-functional-change refactor, but GitHub CI is still queued (host-testsQUEUED, 0/1 completed). Cannot approve until required CI finishes green. - §6 (Naming): Pass.
Verdict
0 code or policy blockers. Ready to approve once CI completes green.
There was a problem hiding this comment.
Follow-up after host-tests CI run 45103041644 completed with FAILURE on 7663a8b04ed2:
dcpext26-present-testsfailed to compile (exit 1):tools/asahi/dcpext26-present-tests.pyextracts code fromdrivers/gpu/drm/apple/dcp.cand now fails witherror: call to undeclared function 'dcp_swap_complete_id'(-Wimplicit-function-declaration). The stack-frame helper split indcp.cneeds the host test extractor/stubs updated to match.apple-dcphost suite failed (exit 1):FAIL apple-dcp (167.3s): exit 1in the same run — please inspect and resolve the failing subtest alongsidedcpext26-present-tests.
Holding approval until host-tests passes green.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 7663a8b04ed2
Blockers:
- CI is red:
tools/asahi/dcpext26-present-tests.pyextracts code fromdrivers/gpu/drm/apple/dcp.cand now fails to compile (an undeclared function after the frame-size split). Fix: update the extraction list or keep the helper the test expects. - The branch conflicts with
main; update it.
Rows before merging: the frame-size split changes built DCP and DART code, so at the new head it needs one boot on each of two generations with the display up and no DART faults.
Checked: no Apple material, no runtime change beyond the KASAN/CONFIG_WERROR build fixes (frame size, unused function).
Superseded by the review at 7663a8b
Keep the current H17 shown flag when forwarding the stack-frame fix. Use the new completion helper in the ext26 fixture and keep its synthetic shown state clear. Retain the panel identity test's synthetic ADT input with an unused annotation for the kernel translation unit. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The synthetic ADT buffer and the two-mode catalogue push their respective test frames past 2048 bytes with generic KASAN and WERROR. Use KUnit-managed storage for those fixtures and preserve their initialization and checks. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Forwarded to current main at The standalone ext26 host check and all 95 Apple DCP host checks passed. Seven ARM64 driver and test objects built with generic KASAN, WERROR and the unchanged 2,048-byte stack frame limit. Two parser-only test fixtures needed KUnit-managed storage to pass that limit. Hosted CI and the two-generation display and DART boot results remain due. |
satchlj
left a comment
There was a problem hiding this comment.
Gemini 4 Neon on @satchlj's behalf
Verdict at b1e599fbe90a
APPROVE — Clean KASAN + CONFIG_WERROR stack-frame reductions across apple-dart-dcp.h, iomfb_template.c, and DCP KUnit tests (av-lifetime-test.c, parser-test.c), properly preserving main's H17 shown flag, updating both host test harnesses (dcpext26-present-tests.py, j616s.py), and passing all 4/4 CI checks.
Blockers
- None on code, KUnit tests, or CI. (See
Untested scoperegarding hardware boot verification across two generations.)
Checked
- Full diff audit (7 changed files,
+65/-47):drivers/iommu/apple-dart-dcp.h: changesapple_dart_dcp_import()to acceptconst struct dcp_adt_tables *firmware, u64 start, u64 end, copies*firmwareinto heap-allocateddcp->firmware, and overrides.start/.end, eliminating the ~552 B by-value parameter and extraboundsstack copy inapple_dart_dispext_prepare()andapple_dart_frontend_prepare().drivers/gpu/drm/apple/iomfb_template.c: extractsdcp_swap_complete_id(dcp, swap_id, shown)sodcp_swapped()passes(swap_id, false)directly without stack-allocatingstruct DCP_FW_NAME(dc_swap_complete_resp), whiledcpep_cb_swap_complete()preservesresp->unkboolunder#if DCP_FW_H17(DCP_FW_VER).tools/asahi/dcpext26-present-tests.py: updated cleanly to stubdcp_swap_complete_id()(asserting!shown), resolving the prior host-test compile failure.drivers/gpu/drm/apple/av-lifetime-test.c&parser-test.c: moves large stack allocations (struct apple_epic_service,u8 adt[512],struct dcp_display_mode catalog[2]) tokunit_kzalloc/kunit_kmalloc/kunit_kcallocwithKUNIT_ASSERT_NOT_NULL.drivers/gpu/drm/apple/dcp-panel-test.h&tools/testing/selftests/drivers/gpu/apple-dcp/j616s.py: markspanel_test_adt[]__maybe_unusedand defines#define __maybe_unusedin the standalone host test script.
- CI at
b1e599fbe90a:kunitPASS,host-testsPASS,readiness / readinessPASS,pr-text / pr-textPASS (4/4 green). - Untested scope: Static diff and CI review only; no kernel build or live Mac hardware boot (including two-generation DCP/DART boot checks) was executed locally in this userspace-only review.
Evidence
- PR head:
b1e599fbe90a(base=main,MERGEABLE, 7 files+65/-47) - CI:
kunit: SUCCESS,host-tests: SUCCESS,readiness / readiness: SUCCESS,pr-text / pr-text: SUCCESS
DjDeveloperr
left a comment
There was a problem hiding this comment.
Code approved at b1e599fbe90a. The ext26 fixture now calls the scalar swap-completion helper, and the hosted DCP tests pass. The branch merges cleanly. Before merge, this still needs display and DART boot results on the target Mac and a second generation.
Superseded by the review at b1e599f
|
b1e599f J616s (T6040, M4 Pro) + J700 (Neo, T8140) PASS (2 generations): guarded one-shot combined batch (427b2c2dc67c over main 8f99a85, 0 merge-tree diffs on 7 changed files, default cmdline): J616s (boot c03a4ac6-7a26-444a-b5d3-cddf0c5d9bdc) eDP-1 connected pre/post, 0 DART faults, 0 GPU faults, 2/2 rtc1 s2idle, 0 failed units, Enforcing, 0 new AVC, 0 new kernel errors; J700 (boot 3f98d23f-1816-4823-8fa0-0857950bb565) eDP-1 + DP-1 connected, 0 DART faults, 0 GPU faults, Wi-Fi 3/3 ping, 0 failed units, Enforcing, 0 new AVC, 0 new kernel errors; stock 7.3.0-aurora-fleet89 restored on both. |
Problem
A KASAN kernel with
CONFIG_WERROR=ydoes not build: four functions in our Apple code go over the default 2048-byte frame limit, and one parser-test fixture has been unused since c7e3f37. That blocks the full-debug (KASAN/UBSAN/lockdep) KUnit row unless WERROR is turned off.Change
apple_dart_dcp_import()took the 552-bytestruct dcp_adt_tablesby value, and its callers copied it again to adjust start/end. It now takes a const pointer plus the table range: dispext_prepare 2144 → 944 bytes, frontend_prepare 2144 → 976.dcp_swapped()built a zeroed 0x730-bytedc_swap_complete_respon the stack just to pass a swap id. The id handling is split out intodcp_swap_complete_id(): 2080 → 96 bytes. The receive path is unchanged.apple_epic_serviceis now allocated withkunit_kzalloc(): 2240 → 416 bytes.panel_test_adtarray is marked__maybe_unusedand remains available to the host identity test.No functional change.
Testing
arm64, KASAN + UBSAN + PROVE_LOCKING + DEBUG_OBJECTS,
CONFIG_WERROR=y,CONFIG_FRAME_WARN=2048:make -kreports the 4 frame-size errors (negative control)make -kexits 0 with no warningscheckpatch --strict: one CHECK on the
DCP_FW_NAME()macro in an unchanged signature, and one commit-reference line over 75 chars.Tested: J616s (M4 Pro) and J700 (Neo) passed the display and DART checks in the hardware candidate carrying
b1e599fbe90a, with zero DART faults and no new kernel errors. The updated head81b40d7c6f40has the same stable patch ID (013c429d0c88). The only intervening merge onmainwas #2918, which changes PWM KUnit coverage.Risk: two-way · Macs using Apple DCP and DART.
Reviewer detail
apple_dart_dcp_import()still stores the adjusted copy indcp->firmware(*firmware, then start/end), soapple_dart_dcp_excluded_regions()and later users see exactly what they saw before.apple_dart_dcp_prepare()(SID23) passes its owntables.start/tables.end, as before.dcpep_cb_swap_complete()(the trampoline target) now callsdcp_swap_complete_id(dcp, resp->swap_id). Same trace point, same peer/v27 handling.KCFLAGS=-fstack-usage(arm64 gcc, KASAN inline). Logs are in the lab trace dirtraces/kernel/20261123-apple-kasan-frame-size/.