Repository navigation
drm/asahi: g17: prune a queue's frontier from the front - #2732
Conversation
|
The profile makes the case (70% of the ioctl in A failure can be visible but not counted. Moving the count before A KUnit case for it: an entry behind an unfinished one gets status < 0 with the count unchanged, and the next prune (or reader) must still record the failure. Smaller: the MAINTAINERS checkpatch warning is fine to ignore. Assisted-by: LLM (Claude:Opus 5.5) |
There was a problem hiding this comment.
Adversarial review of draft head 52054f130232026fbd6e6d4d4023c797bae6a67f against the pre-PR checklist. Holding approval and requesting changes on the concurrency, accounting, and draft-readiness items below.
Code findings
-
Failure-visibility / counter ordering window in
Output::publish()(completion.rs:205-215) — affects same-engine ordinary commands even if readers check status.
Confirming and extending Ryan's finding:Output::publish()runsset_error()->signal()->note_failed_output(). Ifprune_frontier(index)runs betweensignal()andnote_failed_output(),failed_outputs()is unchanged,Outstanding::prune()stops at an older unfinished command, andfailure.note()is skipped.
Crucially, for a same-engine ordinary command (e.g., compute withinputs.is_empty()and!query_access), no frontier reader inQueue::enqueue()walksself.frontiers[index]at all (sourcesrequires!inputs.is_empty(),host_predecessorsis render-only,frontierwalks1 - index,timestampsrequiresquery_access). So even a reader-triggered fallback would still miss a failed same-engine predecessor retaining its VM pin and allow a dependent command to enqueue (and even publish inline viaearly = dependencies.is_empty()).
A lock-free way to close the window for all callers without adding cost to the no-failure fast path is a two-counter (failed_started/failed_finished) bracket aroundset_error()+signal():publish()onErr:failed_started.fetch_add(1, AcqRel)->set_error()+signal()->failed_finished.fetch_add(1, Release).prune_frontier(): loadfinished = failed_finished(Acquire)thenstarted = failed_started(Acquire)before scanning; run a full scan wheneverstarted != self.failures || finished != self.failures, and only advanceself.failures = finished.
Then any prune during the window seesstarted != self.failures, forces a full scan, and keeps forcing full scans until the post-signalfinishedincrement is observed. Please also add a KUnit test covering an in-flight failure bracket (started != finished).
-
Outstanding::reserve()can doubleKVVeccapacity to 4× steady-state depth before compaction triggers.
InOutstanding::prune()(outstanding.rs:398),entries.drain(..self.head)only runs whenself.head >= self.len(). Ifentries.len() == entries.capacity()withhead = cap/2 - 1andlen = cap/2 + 1(e.g.,DEPTH = 1024,cap = 2048,head = 1023,held = 1025),prune()skips draining and the immediately followingself.frontiers[index].reserve(1)inQueue::enqueue()reallocatesentriesto4096despite 1,023 deadNoneslots at the front. Note thata_deep_steady_queue_reads_a_few_entries_per_prune_and_stays_compactchecksentries.len() <= 2 * DEPTH(withDEPTH = 1000), notentries.capacity(). Compacting inreserve()whenentries.capacity() - entries.len() < additionalandself.headis a non-trivial fraction (e.g.,self.head >= self.len() / 2and>= additional) avoids unnecessary vmalloc doublings while preserving amortized O(1). -
Carryover issues from
#2719(commit 1 in this branch, still open/draft).- Both
Outstanding.entries(outstanding.rs:351) andQueue.finished(queue/mod.rs:198) still allocate withGFP_KERNELinstead ofGFP_KERNEL_ACCOUNT, leaving an unbounded userspace-drivenvmallocbacking uncharged to the caller's memcg (and neitherentriesnorfinishedever shrinks capacity after a peak burst). Queue::enqueue()(queue/mod.rs:230) still callsself.frontiers[index].reserve(1)?per command inside the submit loop rather than reserving the batch's per-engine count up front before the first command is enqueued, so anENOMEMmid-batch still leaves a partial submission.
- Both
-
Minor:
sourcescheck inQueue::enqueue()(queue/mod.rs:246-253) still walks full frontiers.
frontiers[0].iter().all(...)andfrontiers[1].iter().all(...)walk pastorder.wait_throughinstead of using.prefix(order.wait_through[...])(which also avoids O(N) work whenwait_throughisNone). Also note thatfrontiers[other].prefix(prefix).count()(queue/mod.rs:303) now includes finished entries sitting behind an unfinished front entry when sizing the physically contiguousKVecs (dependencies/checked_inputs/firmware).
Checklist & draft status
- CI:
host-testspassed on52054f13. - Stacking: carries
#2719's commit while#2719is still open/draft. - Checklist §1–§4 & §6: Pass on code (no chip/board/firmware gates, no cmdline hacks, human-only
Signed-off-byon all 3 commits). Minor attribution nit: PR body ends withAssisted-by: LLM (Claude:Opus 5.5)instead ofAnthropic:Claude Opus 5.5. - Checklist §5 (why draft): Not yet booted on hardware; needs same-machine A/B profile + conformance unchanged + regression run (0 SELinux denials, 0 failed units, 0 new kernel errors) across affected G17 hardware before leaving draft.
52054f1 to
7c3642c
Compare
|
Thanks @RyanTheTide and @DjDeveloperr. All three commits are amended and force-pushed (new head 1. The failure window. Both of you are right that it was real. I took Dj's bracket. Ryan's reader-side fallback can't close it, for the reason Dj gives: a same-engine command without inputs or query access has no frontier reader at all. One correction to the premise: the readers never treated an errored entry as finished. They skip only
2. Capacity. Compaction now happens in 3. #2719 carry-overs. Folded into #2719's commit, which is the first commit here: the whole-submission reserve before 4. KUnit: 733 tests, 731 pass, 1 skip (the 1 failure is Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-checked at
Two small things:
Rows at Assisted-by: LLM (Claude:Opus 5.5) |
A logical queue keeps one frontier entry per command whose completion has not signalled yet, and the pruned entries of the current ioctl in `finished`. Both are KVecs, so they grow by krealloc() into physically contiguous memory. The frontier is bounded only by how much work userspace keeps queued: vkd3d-proton's test_resolve_image_exhaustive_descriptors records 64 x 1024 resolves in one command list, and the frontier reaches thousands of entries. Growing it then needs an order-5 or order-6 block (512 KiB to 1 MiB with 16K pages). On a fragmented machine (4.3 GB free, nothing above order 4) the allocation fails. If it is `finished`, prune_frontier() falls back and only warn_alloc() dumps a trace. If it is the frontier's own reserve, the submit fails with ENOMEM after some of its commands may already have been queued, so Mesa marks the queue lost and reports VK_ERROR_DEVICE_LOST: vkd3d_queue: page allocation failure: order:6, mode:0x40cc0(GFP_KERNEL|__GFP_COMP) ... krealloc_node_align_noprof+0x154/0x238 rust_helper_krealloc_node_align+0x10/0x20 ..._asahi_core3g175queue...14prune_frontier... asahi 28a600000.gpu: [File 119992 Queue 1]: IOCTL: submit failed! (submission ID: 38521603 err: ENOMEM) The same test reproduces it alone on a loaded machine (nothing free above order 3): a perf probe on kmem:kmalloc shows the frontier's reserve asking for 196608 bytes (2048 -> 4096 entries) and getting NULL, and the submit fails with ENOMEM. Nothing needs these arrays contiguous: only the ioctl reads them. Make both KVVecs. kvrealloc() still tries kmalloc first, for a large size without direct reclaim or a warning, and falls back to vmalloc. Small frontiers keep their kmalloc memory, and a deep one no longer depends on high-order pages. Reserve the frontier room for a whole submission before its output fences are published, instead of one entry per command as it is queued, so that an allocation failure fails the submission cleanly instead of half-way. Userspace decides how long the frontier gets, and it can now grow past what contiguous pages ever allowed, so charge it and `finished` to the caller's memory cgroup (GFP_KERNEL_ACCOUNT). Fixes: 52ef95b ("drm/asahi: add the T8140 firmware interface") Fixes: 39bdd5b ("drm/asahi: release pruned G17 frontier entries after the ioctl publishes") Signed-off-by: Jonathan Goyvaerts <[email protected]>
Every enqueue pruned its engine's frontier with a full retain(): it read the completion status of every unfinished command, and the kernel's Vec::retain() swaps each kept entry in place, three 48-byte memcpy() calls per entry. A frontier holds every unfinished command, thousands under vkd3d-proton, so submitting N queued commands cost O(N^2). In test_resolve_image_exhaustive_descriptors (64 x 1024 resolves) on an M4 Pro, prune_frontier() and its memcpy() took about 70% of the ASAHI_SUBMIT ioctl's kernel time, 0.6 s of CPU per run. Commands mostly finish in order, so take finished entries from the front and stop at the first unfinished one: a prune now costs what it removes. When the room runs out, the held entries are moved down into the gap left in front once it is at least half as large as they are, so a move costs at most two per entry that left, and a steady deep queue does not double its room. A success that finishes behind an older unfinished command stays until it reaches the front. The readers already skip finished entries by their status, except the two that relied on a just-pruned frontier, host_predecessors and the compute timestamp waits; they now check it too, so they see the same set. The input-source check walks only the prefixes it covers, and the room for other-engine dependencies is sized by the unfinished ones alone. A failure cannot wait for the front: later commands whose prefix covers it must be cancelled from the next prune on, and a same-engine command without inputs or timestamps has no other reader that would see it. So a public fence that fails is counted twice in its VM's status: before its error is set and after it has signalled. A prune scans the whole frontier, as before, while the first count is ahead of the second one at its last full scan, so it keeps doing so until a scan has run after the failure finished. A prune that comes while the error is being signalled therefore still finds it. Entries now leave by moving into `finished` instead of by a clone, and `finished` grows as entries arrive instead of reserving room for the whole frontier on every prune. Signed-off-by: Jonathan Goyvaerts <[email protected]>
7c3642c to
bbfa456
Compare
|
Rebased onto integration/aurora
Assisted-by: LLM (Claude:Opus 5.5) |
Since the frontier is pruned from the front, a command that finishes behind an older unfinished one stays in it until the front finishes. The readers skip it, but it still holds its Completion: for a compute command that includes the 16 KiB timestamp page (a GEM object and its GPU mapping), which used to go back to the cache at the next prune. A compute command completes when its ring's stamp covers its kick, so one ring finishes in order. The completion-record fallback, a change of ring and recovery replay are not shown to keep that order, and a render queue spreads over several pairs. So rather than rely on it, also scan the whole frontier once there have been as many prunes as the last full scan left entries. The target is fixed at each scan: every enqueue prunes once and adds an entry, so with a stuck front a count compared against the current length would never catch up. That costs at most two more status reads per prune, amortized, and nothing finished waits longer than one queue length of submissions. A KUnit case keeps the front unfinished and adds an unfinished command with every prune; the finished ones behind it must leave at the scan. Signed-off-by: Jonathan Goyvaerts <[email protected]>
bbfa456 to
b792d3c
Compare
|
Hardware results from the J616s (M4 Pro, our m4.179 kernel) for the three commits as they were ( What m4.179 showed (the same cpu-clock profile of
So the prune cost is gone. But the test now runs 16 times deeper, and a walk that was too small to see at 4096 entries became the new quadratic. Two fixes:
Correctness on m4.179 (with the first three commits):
Tests on the new head: KUnit 747 tests, 746 pass, 1 skip (9 This stays a draft until the next kernel has booted commit 4 and the same profile shows the walk gone. Assisted-by: LLM (Claude:Opus 5.5) |
|
@jgoyvaerts status against integration/aurora daa9e2d: this merges cleanly (no change on the tip in these files since 110861f) and the g17 host tests pass on the merged tree (90/90). It still carries #2719's commit first, so #2719 goes in before it or with it. Open from review: a short KUnit case for VmStatus::signal_failure()/failures(), and hardware rows at bbfa456 (the J616s vkd3d-proton profile before and after, the dEQP-VK.synchronization groups, a soak, the same on an A18 Pro, and one run where a command fails behind an unfinished one). The change request on file is against 52054f1 and needs a re-review. |
|
Build note: the asahi crate builds with this branch merged onto integration/aurora daa9e2d (arm64, rustc 1.97.1, fleet release config), with one new warning: |
|
Hardware results for the fourth commit and the amended bound, on the J616s (M4 Pro). Our m4.182 kernel carries all four commits of this PR. Same test and the same cpu-clock profile as the earlier tables.
What's left in the ioctl is spread thin. The largest pieces are The Mesa build changed between m4.179 and m4.182, so the test's wall time is not a kernel-only number. The correctness checks below use baselines of the same Mesa build on m4.179, so they are a clean A/B of commit 4 and the amended bound:
Moving this out of draft. Still not tested on the M4, the M4 Max or the M5. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: HOLD at b792d3c5b95b
Blockers:
drivers/gpu/drm/asahi/g17/queue/mod.rs:205-207:prune_frontier()evicts failed entries fromself.publishers[index]without callingfailure.note(sequence, status, &fences). If a timestamp publisher at seq 2 sits behind an unfinished non-publisher at seq 1 infrontiers[index], and fails viafail_while_owned()(retaining its VM pin) afterfailuresis loaded at:197andfrontiers[index].prune()stops at seq 1,publishers[index].prune()(where seq 2 is at the front or hit bypublishers[index].scan_in == 0) seesstatus < 0and drops seq 2 without noting it inself.failures[index]. Later in the sameQueue::enqueue(),sources(:253-255),host_predecessors(:279-281), andtimestamps(:322-326) walkpublishers[index]andself.failures[index]and miss the failed retained publisher, allowing a dependent command to convert inputs, omit host-publication links, or publish inline without cancellation. Fix: callfailure.note(sequence, status, &fences);insideself.publishers[index].prune(...)as well (and add a KUnit or host test covering a publisher evicted withstatus < 0).- PR body (§4): Remove the disallowed
Assisted-by:attribution line at the bottom of the PR body. - PR body & hardware evidence (§5): Add the required
What:,Tested:,Risk:, andNot yet:lines to the PR body, naming the exact head SHA (b792d3c5b95b) and regression summary (0 failed units, 0 new kernel errors, SELinux status) inTested:, and add or request a second-Mac regression row for sharedg17/queuecode (another G17/G18 Mac besides J616s, such as M4, M4 Max, or M5).
Checked: All 4 commits (cde874ee..b792d3c5), prior blockers from 52054f13, Outstanding<T> compaction/wraparound/panic safety, VmStatus::signal_failure()/failures() ARM64 memory ordering, publishers index equivalence and pruning sync, G13–G18 regression isolation, checklist §1–§6, mergeability against main, and exact-head CI.
Evidence
- Prior blockers from
52054f13:- Failure bracket (
VmStatus::signal_failure()/failures()+Outstanding::prune()recordingfailures.finished) and KUnit case: resolved forfrontiers, regressed onpublishersin commit 4 (blocker above). Outstanding::reserve()compaction (2 * self.head >= self.len()) preventing 4x doubling, verified atDEPTH = 1100: resolved.#2719carryovers (GFP_KERNEL_ACCOUNTfor frontiers/publishers/finished, whole-submission reserve beforeoutputs.publish()): resolved (#2719itself remainsOPENatcde874ee).sources.prefix()walk andstatus() <= 0sizing fordependencies/checked_inputs/firmware: resolved.
- Failure bracket (
- Correctness & safety:
Outstanding<T>(outstanding.rs):self.head <= self.entries.len()andscan_in == 0guard prevent underflow;partition_pointmonotonicity holds on strictly increasingsequence >= 1; nounwrap()/expect()outside#[kunit_tests]; bounded wait fix (scan_in = self.len()at each full scan) verified bya_stuck_front_does_not_hold_finished_commands_past_a_queue_length.Fences::publishes_timestamps()(job.rs:561-563): matchesScheduler::enqueue(ready == completediffhost_timestamps, andpublication.is_some()implieshost_timestamps).- G13–G16 untouched; zero chip/board/firmware gates (§1), default cmdline (§2), no hardcoded hardware-safety limits (§3), clean human author/committer +
Signed-off-byon all 4 commits (§4), naming clean (§6).
- Mergeability & CI at
b792d3c5b95b:OPEN, non-draft,mergeable: true,host-testsSUCCESS. - Non-blocking notes:
drivers/gpu/drm/asahi/g17/queue/outstanding.rs:57:Outstanding::iter()is only called inside#[kunit_tests], soCONFIG_KUNIT=nbuilds will emit adead_codewarning; gating with#[cfg(CONFIG_KUNIT)]keeps non-KUnit builds warning-free.drivers/gpu/drm/asahi/g17/queue/mod.rs:595-604:publishers.reserve(room)reserves for all commands inpendingrather than only those withdestinations.has_outputs().drivers/gpu/drm/asahi/g17/status.rs:111:failures_started.fetch_add(1, Ordering::Release)(instead ofRelaxed) would avoid relying ondma_fence_signal()'s internal barrier, and a small KUnit test inasahi_g17_vm_statuswould directly pinsignal_failure()/failures().
Two readers of a queue's frontier only look for commands that write host timestamps: a render's host-publication links to earlier renders, and a compute command's waits for timestamps it may copy. Few commands publish, but both walked every unfinished command of their prefix to find them, on every enqueue. With pruning no longer the cost, that walk is what makes a deep queue quadratic: on an M4 Pro, vkd3d-proton's test_resolve_image_exhaustive_descriptors held up to 65536 commands in one frontier, and 1366 of the 1854 profile samples its submit thread spent in ASAHI_SUBMIT were this loop, which skips commands without a publication. Keep the publishers of each engine in a second, pruned list as well, and let both readers walk that. The input-source check, which needs every compute publisher of its prefix to have finished, uses it too. Each list is pruned and reserved with its frontier, and its entries are released with the other pruned ones after the ioctl. A publisher can leave its own list while the frontier still holds it behind an older unfinished command: a failure signalled after the prune read the VM's failure counts leaves the frontier's prune front-only. Its readers would then not see that failure in the same enqueue, so a failure is recorded whichever list it leaves first. prune_engine() does both prunes with one callback, and a KUnit case keeps a failed publisher behind an unfinished command and checks it is recorded. Signed-off-by: Jonathan Goyvaerts <[email protected]>
b792d3c to
c139054
Compare
|
Merged main (
One cost to know, unchanged here: with 086a909, every render without outputs behind a pending publication gets a publication itself. In that pattern the publisher list is no longer sparse, and each submit walks and links all pending ones, as main does over the whole frontier. The 65,536-deep test has no timestamps, so it doesn't show this. Tested at The PR description was empty from 2026-11-24 21:09 UTC; it is restored from its last version, with the Tested and Not yet lines updated. |
|
J616s (M4 Pro, T6040) row at head Kernel: our m4.190 test kernel, booted 2026-11-25 15:43 UTC: aurora main
Not covered: M4, M4 Max and M5 rows; a soak. The 086a909 publication-chain pattern noted in the merge comment isn't exercised here, because this test writes no timestamps. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Audited the main merge at 9cc1c8acf8bc on top of the previously verified 4-commit series (c139054181d2): widening Fences::publishes() to publication.is_some() || ready == completed matches both same-engine predicates in EnqueueOrdering::build() (L749/L770) and the compute source check, routing HostOutputKind::Immediate errors through VmStatus::signal_failure() keeps failure-count pruning race-free, host-tests + KUnit pass, and the exact-head J616s row passes cleanly (65,536-entry frontier, 0 d3d12/query_pool diffs).
Holding merge until the remaining second-generation hardware row (M5 or Neo) lands for this shared G17 queue path.
Resolve against 8677cbd ("drm/asahi: g17: avoid publication contagion and host drains on timestamp overlap"), keeping main's rules and reading them through each engine's publisher list: - has_pending_publication() reads the publisher lists and now needs Publication::is_pending(), as on main. - The compute input-source check walks the compute publisher list with main's predicate: every covered entry with a pending publication or ready == completed must have finished. Settled publications no longer block it. - EnqueueOrdering::build() takes main's rules (pending publications only, host waits only for query-accessing compute, has_outputs gone) over the same lists as before. - Fences::publishes() is unchanged (publication.is_some() or ready == completed). It is a superset of what build() and the checks look for; each reader still filters on is_pending(). - New: enqueue() prunes its engine again right before build(). Main now also host-waits on a same-engine command that failed after the first prune without a pending publication. Such a command is not in the publisher list, but a visible failure always moves the VM's failure count, so this prune does a full scan and records it, and the failure record makes it a checked dependency like main's host wait. With no failure it costs one front-only prune. - Main's cross-engine KUnit cases build Outstanding lists. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
Merged main (
Tested at
Not yet: a J616s row at this head. Our m4.190 kernel carries |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verified the main merge-forward resolution in drivers/gpu/drm/asahi/g17/queue/mod.rs against 8677cbde1ddc: has_pending_publication() and the compute fast-path cleanly preserve main's pending-publication and failure rules through each engine's publisher list, with prune_frontier(index) run before EnqueueOrdering::build(). Holding merge until CI completes green and updated hardware verification clears.
|
|
|
Merged into main (ORCH5 batch, 11-26). Thanks @jgoyvaerts! The exact-head hardware row it landed on is #2732 (comment). Assisted-by: LLM (Claude:Opus 5.5) |
Conflicts, and how they were resolved: - g17/queue/mod.rs submit(): main (aurora-silicon#2732) reserves room for every command's frontier and publisher entry before queuing, then takes the guards with into_iter(). The reservation is kept, and this branch's guards.drain_all() follows it, so the per-queue scratch vector keeps its allocation. - g17/runtime.rs Backend: main's compute_channels and this branch's spare_batch fields are both kept, in the struct and in new(). No behaviour changes: the branch's diff against main is unchanged. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
J616s (M4 Pro, T6040) row at Kernel: our m4.195 test kernel, booted 2026-11-26 19:06 UTC: aurora main
The second prune before
Not covered: M4, M4 Max and M5 rows; a soak. |
What: Prune a G17 queue's frontier from the front, bound how long a finished entry waits in it, and index its host publishers. Submitting N queued commands is no longer O(N²), and failures stay exact. Stacked on #2719.
Tested: J616s M4 Pro at c139054 (all four commits, including the publisher-failure fix, as carried in our m4.186 kernel): the submit thread's ASAHI_SUBMIT samples are 354 (1724 before this PR, the prune's about 1204 of them) on a 65,536-entry frontier; d3d12 list (544) and dEQP-VK query_pool/timestamp 0 differences against the same Mesa build; 0 failed units, 0 new kernel errors, 0 GPU recoveries. Our kernels load no SELinux/AppArmor. At 9cc1c8a (main efed1ae merged): KUnit 806/807 (1 skip); J616s M4 Pro in our m4.190 kernel (main 8c6bd8d + #2504 + this PR + #2228): the test passes at a 65,536-entry frontier, d3d12 list and query_pool/timestamp 0 differences, 0 OOM kills, 0 GPU recoveries in the run. At aabe211 (main f7b890d merged, see the merge comment): KUnit (arm64 qemu) 824 tests, 823 pass, 1 skip; host suite, every g17 and asahi job passes; no hardware run at this head yet.
Risk: two-way door · M4, M4 Pro, M4 Max and M5 (shared G17 queue code)
Not yet: a J616s row at aabe211; the publisher-failure race itself is covered by KUnit only (it needs a failure signalled while a prune runs); M4, M4 Max and M5 rows
Details
Stacked on #2719 (its commit is the first one here). The second, third and fourth commits are new: "drm/asahi: g17: prune a queue's frontier from the front", "drm/asahi: g17: bound how long a finished command waits in the frontier" and "drm/asahi: g17: index each frontier's host-timestamp publishers".
Every enqueue pruned its engine's frontier with a full
retain(). That read the completion status of every unfinished command. The kernel'sVec::retain()also swaps each kept entry in place, which is three 48-bytememcpy()calls per entry. A frontier holds every unfinished command, thousands under vkd3d-proton, so submitting N queued commands cost O(N^2).Profile on a J616s (M4 Pro), unfixed kernel: vkd3d-proton's
test_resolve_image_exhaustive_descriptors(64 x 1024 resolves),cpu-clockat 1999 Hz. Of the 1724 samples the submit thread spent in ASAHI_SUBMIT:memcpyfromretain()'s swaps inprune_frontierprune_frontieritself + fence status readsThat is about 70% of the ioctl, roughly 0.6 s of CPU per run.
The change
reserve()moves the held entries down into the gap in front once it is at least half their number. That is at most two moves per entry that left, and a steady deep queue never doubles its room. Growth happens only when more than two thirds of the room is held, so the room stays under 3x the deepest the queue got. The newg17/queue/outstanding.rsholds this, generic over the entry so KUnit can test it.host_predecessorsand the compute timestamp waits, now check status too. All readers therefore see the same set as before, up to the race a concurrent signal always had. The input-source check walks only the prefixes it covers (.prefix()), and the room for other-engine dependencies is sized by the unfinished entries alone.Output::publishis the only place that sets an error on or signals these fences. A failing one now goes throughVmStatus::signal_failure(), which counts it as started before the error is set and as finished aftersignal().finished, thenstarted, and scans the whole frontier, as before, whilestarteddiffers from thefinishedcount at its last full scan. A prune that comes while an error is being signalled therefore scans in full, and so does every prune after it until one has run after the failure finished. Failures are rare, so full scans are too. A VM whose commands fail continuously costs what it costs today.finishedinstead of being cloned, so they're still released after the ioctl publishes.host_predecessors, the compute timestamp waits and the input-source check only look for host-timestamp publishers, but walked every unfinished command of their prefix to find them on every enqueue. On m4.179, with the test running 65,536 commands deep, that walk was 1366 of the 1854 submit samples. Each engine now keeps its publishers in a second, pruned list as well, and those readers walk it. Since main's 086a909 a command can also have an ordered publication without timestamps (it chains behind a predecessor's), so the index holds every entry with a publication or withready == completed(Fences::publishes()): every same-engine entryEnqueueOrdering::build(),has_pending_publication()and the input-source check look for.Evidence
Testing
asahi_g17_outstandingcases:tools/asahi/run-host-tests.py --only g17: 90/90. The quarantine-drain stub takes the newstatusargument.drivers/gpu/drm/asahi/has no entry of its own.On hardware (J616s, our m4.179 kernel, first three commits)
On hardware (J616s, our m4.182 kernel, all four commits)
Queue::submit's own code: 12, against 1366 on m4.179 and 165 on m4.177.Not done