Skip to content

drm/asahi: g17: do not mark a live owner released when detaching a sibling - #3772

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/g17-detached-sibling
Dec 1, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/g17-detached-sibling

Conversation

@satchlj

@satchlj satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member

What: Track idle-sibling detachment (keep_installed=true) separately from closed-owner release in drivers/gpu/drm/asahi/g17/queue/admission.rs so State::owner_released() no longer treats a still-live owner as closed and rejects subsequent render submissions with -ECANCELED under QID pressure. Closes #3645.
Tested: M5 Max (J775c, G17C B1, macOS 27.2 (26B123)), kernel 7.3.0-1-50-ARCH at e3c6ba5fa251 (+ #3682), Borealis Mesa a4153c8fef, default kernel command line: gpubench-stress-vk --test queue.exhaust 10/10 PASS (5 devices x 8 queues, 181 checks, 0 errors each), 0 GPU/DART kernel errors, 0 failed units, HDMI connected, SLC enabled on 32 planes; baseline A/B on the same machine and Mesa (7.3.0-1-46.5-ARCH, e6c7b032 + #3686/#3689/#3682) 0/10 PASS (10/10 FAIL) at render q0 d1, submission 6: pixel (0,0) = cdcdcdcd. Offline: asahi KUnit 513/513 passed (4 skipped), tools/asahi/g17-admission-order-tests.py PASS (+ 2 mutation guards), checkpatch.pl --strict 0/0/0.
Risk: two-way door · M5 Macs (G17). Plain revert restores prior admission tracking; change is confined to G17 queue admission and its host test.
Not yet: M5 and M5 Pro (other G17 Macs); non-G17 Macs do not execute g17/queue/admission.rs.

Details

Commits f3497c695381 ("drm/asahi: fix detached spare ownership and release publication guard") and 4fc8d0f4be14 ("drm/asahi: g17: keep an owner's wide-layout render pair when reclaiming under QID pressure") detach an idle sibling via State::release_unused_sibling(..., keep_installed=true) by leaving owners[slot] set while marking released, so installed render QIDs stay reusable and exit-kill ownership stays synchronized.

However, State::owner_released() treated (owners[slot] == owner && released) as a proxy for a closed owner. Under queue or compute QID pressure (such as gpubench-stress-vk --test queue.exhaust), detaching one idle sibling from a still-live owner caused owner_released() to return true for that owner, making try_acquire_render() skip early publication and acquire_render() reject subsequent render submissions with -ECANCELED even though the owner remained open on its primary pair.

Fix:

  • Track detached-from-live-owner slots in a detached subset of released in State.
  • Exclude detached slots in State::owner_released().
  • Clear detached whenever a slot is reacquired, reclaimed unowned, or converted to a real close in Pool::release_owner() / processor stop.
  • Add KUnit and tools/asahi/g17-admission-order-tests.py coverage (including mutation guards) verifying that detaching an idle sibling leaves the live owner admissible while closing the owner still cancels further render acquisitions.
Evidence

Hardware A/B on M5 Max (J775c, G17C B1, default cmdline, Borealis Mesa a4153c8fef)

  • Fix head e3c6ba5fa251 (7.3.0-1-50-ARCH, built with #3682 for J775c DT/boot):
    • gpubench-stress-vk --test queue.exhaust × 10 consecutive runs: 10/10 PASS
      • Runs 1–5: 5 devices x 8 queues worked; stop: device 6 refused its first work: VK_ERROR_OUT_OF_DEVICE_MEMORY, 191 iterations, 181 checks, 0 errors (0.22–0.29 s)
      • Runs 6–10: 5 devices x 8 queues worked; stop: device 6 refused its first work: VK_ERROR_OUT_OF_DEVICE_MEMORY, 190 iterations, 181 checks, 0 errors (2.25–2.29 s)
    • Regression checks: 0 failed systemd units, HDMI connected, apple-dcp retired boot scanout on swap 4 (5.726 s), apple-mcc SLC enabled on 32 planes (5.727 s), 0 GPU/DART errors in dmesg.
  • Baseline (7.3.0-1-46.5-ARCH, e6c7b032 + #3686/#3689/#3682, same machine and Mesa a4153c8fef):
    • gpubench-stress-vk --test queue.exhaust × 10 consecutive runs: 0/10 PASS (10/10 FAIL)
      • Every run fails at render q0 d1, submission 6: render 64x64 ...: pixel (0,0) = cdcdcdcd, expected ff44xx33 (154–155 iterations, 144 checks, 1 error).

Offline / Host Tests at e3c6ba5fa251

  • asahi KUnit suite: 513/513 passed (4 skipped)
  • tools/asahi/g17-admission-order-tests.py: PASS (including 2 mutation guards)
  • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks

…bling

Commit f3497c6 ("drm/asahi: fix detached spare ownership and release
publication guard") and commit 4fc8d0f ("drm/asahi: g17: keep an
owner's wide-layout render pair when reclaiming under QID pressure") detach
an idle sibling via State::release_unused_sibling(..., keep_installed=true)
by keeping owners[slot] set and marking `released`, so installed render QIDs
stay reusable and exit-kill ownership stays synchronized.

State::owner_released() checked `(owners[slot] == owner && released)` as a
proxy for a closed owner. Detaching one idle sibling from a still-live owner
under queue or compute QID pressure therefore made owner_released() return
true for that owner, causing try_acquire_render() to skip early publication
and acquire_render() to reject subsequent render submissions with -ECANCELED
even though the owner remained open on its primary pair.

Track detached-from-live-owner slots in a `detached` subset of `released`,
exclude `detached` in State::owner_released(), and clear `detached` whenever
the slot is reacquired, reclaimed unowned, or converted to a real close in
Pool::release_owner() / processor stop.

Add KUnit and host-test coverage (plus a mutation guard) verifying that
detaching an idle sibling leaves the live owner admissible while closing the
owner still cancels further render acquisitions.

Fixes: f3497c6 ("drm/asahi: fix detached spare ownership and release publication guard")
Closes: #3645
Signed-off-by: Satya Benson <[email protected]>
@satchlj
satchlj requested review from a team and DjDeveloperr as code owners December 1, 2026 10:27
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at e3c6ba5f: not ready yet

Check Detail
CI at head no failing: host-tests
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at e3c6ba5f
Conflicts ok none
PR text ok Risk: two-way · M5 Macs (G17). Plain revert restores prior admission tracking; change is confined to G17 queue admission and its host test.

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Note: the Host tests failure in tools/asahi/g17-render-owed-stamp-tests.py (recovery::note_retired, Packet::{note_first_excuse, first_excuse}, Queues::forfeit_blocker) is pre-existing on main and unrelated to this PR. Fix opened in #3783.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state bit distinguishes a reusable detached sibling from a closed owner, and the reuse, release, and reset paths clear it consistently. The new regression test covers admission under pressure and refusal after close. The host failures match the four existing fixture failures. The hardware run includes open PR #3682, so the merge still needs evidence covering this fix independently or the combined candidate once both changes are ready.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at e3c6ba5fa251 (B2 merge train, 12-01 merge bar). Approval at this head: DjDeveloperr. Row: in the PR body at e3c6ba5. CI: train L11 = main 684a4a4 + #3774 #3772 #3305: Apple build pass, KUnit dcp-fabric/dcp-topology/dcp-display/macsmc/asahi pass, host tests apple-dcp/dcp/g17 420 ok; hosted host-tests reds (ave-recovery-old + brcmf-ps-nap) are on main too Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 537d1fd into main Dec 1, 2026
9 of 11 checks passed
@RyanTheTide
RyanTheTide deleted the fix/g17-detached-sibling branch December 1, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drm/asahi: g17: M5 render result never written while queues are exhausted (gpubench-stress queue.exhaust)

3 participants