Repository navigation
Serialize DMA transfers on the dext's descriptor ring and check the completed count - #94
Merged
Merged
Conversation
…ompleted count Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
=======================================
Coverage 90.05% 90.05%
=======================================
Files 41 41
Lines 4132 4132
Branches 376 376
=======================================
Hits 3721 3721
Misses 305 305
Partials 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes V2 of the flip review, pending a build and a run on the mac with the card.
The macOS dext has one descriptor ring for both engines.
DMATransferwrites each transfer's chain into it from index 0, so an H2C and a C2H transfer running at the same time could rewrite each other's descriptors mid-flight. Success was also judged from the status bits alone; the completed-descriptor count was read only for the failure log.IOLockin the driver's ivars, allocated ininitand freed infree, is held from writing the chain until the completed count has been read, so one transfer owns the ring at a time. Nothing returns between the lock and the unlock.completed == segCountis now part of success, so an engine that stops early without an error bit is a failed transfer.test_concurrent_transfers_on_both_engines_round_trip(hardware, skipped elsewhere) runs two threads that each write a 1 MiB pattern and read it back 64 times, so their transfers interleave across both engines. It needsDAU_XDMA_MACOS=1andDAU_XDMA_SCRATCH_ADDRESSES=<a>,<b>, two device addresses that are safe to overwrite, since which memory is free is board geometry.Compiled, not run.
make compile-unsigned(Xcode 27.1, DriverKit SDK) builds the dext for x86_64 and arm64 with no warnings or errors from the source, and the binary linksIOLockAlloc,IOLockLock,IOLockUnlockandIOLockFree. To test on the card: build the dext in Xcode withCFBundleVersionabove the installed one (the activated dext reports 8;Info.plistin the tree still says 7), activate it, then run the hardware tests above. Running the new test against the current dext first would show whether the race reproduces.