Repository navigation
drm/asahi: g17: install a submission's outputs only once it is queued - #3701
jgoyvaerts wants to merge 8 commits into
Conversation
f13f2d9 to
95bb3cf
Compare
A G17 SUBMIT stores its aggregate fence in the output sync objects when it
creates it, before the loop that queues its commands. Every failure of
that loop therefore comes after the outputs changed. Under
DRM_ASAHI_FEATURE_SUBMIT_REFUSAL_UNTOUCHED, those failures cannot be
refusals (ENOMEM, ENOSPC), and they become EIO. The loop allocates each
command's completion state, including the compute timestamp page, its
dependency vectors, its packet and its scheduler job. A lack of memory
there cost the client its device.
Install the outputs after the loop instead:
- **Creating the submission** builds the aggregate fence and allocates
the cumulative signal's scope (now `asahi_g17_signals_prepare()`), but
stores nothing.
- **Outputs::install()** stores it in every output
(`asahi_g17_signals_commit()`). It cannot fail.
- **When it runs:**
- after the loop, unless the ioctl was refused before its first command
was queued;
- otherwise when the outputs are dropped, as before.
- **Queued means armed:** a command counts as queued once its scheduler
job is armed. The two pushes after that, into room reserved before the
first command, now return EIO if they ever fail, so ENOMEM never
follows a queued command.
A refusal while preparing the first command now leaves the outputs
untouched too. This covers every refusal of a one-command submission. A
refusal of a later command still returns EIO, because earlier commands of
the same ioctl are already queued.
Early publication can now complete a command before its outputs carry
the fence. They then get a fence that is already signalled. The cumulative
scope is still taken over the anchor's fence before the loop, under the
queue's lock.
G16 keeps `SignalBundle::publish()`, now prepare plus commit, built only
with CONFIG_DRM_ASAHI_G16 (G17 no longer calls it).
The host test g17-submit-refusal-untouched-tests.py also checks three
things: creating the submission stores nothing, the outputs are installed
after the loop and gated on queued commands, and post-queue failures are
EIO. Three more injected faults are caught.
Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
95bb3cf to
1b3f06b
Compare
Signed-off-by: DjDeveloperr <hey@djdev.me>
Signed-off-by: DjDeveloperr <hey@djdev.me>
A first-command refusal leaves the prepared aggregate private. Emit the install event when the output syncobjs have actually been updated so a refused ioctl cannot report a transient installation. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
J700 (Neo, G17P) boot row at head Kernel: one trial boot (boot
Results
Not run: the same refusal rows as on #3700: first-command refusal without a phase-1 install, same-queue retry, and the installed fence plus terminal error after partial acceptance. There is no genuine refusal path on this kernel, so they need an injection test kernel and Mesa #1421. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed 6d560c7. The corrected #3700 is in the branch. Abandoning a prepared scope releases both child references while its prior anchor is pending. The follow-up moves the install trace past enqueue, so a first-command refusal emits no installation event. The regression check caught the old ordering, and all 300 driver checks passed. G17 refusal/retry and G16 cumulative signals still need hardware rows.
…ueue Brings in aurora-silicon#3700's merge of main (133672c) and with it main's b01dc0e: Outputs::set_result() replaces Outputs::finish(), and an -ERESTARTSYS before publication leaves the outputs untouched. No conflicts. On this branch that -ERESTARTSYS comes before Outputs::publish(), so no submission exists, Outputs::install() does nothing and Outputs::drop() returns before the fallback is installed: the outputs stay untouched as main requires. Main's KUnit test full_window_signal_leaves_timeline_untouched_for_restart publishes the restarted submission and expects its timeline point installed. On this branch Outputs::publish_with() only prepares the outputs and Queue::submit() installs them once a command is queued, so the test now calls Outputs::install() after publishing, as submit does. 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. |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Keep main's shared input allocation before enqueue. The submit trace still runs after the output sync objects have been installed. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Forward-merged main The warm ARM64 |
|
@jgoyvaerts This branch now conflicts with
Could you forward-merge |
Main's 6b5d926 skips retaining a prior scope that already succeeded, so a cumulative scope's children[0] can be NULL and its pending count starts at 2. This branch's ffcbd94 installs the callbacks in asahi_g17_scope_arm() at commit instead of in asahi_g17_scope_create(). Conflict in g17/sync_scope.c, resolved as the union: create keeps main's optional parent and pending count, and arm skips a NULL children[0]. include/uapi/drm/asahi_drm.h now matches main: bit 48, DRM_ASAHI_FEATURE_SUBMIT_REFUSAL_UNTOUCHED, came with aurora-silicon#3700. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
The KUnit test cumulative_scope_skips_signaled_healthy_prior_but_retains_failed_prior, which came with main's 6b5d926, publishes its signal bundles with SignalBundle::publish(). On this branch that is G16's one-call form and exists only with CONFIG_DRM_ASAHI_G16, so a KUnit build without G16 (the m4 kernel's configuration) fails to compile the test. Prepare and commit each bundle instead, as G17's Outputs::install() does; the test checks the same scopes. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
There was a problem hiding this comment.
Verdict: MERGE at 7067042
Checked: A first-command memory or capacity refusal leaves existing sync objects and their timeline points intact. Once a command is queued, a later allocation refusal publishes the failed submission and returns EIO. The scheduler finishes fallible setup before accepting the job. An abandoned cumulative scope releases its child references without arming callbacks, and G16 still prepares and commits its scope in the same call.
Evidence
The exact submission-refusal host check passed and rejected all eight supplied mutations. Extracted Rust helpers passed 18 combinations of queue depth and return value. The earlier #3700 dependency is merged. Hosted checks and native G17 refusal/retry and G16 cumulative-signal rows are still pending.
What: Stacked on #3700; review only the top commit "drm/asahi: g17: install a submission's outputs only once it is queued". A G17 SUBMIT now stores its fence in the output sync objects after it has queued its commands, not before. A refusal (ENOMEM/ENOSPC) while preparing the first command then leaves the outputs untouched (#3700's contract, bit 48), so Borealis reports out of memory instead of losing the device. Every refusal of a one-command submission is covered.
Tested: no Mac at this head yet. At b6ad823 (main 49424e0 merged on DjDeveloperr's 70614ee, then main's prior-scope KUnit test moved to G17's prepare and commit): KUnit (arm64 qemu) 1119 passed, 1 skipped, 0 failed, including that test through this branch's commit-time arm; without CONFIG_DRM_ASAHI_G16 (the m4 kernel config) 1114 passed, 6 skipped, 0 failed, with no warning in this PR's files. At 7067042 (the merge alone), the full host run passes every g17 test with its mutations. The other failures of the full host run are local toolchain gaps in tests this PR does not touch (rustup 1.93.1 missing for g15-*, a
__stack_chk_guardlink error in sep-suspend-errors and asahi-m4's test-stream-gate); they fail the same way in all three merged trees. Earlier, KUnit at 1b3f06b: 949 passed, 1 skipped, 0 failed; without CONFIG_DRM_ASAHI_G16 (the m4 kernel config): 946 passed, 4 skipped, no dead-code warning. Host tests at 95bb3cf (the same code but for one cfg attribute): g17-submit-refusal-untouched-tests and its 8 mutations (3 new) pass; the 29 remaining failures of the full run also fail on main.Risk: two-way door · M4 and M5 (G17), plus G16's cumulative signals (same allocation, now in two calls). On every failure other than a refusal, the outputs end as before.
Not yet:
Details
Before:
Outputs::publish*created the aggregate fence and stored it in every output at once, before the enqueue loop. Every failure in the loop came after the outputs changed, so under #3700's contract it was EIO. The loop allocates each command's Completion (the compute timestamp page among it), dependency vectors, Packet and drm_sched job.After:
publish*creates the aggregate fence and prepares the cumulative signal (asahi_g17_signals_prepare(): allocates the scope, stores nothing).Outputs::install()(asahi_g17_signals_commit(), ordrm_syncobj_*for plain outputs) stores it. It cannot fail.submitinstalls after the loop, unlessuntouched_refusal(any command queued, result). Outputs' drop still installs on every other path, so the end state of every non-refusal is unchanged.push_within_capacitycalls after arming fill room reserved before the first command, and now return EIO if they ever fail, so a refusal never follows a queued command.Ordering: early publication can complete a command before the outputs carry the fence; they then get an already-signalled fence. The cumulative scope is still taken over the anchor's current fence before the loop, and the queue's lock is held throughout. WAIT_FOR_SUBMIT waiters on an output point wake after the loop instead of before it.
G16:
SignalBundle::publish()stays, as prepare plus commit, built only with CONFIG_DRM_ASAHI_G16: G17 no longer calls it.Evidence
tools/asahi/g17-submit-refusal-untouched-tests.pyadds three checks:The new mutations
install-early,ignore-queuedandqueued-enomemare each caught. The three checks fail on #3700's head, which installs at creation.