Repository navigation
iommu/apple-dart: run the apple-dart KUnit suite in CI, fix its stack overflow - #3888
Merged
Merged
Conversation
… overflow apple_dart_test_t8132_fw_mirror_selection() put a struct apple_dart on the stack. The struct is now larger than the 32 KiB task stack (its memset alone is 0x9480 bytes), so the test overflowed the stack and panicked the KUnit kernel. The 24 cases after it never ran, on main as well. Allocate the DART with kunit_kzalloc() like the other cases do. Nothing caught this because the linux CI KUnit table had no apple-dart suite. Add drivers/iommu/apple-dart.kunitconfig (16K pages, which the J713 cases need) and an 'apple-dart' entry that runs when apple-dart* or the v27 sleep header changes. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
approved these changes
Dec 2, 2026
DjDeveloperr
left a comment
Contributor
There was a problem hiding this comment.
Approve at 66cbc2d.
What I checked:
- The case now allocates the DART with
kunit_kzalloc()and asserts it isn't NULL, the same as every neighbouring case.kunit_kzalloc()returns NULL on failure (never an error pointer) and frees the memory on every exit path, including a failed assert. The memory starts zeroed, like the old{ .locked = true }initializer, and the five expectations are unchanged, so the case tests the same thing. - The suite entry has the same shape as the others (name, kunitconfig, no Rust, paths, filter). The
apple-dart*filter runs theapple-dartsuite plus the one-caseapple-dart-firmware-leafsuite in apple-dart.c, which is where 39 comes from (38 + 1).plan --filessends apple-dart.c, apple-dart-test.c, apple-dart-v27-late.inc and dcp-v27-sleep.h to the new suite as intended. The kunitconfig meets the Kconfig dependencies (APPLE_DART=y, KUNIT=y), and it uses 16K pages for the T8132 cases that skip below 16 KiB. - apple-build is unaffected: defconfig + asahi.config don't enable KUnit, so the test file isn't compiled there. No host test reads these files.
- KUnit runs on arm64 QEMU, so I didn't run it here. This relies on the 39/39 run at this head in the description, and on hosted CI.
- pr-text would have failed because the Risk line said neither one-way nor two-way. I added "two-way ·" to it and changed nothing else in the description. The checker passes locally on the edited text.
Notes, not blockers:
- Since this PR's base, main gained
apple_dart_test_v27_cycle_errors(from #3807). It comes after the old crash, so it has never run. The first main run after this lands will be its first run. If it fails, the bug is in that code or test, not in this PR. - The nine host-power cases stay compiled out. They sit under
CONFIG_APPLE_DART_J713_DCP, which this kunitconfig doesn't set (asahi.config does). A follow-up could addCONFIG_APPLE_DART_J713_DCP=y. - When a DART PR runs apple-dart and jpeg in one job, the page size switches from 16K to 4K, so most of the kernel rebuilds for jpeg. The extra cost is closer to a second kernel build than to 3 s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
apple_dart_test_t8132_fw_mirror_selection()kept astruct apple_darton the stack. The struct has outgrown the 32 KiB task stack (its memset is 0x9480 bytes), so the case overflows the stack and panics the KUnit kernel, and the 24 cases after it never run. This happens on main (13c7f69) too. The fix allocates the DART withkunit_kzalloc(), as the neighbouring cases do. Linux CI had no apple-dart suite, so nothing noticed. This addsdrivers/iommu/apple-dart.kunitconfig(16K pages, which the J713 cases need) and anapple-dartentry inscripts/ci/apple-kunit.pythat runs whendrivers/iommu/apple-dart*orinclude/linux/soc/apple/dcp-v27-sleep.hchanges.Tested:
scripts/ci/apple-kunit.py run apple-dart(the CI command, LLVM=1, arm64 QEMU) on the buildbox ran 39/39 passing. Main without the test fix crashes at case 16 ("kernel stack overflow", lrapple_dart_test_t8132_fw_mirror_selection+0x44), and 15 cases pass.plan --filesmapsdrivers/iommu/apple-dart.ctoapple-dart jpeg. checkpatch --strict found 0 errors (only the MAINTAINERS new-file note). This PR touchesapple-kunit.py, so its own run is the full KUnit set.Risk: two-way · test and CI only, no kernel code change. DART PRs gain one KUnit job: about 3 s of tests on a build that shares the jpeg suite's job and build dir.