Repository navigation
drm/asahi: g14_v27_2: use non-blocking Uat::try_bind() under Runtime.state - #3238
Conversation
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
…state publish_compute() and publish_render() run with Runtime.state locked and previously called blocking Uat::bind(). When all UAT user context slots are occupied (for example with asahi.robust_isolation=1 while another VM has a job in flight), Uat::bind() sleeps inside SlotAllocator::get() while holding Runtime.state. Runtime::service() must acquire Runtime.state to retire in-flight work and drop its VmBind guards, causing a permanent self-deadlock. Widen Uat::try_bind() to CONFIG_DRM_ASAHI_G14_V27_2 and move the is_no_peer() guard into bind_inner() so bind() and try_bind() enforce the same checks. Switch publish_compute() and publish_render() to try_bind() before preparing render scenes or mutating pool/queue state, returning a distinct PublishError::BindBusy on ENOSPC so allocator ENOSPC from QueueRender::prepare() is not misclassified as a context-slot wait. In Runtime::pump(), handle BindBusy without blocking under Runtime.state: - When work is in flight (state.running()), leave the front packet queued and return so Runtime::service() can retire work, drop its VmBind, and re-pump. - When idle (!state.running()), arm a bounded delayed retry via Notify::retry() capped at COMMAND_TIMEOUT_MS. If the slot remains externally held past the deadline, pop the front packet, release its guard, and complete it with fail_packet(ENOSPC) so neither the client's VmStatus nor the healthy runtime is poisoned. - Clear waiting_bind on publication, front withdrawal (waking service for a successor or notifying idle when empty), fail_all(), and across sleep_prepare()/sleep_complete(). Add a standalone host test harness under tools/asahi/ covering concurrent robust_isolation=1 retirement without deadlock, idle external slot hold recovery and timeout, withdraw/sleep/stop interactions, and negative control mutations, and register it in tools/asahi/run-host-tests.py. Closes: aurora-silicon#3068 Signed-off-by: AxxzyWasTaken <[email protected]>
c97d26b to
d1c27c8
Compare
There was a problem hiding this comment.
Publication no longer waits for a UAT slot while holding Runtime.state; render checks the slot before preparing its scene. Slot pressure has a distinct retry path, and the exact-head standalone harness passed all 10 cases here. Apple build, host tests and KUnit are green. Keep the PR held for the requested M2 firmware-27.2 multi-client run.
|
Merge-train status at |
|
Updated the PR body so Yes please — I do not have an M2 machine locally, so running the exact-head G14 firmware 27.2 row on your J473 or J413 would be very helpful. Thanks! |
|
Tested d1c27c8 on J473 (M2 mini, G14G B0, fw 27.2): PASS, as part of a batch boot. Kernel: Row (one guarded one-shot, restored to fleet89 after):
Evidence: For this PR: no |
|
Tested d1c27c8 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 |
Resolve the run-host-tests.py list: keep both g14-v27-2 entries (fw-window-gc from main, try-bind from this branch). Signed-off-by: Ryan Murray <[email protected]>
|
Forward-merged |
There was a problem hiding this comment.
Verdict: MERGE at 948fee2 after hosted CI and integration validation.
Checked: the two parents are the previously approved head and current main. Git remerge diff shows the sole manual resolution is the host-test registry, which retains both the firmware-window and try-bind suites with their mutation lists. The try-bind test file is identical to the reviewed head. The GPU source changes relative to that head include the merged main changes, with no manual resolution in those files. The merge-train host tests passed. Keep the existing J473 and J316s evidence tied to its tested build.
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Fixes a permanent
Runtime.state<->Uat::bind()self-deadlock on the G14 firmware 27.2 backend whenever UAT context slots are exhausted (guaranteed with 2 concurrent VMs underasahi.robust_isolation=1, or 63 concurrent VMs normally):Uat::try_bind()indrivers/gpu/drm/asahi/mmu.rsto#[cfg(any(CONFIG_DRM_ASAHI_G15, CONFIG_DRM_ASAHI_G14_V27_2))]and move theis_no_peer()-ENOTSUPPguard intoUat::bind_inner()sobind()andtry_bind()enforce identical checks.publish_compute()andpublish_render()indrivers/gpu/drm/asahi/g14_v27_2.rsfrom blockingUat::bind()to non-blockingUat::try_bind()underRuntime.state, binding beforeQueueRender::prepare()so retries neither churn render-buffer/scene allocations nor confuse allocator-ENOSPCwith UAT context-slot exhaustion.PublishError::BindBusyinRuntime::pump()without blocking underRuntime.state:state.running(), clearwaiting_bind, leave the packet atstate.pending[0]without mutating slots/counters/rings, and return soRuntime::service()can retire in-flight work, releaseVmBind, and re-pump.!state.running(), arm bounded delayed retries viaNotify::retry()capped atCOMMAND_TIMEOUT_MS; on expiry, pop the front packet, callrelease_guard(), and complete viafail_packet(ENOSPC)without poisoningVmStatusor the healthy runtime.waiting_bindon publication, frontwithdraw()(waking service for successors or notifyingidle),fail_all(), and acrosssleep_prepare()/sleep_complete().tools/asahi/g14-v27-2-try-bind-tests.pyregistered intools/asahi/run-host-tests.py.Closes: #3068
Tested:
tools/asahi/run-host-tests.py --only g14-v27-2-try-bind: 10/10 passed (10 positive scenarios including multi-threadedrobust_isolation=1contention, same-VM pipelining, renderENOSPCbeforequeue.prepare(), idle external-hold recovery/timeout,withdraw(),sleep_prepare()/sleep_complete(),stop(), plus 9/9 negative-control mutations killed).tools/asahi/run-host-tests.py --only asahi-m4: 1/1 passed (test-mmu-retention.py).ARCH=arm64 LLVM=1 drivers/gpu/drm/asahi/aurora.ocleanly with 0 warnings in touched files across 4 configs (G15=y/G14_V27_2=ywithAPPLE_SOC_SLEEP=yand=n,G15=y/G14_V27_2=n, andG15=n/G14_V27_2=n).git diff --checkclean;scripts/checkpatch.pl --strict --git HEAD~1..HEADreports 0 errors / 0 code warnings.Not yet: On-hardware M2 (G14 firmware 27.2) boot and
asahi.robust_isolation=1multi-client stress run.Risk: two-way · M2 family Macs using G14 firmware 27.2 (
CONFIG_DRM_ASAHI_G14_V27_2)