Repository navigation
drm/asahi: g17: keep each base fence of a submission's inputs once - #3601
jgoyvaerts wants to merge 3 commits into
Conversation
Every command of a submission walked the submission's input syncs and kept its own list of the fences that had not signalled. Gather that list once per submission in sync_input::Inputs, after the outputs are published, and give each command its share through Inputs::for_command(). A command still holds its own copy, as before; the next commit shares it. A command whose compute sources take over the inputs in firmware takes none of them, as before. Sources covers every input that had not signalled when it was built (Backend::input_sources), so the per-fence filter is all or nothing; an input that signalled in between needs no wait either. The fences checked on the host before publication are now the command's own (failures, host waits, publication waits) followed by the submission's inputs. Only the order of the checks changes: each failed input still fails the command with PRODUCER_FAILED. No functional change intended. Signed-off-by: Jonathan Goyvaerts <[email protected]>
Each command of a submission kept its own list of the submission's unsignalled input fences, and its scheduler job its own dependency on each, or a merged fence of its own past MERGED_DEPENDENCIES. All of it stayed allocated while the command was queued. The input count is set by userspace (in_sync_count has no limit), so one submission of 64 commands behind a stalled fence held 64 copies of every input, and a queue kept as many of those as it had queued commands. The commands now share the submission's list (Inputs, behind an Arc), and past MERGED_DEPENDENCIES inputs one fence merged from all of them once per submission. A command's scheduler job waits on that fence, or on each of a few inputs as before, and the command still checks every input's status before publication. Signed-off-by: Jonathan Goyvaerts <[email protected]>
A submission's inputs went into its list as userspace passed them. The same fence could be listed any number of times (one syncobj handle repeated, or several timeline points and fence arrays over the same underlying fences), and every entry stayed allocated with the queued commands and was checked before publication. Unwrap each input into its base fences with collect_coalesced(), the collector the compute source path already uses, and keep each base fence once across the submission. Of the unsignalled, healthy fences of one context only the latest stays: it signals after every earlier one, as collect_coalesced() already does within one input. A failed fence is never folded into another, so every input error still fails the command, and context 0, which names no timeline, is only deduplicated by identity. Where collection fails (allocation, an unsupported container, more than 128 leaves) the input itself is kept, as before. Checking the base fences is at least as strict as checking the container: a fence array's error is one of its fences', and an earlier timeline point's error, which a later chain point need not carry, now fails the command as well. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
Hardware results on a backport, not the exact heads. J616s M4 Pro, test kernel 7.3.0-m4.205: m4/private-205 =
Row 3, what happened. At depth 4096 one submission failed with EBUSY. It was not from the budget, which only ever sleeps and held about half its units at the time (132k of 262k). It came from the context's submission order window (
The window refusal is fixed in #3602 by its third commit: the window is 4096, asserted above the most submissions the budget lets wait (2048 + 64), so a full queue makes the submitter sleep first. The fault-then-firmware-crash after a lost device is a separate kernel bug, already being looked at elsewhere. Until it is fixed, row 3 at depth ≥ 4096 counts as hang-risk. Still to run: the Cyberpunk benchmark with probes on the inlined charges (the real budget use), and the dEQP-VK |
|
Results on a backport, not the exact heads. J616s M4 Pro, test kernel 7.3.0-m4.211 (m4/private-211 =
On 4b:
What changed because of 1c:
|
What: A G17 submission's inputs went into its list as userspace passed them, so one fence could be held any number of times: a syncobj handle repeated, or several timeline points and fence arrays over the same underlying fences. Each input is now unwrapped into its base fences with
collect_coalesced(), the collector the compute source path already uses, and each base fence is kept once across the submission. Of one context's healthy unsignalled fences only the latest stays; a failed fence is never folded away. Stacked on #3600: review the last commit.Tested: no hardware run at this head 34e83f4 yet; the backport below ran. QEMU arm64 KUnit (asahi kunitconfig) at 34e83f4: Ran 941 tests: passed: 940, skipped: 1. The new dedup tests fail on #3600's head (red: Ran 941, 4 failed). tools/asahi host tests: no new failures (the same 45 failure lines as on main 1957bb7). J616s M4 Pro, backport on test kernel 7.3.0-m4.205 (m4/private-205 = 89a8b725782f with #3600, #3601 and the budget of #3602; not this head): Cyberpunk 2077 benchmark 24.6-25.9 fps, 0 submit errors, 0 lost devices, 0 recoveries; Hearthstone + desktop clean (results). A deep gpubench compute stream crashed the GPU firmware through #3602's order-window EBUSY and a separate teardown bug, not through the input changes.
Risk: two-way door · M4 and M5 (the G17 submit path). Checking base fences is at least as strict as checking their container: an earlier timeline point's error, which a later chain point need not carry, now fails the command too. Coalescing one context's unsignalled points to the latest is what
collect_coalesced()already did within one input; an earlier point that later fails while the latest succeeds is not seen.Not yet: the dEQP-VK synchronization, synchronization2 and timeline-semaphore slices (the next test kernel); a hardware run at this exact head. Not run on M5.
Details
Inputs::new()(from #3600) now:collect_coalesced()(dma_fence_unwrap over arrays and chains, plus G17 sync scopes) and keeps each leaf; where collection fails (allocation, an unsupported container, more than 128 leaves) it keeps the input itself, as before;Compute source coverage is decided on the inputs as passed (
Sources::cover, from #3600), sinceSourceslists the input heads and the list now holds their leaves; a test covers that case.Evidence