Repository navigation
drm/asahi: g17: share a submission's inputs between its commands - #3600
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 <jonathan.goyvaerts@gmail.com>
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 <jonathan.goyvaerts@gmail.com>
|
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:
|
Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
has_host_dependencies() decides whether a command may be published from its submitting ioctl. It looked only at Packet::inputs, but a submission's own input fences are now in the list its commands share (shared_inputs), so a command whose only host wait was an unsignalled submission input could be published early, without waiting for that input or checking its status. Check every host-checked input, as has_dependencies() and the dependency checks already do. The inline cross-engine host test now models the shared list, with a case where the only host wait is a shared input and a mutation that looks only at the command's own inputs. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
A command whose compute sources take over all of its submission's inputs in firmware waits on none of them on the host. One whose sources take over only some of them now shared the submission's whole list, and so also waited on the host for the inputs its sources already order, where each command used to skip each covered input on its own. command_inputs() picks a command's list: the shared one when its sources take over no input, else a list of its own with the inputs they leave (none when they leave only signalled ones). That one case pays for its own list again; every other command keeps sharing. It replaces Sources::cover(), which only told whether the sources took over all of them. A host test compiles command_inputs() and covers the shared, partly covered and fully covered cases, with mutations that wait on the covered inputs too or share the list regardless. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approving at f35fd09.
How I read it: a submission's unsignalled inputs are gathered once, after its outputs are published, and every command holds a share of that one list instead of its own copy. Past 8 inputs, the merged fence is built once per submission. Every command still checks every input's status before it publishes: Packet::inputs() chains the command's own checked producers with the shared list. has_host_dependencies() counts the shared list too, so a command with an unsignalled submission input stays off inline publication. A compute command whose sources take over some inputs gets a list of its own with only the rest, so it doesn't wait on the host for inputs the firmware already waits for. Ownership looks right: Inputs lives in an Arc, each CommandInputs holds one reference, and the merged fence holds references of its own.
What I ran on pc, on the merge with main f778d6c:
- g17 host tests (
run-host-tests.py --only g17-, the hosted toolchain image): main 404/404, main + this PR 408/408. That includes g17-command-inputs with both of its mutations caught, and the new inline-cross-engine case with its mutation caught. - W=1 of
drivers/gpu/drm/asahi: no new warnings against main (43 warning blocks on both). - Normal build on the 7.3.0-main571a6c45 kernel: only
aurora.kochanges, with the same warnings as main.
Not run here: KUnit, because it needs an arm64 VM and we don't use one.
Before merge: the hardware results in the body come from a J616s backport, not this head. The readiness bot counts them as a row at head, but they aren't one. J714s and J700 rows of main + #3600 + #3601 + #3652 are queued with the M5 and Neo leads. The three PRs merge cleanly on main in either order. I'll land them as #3600, then #3601, then #3652.
|
Merged at the approved head
|
What: Each command of a G17 submission copied every unsignalled input fence of the submission, and its scheduler job held its own dependency on each (or its own merged fence past 8).
in_sync_counthas no limit, so a 64-command submission behind a stalled fence held 64 copies of every input for as long as its commands stayed queued. The commands now share one input list per submission, and past 8 inputs one fence merged once per submission. Every command still checks every input's status before publication. A third commit makes main's inline publication (#3390) count the shared inputs as host waits, so a command with an unsignalled submission input is not published from its ioctl. A fourth gives a compute command whose sources take over only some inputs a list of its own with the rest, so it waits on the host only for those, as before; every other command keeps sharing.Tested: no hardware run at this head f35fd09 yet; the backport below ran. QEMU arm64 KUnit (asahi kunitconfig) at f35fd09 (main 33be2ff merged in): Ran 1063 tests: passed: 1062, skipped: 1. A build of drivers/gpu/drm/asahi without KUnit at that head is clean apart from main's own warnings. tools/asahi host tests at f35fd09: the same failures as on main ade5247. The new g17-command-inputs-tests (shared, partly covered and fully covered commands) passes, and both its mutations (waiting on the covered inputs too; sharing the list regardless) are caught. g17-inline-cross-engine-tests' new shared-input case fails on the merge before the third commit, and its new mutation (only the command's own inputs counted) is caught. Before the merge, at fbc7bc3: Ran 936 tests: passed: 935, skipped: 1; the new sharing test fails on the first commit alone (red: Ran 936, 1 failed). 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). The scheduler waits on one merged fence instead of each of more than 8 inputs, the wait the >8-dependency path already used. Inputs are gathered once per submission instead of at each command, so an input that signals in between is still a (signalled) dependency of later commands of the same submission.
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
Two commits:
sync_input::Inputsgathers a submission's unsignalled input fences once, after its outputs are published, and each command takes its share withfor_command(). A command still holds its own copy here, so this one changes nothing. A command whose compute sources take over the inputs in firmware takes none of them, as before:Sourcescovers every input that had not signalled when it was built (Backend::input_sources), so the old per-fence filter was all or nothing. The decision now reads the submission's inputs as passed (Sources::cover). The host checks before publication run over the command's own fences (failures, host waits, publication waits), then the shared inputs.Arcof the list, and pastMERGED_DEPENDENCIES(8) inputsInputsalso holds one fence merged from all of them (sync_input::merge, the same__dma_fence_unwrap_mergethe >8-dependency path uses), so a command's scheduler job waits on that fence. A command's other dependencies (host waits, failures, firmware producers) are unchanged.The list is charged to the caller (
GFP_KERNEL_ACCOUNT) and needs no contiguous pages (KVVec).The base-fence dedup that follows (#3601) builds on this.
Evidence