Repository navigation
media: apple: ave: bound the sessions kept for a power cycle beside a running one - #3231
Conversation
… running one A session the firmware has seen keeps all its DMA buffers after it stops, on failed_sessions, until the last session ends and the coprocessor is proved to have lost power: neither an answered Close nor a Halt proves the engines stopped, and freeing after them corrupted memory on the Neo. While one session stays open, that power loss never comes, and the list had no bound. Starting and stopping another session beside the open one kept every stopped session's buffers, and each start allocated a new set, until DMA memory or the encoder's address space ran out. Count the encoder sessions on failed_sessions. Beside a running session, ave_session_attach() now refuses another with -EBUSY once AVE_MAX_SESSIONS of them wait, before the firmware is given anything, so the refused session is freed at once. Nothing is freed any earlier than before. The reap that follows the power loss resets the count. MCTF sessions hold only the device pool and are not counted. Add a case to the recovery host test that keeps one session open, starts and stops eight in the other slot through the production ave_session_attach(), and checks that what waits stays within AVE_MAX_SESSIONS. It then ends the last session and checks that the power loss gives everything back and admits a new session. run-recovery.py gains --ref to build an older driver against the same cases. The previous revision is registered as its negative control: there the stopped sessions grow past the bound. Signed-off-by: DjDeveloperr <[email protected]>
|
Verdict at Blockers: none Checked:
Evidence
|
…reset proof When the firmware does not arm the reset witness (witness_unusable), ave_sess_reap() keeps every stopped session for the whole boot, since nothing proves the engines stopped. The limit from the previous commit applied only beside a running session, so sessions started one at a time, each halting the firmware when it stopped, still piled up without bound. In that state, refuse a new session once AVE_MAX_SESSIONS stopped sessions wait, whether or not another runs, and say so once. The encoder then stops taking sessions for the rest of that boot instead of holding more memory it can never give back. Add a recovery host case that starts and stops sessions one at a time with no reset proof. The first AVE_MAX_SESSIONS run, the rest are refused before the firmware sees them, and what waits stays within the bound. At the previous commit, the list grows past it. Signed-off-by: DjDeveloperr <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
J714s (MacBook Pro 14" M5 Pro, T6050) row at
|
There was a problem hiding this comment.
Verdict: MERGE at 73509b81 (once cancelled CI checks are rerun green)
Blockers: none (code, host tests, and J714s hardware row are ready; rerun the 20 cancelled CI checks before merge).
Checked:
drivers/media/platform/apple/ave/ave-sess.candave-v4l2.c: verifiedave->failed_counttracks non-MCTF stopped sessions underhw_lock, resets to 0 onave_sess_reap(), and refuses new attachments with-EBUSYonceave->failed_count >= AVE_MAX_SESSIONSeither beside a running session (ave_session_count(ave)) or unconditionally whenave->witness_unusable.drivers/media/platform/apple/ave/tests/recovery-test.candrun-recovery.py: verifiedquarantine_churn,quarantine_no_witness, and the registered negative control against the prior revision.- Verified exact-head (
73509b814f71) J714s (M5 Pro) hardware row PASS.
Evidence
- Diff reviewed at
73509b81(all 7 files, 361 lines). - CI at review time: 3 passed, 0 failed, 20 cancelled.
|
Merge-train status at |
|
Merge-train, point 4: the AVE encoder driver runs on several families, and the J714s row covers one. Please add a row at this head on a second family with AVE (J616s or M1 Pro: encode sessions across a power cycle, 0 errors), then it merges. |
Forward-merge main. recovery-test.c keeps main's cpu_dart_filter() case beside this branch's quarantine_churn() and quarantine_no_witness() cases, and main() runs all three. run-recovery.py now extracts main's DAPF filter helpers and ave_dapf_entry, which 255761f does not have, so the ave-recovery-old negative control no longer built. Point it at 2fd49a6, the main this merges: it fails quarantine_churn() there as intended. Signed-off-by: Ryan Murray <[email protected]>
|
Forward-merged current main (2fd49a6) into this branch; new head c955307 (no force push). This also gives the PR a fresh CI run in place of the 20 checks the infra sweep cancelled. |
There was a problem hiding this comment.
Verdict: MERGE at c955307 after integration validation.
Checked: The merged recovery fixture runs the CPU DART filter case and both quarantine cases. The negative control now points to the merged base, which has the filter helpers but lacks the quarantine bound, and the reported AVE host run identifies quarantine_churn as the expected failure. Retain hosted CI and the outstanding second-family power-cycle row.
|
Row (J316s, M1 Pro, T6000) at exact head c955307 in combined candidate 77b87daa (main de965eb + #3277 542bbdc + #3231 c955307 + #3210 69f3a4a), kernel 7.3.0-aurora-crj7+ (fleet edge config), kernel-only one-shot with the saved Stage 2 and the default command line -> PASS (second AVE family, encode sessions across power cycles, 0 errors).
Evidence: traces/kernel/20261130-closeout-k114s-j316s-combo/m1pro-ave2/ (the first boot's AVE section in m1pro/ wrote to .bin names that ffmpeg cannot mux, so those encodes never ran; this second boot of the same build replaces it). Saved kernel 7.3.0-aurora-edge restored and verified. |
|
Merging at |
What: A stopped AVE session keeps its DMA buffers until the coprocessor is proved to have lost power, which only happens after the last session ends. With one session held open, starting and stopping another beside it kept every stopped session's buffers without bound. Beside a running session, a new one is now refused with -EBUSY once
AVE_MAX_SESSIONSstopped sessions wait. If the firmware gives no reset proof, so the list can never be freed this boot, the limit holds even with no session running. Nothing is freed earlier than before.Tested: the module builds W=1-clean (clang, arm64). The recovery host test gains a case that starts and stops eight sessions beside an open one through the production
ave_session_attach(). A second case starts and stops sessions one at a time with no reset proof. Both pass here; the previous revision fails the first case with the stopped sessions growing past the bound (registered as a negative control), and the first commit alone fails the second. All registered AVE host suites pass. J700 (Neo) at73509b814f71, in the combined candidate 7.3.0-neo-combined2, which carries it unchanged: H.264 1080p encode 300/300 frames, md5 identical to base. Three short encodes run one after another beside a long one: two complete, the third is refused with -EBUSY and the bounded-quarantine message, and after the long encode ends a new one starts normally. The no-reset-proof message never appears. 0 DART faults.Risk: two-way · every Mac with the AVE encoder. A third start beside a running session, after two stopped ones, now gets -EBUSY until the running session ends. Without a reset proof, the encoder takes no new sessions after two have stopped, for the rest of that boot.
Not yet: the encode smoke and churn row on the M5 Pro.
Details
ave_sess_destroy()). So this bounds what waits instead of freeing it sooner.ave->failed_countcounts encoder sessions onfailed_sessions. MCTF sessions hold only the device pool and aren't counted.ave_sess_reap()clears the count after it frees the list.ave_session_attach(), underhw_lock, before Open and Start. A refused session was never handed to the firmware, soave_sess_destroy()frees it at once.witness_unusable). The reap then keeps the list for the whole boot, so the same limit applies with no session running, and it's logged once (second commit).run-recovery.py --ref REVbuilds that revision's driver against this tree's cases.run-host-tests.pysuites can now carry an expectation, which the negative control uses.Evidence
python3 drivers/media/platform/apple/ave/tests/run-recovery.py: ok, including "bounded quarantine beside a running session".run-recovery.py --ref 255761f1d55f8dcf3e2c24d17095439237ad6f72:quarantine_churn: Assertion 'quarantined() <= AVE_MAX_SESSIONS' failed.tools/asahi/run-host-tests.py --only ave: ave-host, ave-input, ave-ipc, ave-recovery, ave-pm and ave-probe-pm ok; ave-recovery-old killed as expected.make M=drivers/media/platform/apple/ave LLVM=1 W=1 modulesagainst a configured 7.3 tree: no warnings in the changed files.