Repository navigation
drm/asahi: preserve workqueue event order across pre-publication run() aborts - #3230
Conversation
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: Hold at 604e5be0065b for CI and cross-queue abort evidence.
Blockers: Apple build, arm64 KUnit, PR text and readiness are red at this head. Please refresh the branch on the current base and get the required checks green. The review also needs the requested live legacy-GPU abort row. Include a failed producer, a committed consumer with an explicit barrier to that producer, and a later independent submission on the producer queue. Record whether the dependent job cancels and independent work continues.
Checked: The exact-head standalone host harness passed here. Its order model treats publication as a high-water sequence. A later publish can make has_published() return true for an aborted sequence below that watermark. Please show what ordering invariant prevents a dependent job from reaching that state, or cover it explicitly if a later stamp is meant to satisfy the earlier wait.
604e5be to
f6a5d7a
Compare
|
Refreshed onto
|
There was a problem hiding this comment.
The new FIFO case exercises a committed producer abort followed by the dependent consumer and then the independent producer. I confirmed that the cross-submission barrier captures the current render or compute tail and that the submissions share the same scheduler entity. This addresses my high-water concern for that execution order. The exact-head standalone harness passed here. Code approved. The live G13/G14/G14X row still needs to exercise all three steps, and the hosted checks are queued.
|
Tested f6a5d7a on J473 (M2 mini, G14G B0 = G14 legacy-wq family, fw 27.2): PASS, as part of a batch boot. Kernel: Row (one guarded one-shot, restored to fleet89 after):
Evidence: For this PR: this is a no-regression row on the shared workqueue path. The failed-producer abort itself wasn't triggered, since nothing in the row aborts a run() before publication. An M1 (G13) row is still open. |
…) aborts On the legacy G13/G14/G14X workqueue backend, failing a committed job in QueueJob::run() before publishing its commands corrupts queue ordering in three ways: 1. Drop for Job subtracted event_count and pending.len() from the tail event value, commit_seq, and event_seq without moving submit_seq. If a second job J2 is building concurrently against J1's tail, J2::commit() fails with "Job::commit() out of order" (EINVAL); if J2 is already committed, J2::submit() fails with submit_seq != cmd_seq. 2. Drop for JobSubmission rolled back the same tail counters and set inner.last_submitted = Some(val) to the rolled-back tail value, which corrupts free_slots() when earlier work is in flight or later jobs are already committed. 3. QueueJob::run() took each subqueue job one by one before calling submit()?, so an early error dropped only the taken subqueues while leaving later subqueues to drop asynchronously in QueueJob::drop() (which drm_sched cannot invoke until earlier pending jobs complete). Legacy firmware stamps only require strictly monotonic 0x100-aligned values per event slot, not contiguous increments. Keep tail_value, commit_seq, and event_seq monotonic once a job commits: - Encapsulate queue sequence and stamp ordering in WorkQueueOrder, remove EventValue::sub(), and update last_submitted and published_event_seq only in JobSubmission::run() when commands are actually published. - On committed pre-publication abort in Job::drop() and JobSubmission::drop(), advance submit_seq past the aborted commands without rolling back tail counters or overwriting last_submitted. Keep tail-only uncommit() for partial QueueJob::commit() failure under the queue lock. - Have WorkQueue::event_info() return the live wait target (the latest committed tail when submit_seq < commit_seq, otherwise the last published work while pending is non-empty, else None) so new barriers skip already-aborted jobs instead of livelocking. - Track cross-submission explicit barrier waits (wait_frag_seq and wait_comp_seq) in QueueJob and cancel with ECANCELED in run() if the waited-on event_seq was never published, preventing firmware barrier hangs on stamps that will never be written. - Take all subqueue jobs upfront in QueueJob::run() and call abort_subqueues() synchronously on every pre-publication error path. - Latch tvb_init_pending immediately after buffer.new_scene() when scene.rebind() is true and propagate scene.rebind() || init_slot out of submit_render() so neither a mid-submit_render() error nor a pre-publication abort can lose a rebind InitBuffer requirement. Add KUnit tests in workqueue.rs and a host test harness with negative- control mutations in tools/asahi/legacy-wq-prepub-abort-tests.py. Closes: aurora-silicon#2546 Signed-off-by: AxxzyWasTaken <[email protected]>
f6a5d7a to
ac06a53
Compare
|
Rebased onto
Thanks for the J473 batch row! Ready for CI and re-check at |
There was a problem hiding this comment.
Verdict: MERGE at ac06a535 (wait for queued CI to finish green before merging)
Blockers: none in code (peer G13 / live abort hardware row noted in Not yet:).
Checked:
- Verified rebase
ac06a53503caontomain(a81a12c7de36): resolves only the 1-linemod testsimport conflict indrivers/gpu/drm/asahi/workqueue.rsafter#2886(ring_reaches_done), preserving#2886'sdoneptrErr(EIO)check verbatim and introducing zero functional changes relative to the previously approvedf6a5d7a1183dhead. - Verified exact-head offline checks at
ac06a53503ca:tools/asahi/run-host-tests.py --only legacy-wq-prepub-abort10/10(baseline + all 9 negative-control mutations killed), arm64LLVM=1 CONFIG_KUNIT=ybuild0warnings in touched files,checkpatch.pl --strict0errors. - Prior
f6a5d7a1183dhead (functionally identical) passed the J473 (M2 mini, G14G B0, fw 27.2) batch no-regression boot row.
Evidence
Risk:two-way · G13/G14/G14X Macs (M1, M2 family)present.- All 19 queued CI jobs (
apple-build,host-tests,pr-text, KUnit suites) pending atac06a535.
|
Tested ac06a53 on J473 (M2 mini, G14G B0, fw 27.2): PASS. This refreshes the row at your new head.
The G13 (J316s) row for this PR, #3250 and #3238 comes next with the same kernel. |
|
Tested ac06a53 on J316s. G13 row: tested on J316s (M1 Pro, G13S C0) at this head, PASS. Kernel
The J473 G14 27.2 row on the same kernel also passes (heavy 12/12, GL 8/8, Vulkan 10/10, s2idle 4/4). Evidence: |
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Fixes legacy G13/G14/G14X workqueue event ordering corruption when a committed job fails in
QueueJob::run()before publishing its commands to firmware:WorkQueueOrder: Encapsulate queue sequence and stamp ordering inWorkQueueOrder, removeEventValue::sub(), and updatelast_submittedandpublished_event_seqonly inJobSubmission::run()on actual publication.Job::drop()andJobSubmission::drop(), advancesubmit_seqpast aborted commands without rolling back tail counters or overwritinglast_submitted; keep tail-onlyuncommit()for partialQueueJob::commit()failures under the queue lock.WorkQueue::event_info()return the live wait target so new barriers skip already-aborted jobs; track cross-submission explicit barrier waits (wait_frag_seq/wait_comp_seq) inQueueJoband cancel with-ECANCELEDinrun()if the waited-onevent_seqwas never published; take all subqueue jobs upfront inQueueJob::run()and callabort_subqueues()synchronously on every pre-publication error path; latchtvb_init_pendingimmediately afterbuffer.new_scene()whenscene.rebind()is true and propagatescene.rebind() || init_slotout ofsubmit_render()so neither mid-submit_render()errors nor pre-publication aborts lose anInitBufferrequirement.drivers/gpu/drm/asahi/workqueue.rs(including FIFO abort -> dependent consumer cancel -> later independent publish ordering) and a host test harness with 9 negative-control mutations intools/asahi/legacy-wq-prepub-abort-tests.py(registered intools/asahi/run-host-tests.py).Closes: #2546
Tested: Rebased onto
main(a81a12c7de36) atac06a53503ca:tools/asahi/run-host-tests.py --only legacy-wq-prepub-abortpassed 10/10 (baseline + all 9 negative-control mutations killed); ARM64 cross-compile (ARCH=arm64 LLVM=1 drivers/gpu/drm/asahi/asahi_core.owithCONFIG_KUNIT=y) passed with 0 warnings in touched files;git diff --checkclean;scripts/checkpatch.pl --strictreports 0 errors / 0 code warnings. Prior headf6a5d7a1183dalso passed the J473 (M2 mini, G14G B0, fw 27.2) batch no-regression row (#3230 (comment)); functional diff fromf6a5d7a1183dis empty (only merged the 1-linemod testsimport with#2886'sring_reaches_done).Not yet: Live G13 (M1) row and live G13/G14/G14X hardware abort row exercising a failed producer, committed dependent consumer with explicit barrier, and later independent submission on the producer queue (no legacy M1/M2 hardware locally — peer row requested).
Risk: two-way · G13/G14/G14X Macs (M1, M2 family)