Skip to content

drm/asahi: g17: track direct publishers across idle_check handoffs - #3415

Merged
RyanTheTide merged 3 commits into
mainfrom
fix/g17-idle-check-direct-submit
Dec 1, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
fix/g17-idle-check-direct-submit

Conversation

@erikwb

@erikwb erikwb commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: Track admitted lockless direct GPU publishers across idle_check() handoffs so paused direct publishers cannot have Effort or Hold cleared underneath them, late admissions are validated before effort_full is closed, and rejected direct attempts cannot leave CLPC demand asserted. The retired-direct-submission case (a submission that retires before idle_check() runs must still arm IDLE_WORK, so effort_full / CLPC host_gpu or the non-M5 Hold is not left stuck) is already fixed on main by #3684 (766fd2aa4699); this PR keeps that behaviour and adds the publisher tracking and admission handling on top of it, alongside #3407's brief-idle BusyShare preservation in drivers/gpu/drm/asahi/g17/port.rs. Follows the idle-recheck leak introduced in 1cdac9ba0ddd (drm/asahi: publish G17 compute into a bound queue without the device mutex).
Tested: At 6d76a4f2f10d (merge of origin/main 19ee1b5bc9d5 into 8c1b6d9d0a02, resolving drivers/gpu/drm/asahi/g17/mod.rs against #3684, drivers/gpu/drm/asahi/g17/port.rs against #3407, and tools/asahi/g17-m5-effort-tests.py for DirectIdle::observe()): python3 -I tools/asahi/run-host-tests.py --only g17 (292/327 passed — all 292 non-render-owed-stamp cases including g17-m5-effort-tests, g17-m5-idle-housekeeping-tests, g17-m5-sibling-gate-tests, and g17-render-return-observe-tests pass; the 35 failures are in g17-render-owed-stamp-tests from a pre-existing origin/main compile break in unrelated files), python3 tools/asahi/clpc-gpu-demand-tests.py (passed), arm64 QEMU KUnit drivers/gpu/drm/asahi/.kunitconfig (521/525 passed, 4 skipped; asahi_g17_idle_hold 18/18 passed), and ./scripts/checkpatch.pl --strict --no-signoff (0 errors, 0 warnings, 0 checks on origin/main..6d76a4f2f10d). Prior pre-merge hardware rows before the 19ee1b5bc9d5 merge: J716c (16-inch M5 Max, T6050, firmware 27.2, AC, default command line, default Stage 2) at 465059fc3976 (prior merge over a171afd2123f, Linux 7.3.0) verified vkcube --c 600 --wsi wayland (Borealis Apple M5 Max (G17C B1)) taking effort_full false -> true within 1 s (direct_submissions 298 -> 2225) and back to false 1 s after exit, staying false (cores_powered=false, host_hold=false, idle_hold_ms=2) for the next 12 s, plus clean smoke (eDP-1 3456x2234@120, Apple MTP input, wlan0 0% loss over 3 pings, AppleJ716 PCMs present without playback, vkcube --c 240 --wsi wayland clean, 1 pre-existing failed unit aurora-peripherals.service, 0 LSM denials, 0 GPU/MMU faults or WARN); earlier J716c rows at 8c1b6d9d0a02 (3545ebecb76f) and 3e5458c00b30 also passed; Neo (J700, G17P, Tested-by: DjDeveloperr) in candidate 936d72d0 (main fe9af4b6 + #3684 + #3407 + #3306 + #3415 at 8c1b6d9d0a02 + #3346, one-shot trial boot 472ed0ed) verified effort_full idle release (~0.3 s), idle_off_delay_ms=50 hold assert/release without sticking, render/compute/concurrent workloads, and deep sleep (rtcwake -m mem -s 30) with 0 faults/errors.
Risk: two-way door · M4 Pro/Max (T6040/T6041), M5 (T6050), and Neo (T8140) Macs (drivers/gpu/drm/asahi/g17/).
Not yet: hosted GitHub CI, team review, and a fresh J716c boot at the new merge head 6d76a4f2f10d (the J716c effort_full row ran at 465059fc3976 and the Neo row ran at 8c1b6d9d0a02 / candidate 936d72d0 before merging 19ee1b5bc9d5); second-family boot/smoke rows and live idle_off_delay_ms > 2 hold verification on M4 Pro/Max (T6040/T6041, G17P/G17C) (external hardware not on site; J713 is T8132/G16G and J313 is T8103/G13G, neither of which binds g17; hold/recheck logic covered by KUnit asahi_g17_idle_hold).

Details

Problem

  1. Stuck-active idle leak on retired direct submissions (fixed on main by drm/asahi: g17: arm idle recheck when a direct submission already retired #3684, 766fd2aa4699; kept here): When a lockless direct submission starts and retires before idle_check() runs, port.submissions() advances (submitted == true) while in_flight is already false. Passing in_flight || submitted into Effort::idle() and idle_hold() caused both to return None instead of arming IDLE_WORK. On T6050 (especially once direct renders land), this left effort_full=true and CLPC host_gpu active (DCS 6 / SOC 2, ~1.1 W extra heatpipe power) stuck indefinitely at desktop idle; on non-M5 Macs with idle_off_delay_ms > 2, it left the GPU core idle hold asserted indefinitely.
  2. Paused-publisher & late-admission races: Simply passing in_flight alone (as in 766fd2aa4699) allows an idle pass to observe the admission counter with an empty queue (or a lent render pair with borrowed_active == false) and expire Effort or Hold before a paused direct publisher exposes its work. Closing effort_full via set_effort_full(false) before validating late admissions also transiently dropped CLPC active demand and cleared the busy-share window, and calling note_gpu_activity() before checking effort_full allowed a rejected direct attempt whose fallback aborted to leave CLPC demand active.
  3. Synchronous render-return wakeup gap: When observe_returned_render() retired the last in-flight render synchronously (FastRenderOutcome::Done) after an earlier event pass had seen the lent pair as active, no idle check was queued.

Design

  • Port (drivers/gpu/drm/asahi/g17/port.rs): Replace note_submission() -> bool with begin_direct_submission() -> Option<DirectSubmissionGuard<'_>>, backed by direct_publishers: AtomicU32 and direct_exits: AtomicU64 (SeqCst). Call note_gpu_activity() only inside the accepted (effort_full == true) branch. On drop, DirectSubmissionGuard bumps direct_exits before decrementing direct_publishers. Expose direct_snapshot() loading (submissions, direct_publishers != 0, direct_exits) in SeqCst order, plus direct_admission_open(), close_direct_admission(), and reopen_direct_admission() without altering CLPC demand. Preserves soc: apple: clpc / drm/asahi: g17: preserve GPU busy share across brief idle gaps #3407's resume_busy_if_inactive(), set_effort_full() brief-idle BusyShare preservation, and clear_effort_and_busy().
  • Direct paths (drivers/gpu/drm/asahi/g17/runtime.rs, drivers/gpu/drm/asahi/g17/runtime/render/direct.rs): Hold DirectSubmissionGuard through compute cell unlock after queue.publish() and through firmware.return_render() under the device mutex. On FastRenderOutcome::Done, queue IDLE_WORK (queue_idle(0)) when !firmware.queues.render_in_flight().
  • Event passes (drivers/gpu/drm/asahi/g17/runtime/events.rs): Take firmware.port.direct_snapshot() before scanning compute and render queues in both the fast path and full path.
  • DirectIdle & idle_check (drivers/gpu/drm/asahi/g17/power.rs, drivers/gpu/drm/asahi/g17/mod.rs): Consume (submissions, exits) into effort.submit() while passing active = in_flight || direct_publishing to Effort::will_clear, Effort::idle, and idle_hold, and keep a bounded IDLE_HOLD_NS recheck armed whenever direct_publishing is true. Both IdleAction::Clear and HoldAction::Release (including when lowered to 2 ms) close direct admission before validating against pre-scan submissions and direct_publishing(), preserve the prior admission state (was_open) on deferral, and commit CLPC demand teardown only inside apply_effort(0) after validation succeeds.
  • Merge with origin/main (6d76a4f2f10d): Resolves drivers/gpu/drm/asahi/g17/mod.rs against drm/asahi: g17: arm idle recheck when a direct submission already retired #3684 (766fd2aa4699) by keeping DirectIdle::observe() and active (in_flight || direct_publishing) passed into Effort::idle() and idle_hold(), resolves drivers/gpu/drm/asahi/g17/port.rs against soc: apple: clpc / drm/asahi: g17: preserve GPU busy share across brief idle gaps #3407 (43715890e29f) by preserving both the direct-publisher tracking/admission helpers and resume_busy_if_inactive() / set_effort_full() / clear_effort_and_busy(), and updates tools/asahi/g17-m5-effort-tests.py to extract DirectIdle and exercise both retired and in-flight direct submissions (including --mutation idle-counts-submitted).
  • Host tests (tools/asahi/): Update the structural assertions and mutation patterns in g17-m5-effort-tests.py, g17-m5-idle-housekeeping-tests.py, g17-m5-sibling-gate-tests.py, and g17-render-return-observe-tests.py for DirectIdle::observe(), the added direct snapshot argument in Firmware::idle_check(), and the FastRenderOutcome::Done idle wakeup in render_direct().
Evidence
  • Head commit: 6d76a4f2f10d6197208e836a1fee9b3e3c91c025 (merge of origin/main 19ee1b5bc9d533b7edc2629e55e9a99f54c0984b into 8c1b6d9d0a02b949a5c581ce57bdbc76d49a0567; feature commits 3e5458c00b30 and 8c1b6d9d0a02).
  • ./scripts/checkpatch.pl --strict --no-signoff: 0 errors, 0 warnings, 0 checks on origin/main..6d76a4f2f10d (607 lines).
  • Host tests (6d76a4f2f10d):
    • python3 -I tools/asahi/run-host-tests.py --only g17: 292/327 passed (g17-m5-effort-tests, g17-m5-idle-housekeeping-tests, g17-m5-sibling-gate-tests, and g17-render-return-observe-tests with all mutations passed; 35 failures in g17-render-owed-stamp-tests are a pre-existing origin/main compile error in queue/render/observation.rs/completion.rs unrelated to this PR).
    • python3 tools/asahi/clpc-gpu-demand-tests.py: passed.
  • KUnit (./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig at 6d76a4f2f10d): Ran 525 tests: passed: 521, skipped: 4 (apple_g17_rx_util_min_test needing CONFIG_UCLAMP_TASK plus j713_accepts_all_loaded_images, j773g_accepts_its_loaded_image, and t8132_25g83_b000_zeroes_what_iboot_fills; asahi_g17_idle_hold 18/18 passed including direct_idle_arms_recheck_for_retired_submission_and_guards_paused_publisher and paced_low_fps_preserves_window_across_effort_clears).
  • Pre-merge hardware verification (before 19ee1b5bc9d5 merge):
    • J716c (16-inch M5 Max, T6050, firmware 27.2, AC, default command line, default Stage 2) at 465059fc3976 (prior merge over a171afd2123f, Linux 7.3.0): vkcube --c 600 --wsi wayland (Borealis Apple M5 Max (G17C B1)) took effort_full false -> true within 1 s (direct_submissions 298 -> 2225) and back to false 1 s after exit, staying false (cores_powered=false, host_hold=false, idle_hold_ms=2) for 12 s; 5-item smoke clean (eDP-1 3456x2234@120, MTP input, wlan0 0% loss, AppleJ716 PCMs enumerated, 1 pre-existing failed unit aurora-peripherals.service, 0 LSM denials, 0 GPU/MMU faults).
    • Neo (J700, G17P, Tested-by: DjDeveloperr) at combined candidate 936d72d0 (main fe9af4b6 + #3684 + #3407 + #3306 + #3415 at 8c1b6d9d0a02 + #3346, one-shot trial boot 472ed0ed, default command line): gpubench 4-queue render (per-queue CRC ok), 2-queue compute, concurrent render + compute, vkcube --c 300; effort_full true during work (48/49 samples) and cleared within ~0.3 s of idle; host hold stayed off at idle_off_delay_ms=2 and asserted during work (18 samples) then released cleanly at idle_off_delay_ms=50; deep sleep (rtcwake -m mem -s 30) + post-sleep render readback valid; 0 GPU faults/timeouts/WARN/AVC/failed units.
    • J716c (16-inch M5 Max, T6050, firmware 27.2, AC, default command line) in batched trial kernel 3545ebecb76f at 8c1b6d9d0a02: vkcube --c 600 --wsi wayland (default Mesa): /sys/kernel/debug/aurora-g17/power samples showed effort_full=false at idle, true while the cube ran, and false again 10 s after exit (cores_powered=false, host_hold=false, idle_hold_ms=2; direct_submissions=2 unchanged). Prior standalone 3e5458c00b30 60-frame row also passed (effort_full true -> false cleanly 250 ms after exit).

When a lockless direct submission starts and retires before idle_check()
runs, port.submissions() advances while in_flight is already false.
Passing (in_flight || submitted) into Effort::idle() and idle_hold()
caused both to return None instead of arming their recheck timers:

- Effort::idle(now_ns, true) cleared idle_since and left IDLE_WORK
  unarmed, keeping effort_full, Region C full effort, and CLPC host_gpu
  active stuck true indefinitely until the next submission (costing
  ~1.1 W at desktop idle on T6050 once direct renders are active).
- Hold::step(now_ns, true, ...) returned HoldAction::None when a hold
  was active (or right after asserting it), leaving the GPU core idle
  hold asserted indefinitely on non-M5 Macs with idle_off_delay_ms > 2.

Simply passing in_flight alone is not enough when a direct publisher
pauses between port admission and publication/pair return: an idle pass
can observe the admission counter with an empty queue (or a lent render
pair with borrowed_active == false) and expire Effort or Hold before the
paused publisher exposes its work.

Track admitted lockless direct publishers with a DirectSubmissionGuard
(direct_publishers + direct_exits on Port), sample direct_publishing
before queue scans, and route the idle check through power::DirectIdle:

- Already-retired direct submissions still clear idle_since via
  effort.submit() while passing active = false so Effort and Hold arm
  their recheck timers.
- In-flight direct publishers keep active = true and arm a bounded
  IDLE_WORK recheck, and bump direct_exits on guard drop so
  post-retirement idle windows restart cleanly.
- Close lockless direct admission (effort_full = false) without touching
  CLPC demand or the busy-share window before validating Effort clear
  and Hold release, keeping admission closed through set_idle_control()
  and committing CLPC demand teardown only inside apply_effort(0) once
  validation succeeds.
- When observe_returned_render() retires the last render synchronously
  (FastRenderOutcome::Done), wake IDLE_WORK if no renders remain in
  flight.

Add KUnit coverage in asahi_g17_idle_hold exercising DirectIdle, Effort,
and Hold across retired direct submissions, paused direct publishers,
and guard-exit handoffs.

Fixes: 1cdac9b ("drm/asahi: publish G17 compute into a bound queue without the device mutex")
Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team and DjDeveloperr as code owners November 27, 2026 17:27
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo 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) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at 6d76a4f2: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 6d76a4f2
Conflicts ok none
PR text ok Risk: two-way · M4 Pro/Max (T6040/T6041), M5 (T6050), and Neo (T8140) Macs (drivers/gpu/drm/asahi/g17/).

Areas: area:gpu

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

…snapshot

Update the structural assertions and mutation patterns in the g17 host
tests to match the added direct snapshot parameter in
Firmware::idle_check() and the synchronous IDLE_WORK wakeup on
FastRenderOutcome::Done in render_direct().

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Fixed all three host-tests structural check failures in 8c1b6d9d0a02.

3e5458c00b30 added the direct: port::DirectSnapshot argument to Firmware::idle_check(now, in_flight, direct) and added the if !firmware.queues.render_in_flight() { self.shared.queue_idle(0); } wakeup in the FastRenderOutcome::Done arm of render_direct(), which broke source-substring structural assertions in three tools/asahi/ scripts:

  • tools/asahi/g17-m5-idle-housekeeping-tests.py: updated fast_idle_ok and the hardcode-in-flight-true mutation pattern from firmware.idle_check(now, in_flight)? / firmware.idle_check(now, true)? to include the direct parameter.
  • tools/asahi/g17-m5-sibling-gate-tests.py: updated the idle housekeeping sees sibling work ordered check from firmware.idle_check(now, in_flight)? to firmware.idle_check(now, in_flight, direct)?.
  • tools/asahi/g17-render-return-observe-tests.py: updated the render_direct observes in the returning hold, signals after it ordered check from FastRenderOutcome::Done | FastRenderOutcome::Idle => {} to match the new FastRenderOutcome::Done idle-check wakeup and FastRenderOutcome::Idle => {}.

Commit 8c1b6d9d0a02 touches only those three tools/asahi/ host test scripts and leaves all kernel and driver files byte-for-byte unchanged from 3e5458c00b30.

Verified at 8c1b6d9d0a02:

  • python3 -I tools/asahi/run-host-tests.py --only g17 --jobs 32: 238/238 passed (including all mutations for g17-m5-idle-housekeeping-tests, g17-m5-sibling-gate-tests, and g17-render-return-observe-tests)
  • ./scripts/checkpatch.pl --strict --git 94ea195b6eb5..8c1b6d9d0a02: 0 errors, 0 warnings, 0 checks

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 8c1b6d9d

Blockers: none in code (note: queued KUnit CI jobs must finish green before merge; a second-family smoke row such as G17P/M4 Pro or Neo is recommended for blast:m4,m5,neo).

Checked: no Apple material, no AI attribution, no new chip/board/firmware gates, no cmdline hacks, human Signed-off-by, SeqCst ordering across begin_direct_submission() / DirectSubmissionGuard::drop() / direct_snapshot(), close_direct_admission()/reopen_direct_admission() validation before CLPC demand clear or set_idle_control(true), DirectIdle::observe() recheck arming on retired direct submissions, direct.take() + FastRenderOutcome::Done queue_idle(0) in direct.rs, 238/238 g17 host tests + 491 KUnit asahi tests, J716c M5 Max hardware row PASS, apple-build/host-tests/pr-text green.

Evidence
  • Inspected all 6 driver files (mod.rs, port.rs, power.rs, runtime.rs, runtime/events.rs, runtime/render/direct.rs).
  • Verified concurrency handoff:
    • begin_direct_submission() increments direct_publishers then submissions (SeqCst) before loading effort_full; if false, decrements direct_publishers without asserting note_gpu_activity().
    • DirectSubmissionGuard::drop() bumps direct_exits before decrementing direct_publishers (SeqCst).
    • direct_snapshot() reads submissions, direct_publishers, direct_exits (SeqCst) before scanning queues, ensuring every admitted publisher is seen in submissions, publishing, or the queue scan.
    • Both Effort::Clear and HoldAction::Release close direct admission (effort_full = false) without dropping CLPC demand, recheck submissions and direct_publishing, and reopen admission if a publisher slipped in.
    • DirectIdle::observe() records effort.submit() on submissions/exits progress while returning in_flight || direct_publishing, preventing unarmed IDLE_WORK after already-retired direct submissions.
  • Hardware row (J716c M5 Max, default cmdline, 3e5458c0 driver code unchanged in 8c1b6d9d): 60-frame Borealis/Wayland vkcube, effort_full/cores_powered/host_hold all clear cleanly after retirement; 0 new kernel errors.
  • CI at 8c1b6d9d: apple-build, host-tests, pr-text, KUnit ane-boot/ane-pm/dcp-fabric/dcp-topology PASS; remaining KUnit jobs queued.

@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

All 21 CI checks at 8c1b6d9d0a02 are now green (apple-build, host-tests, pr-text, readiness, and all 16 KUnit suites including KUnit asahi; the two earlier cancelled runs were superseded), and this PR is approved at 8c1b6d9d0a02.

Verified at 8c1b6d9d0a02 (clean git merge-tree against origin/main ee36fbdcd1c8, with kernel/driver files byte-for-byte unchanged from 3e5458c00b30 and no structural clashes against the newer g17 host tests on main):

  • python3 -I tools/asahi/run-host-tests.py --only g17 --jobs 32: 238/238 passed (including g17-m5-idle-housekeeping-tests, g17-m5-sibling-gate-tests, and g17-render-return-observe-tests with all mutations).
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig (at 3e5458c00b30, driver code byte-identical in 8c1b6d9d0a02, and KUnit asahi green in 21/21 hosted CI at 8c1b6d9d0a02): 491 passed, 4 skipped (apple_g17_rx_util_min_test needing CONFIG_UCLAMP_TASK and 3 asahi_fwid cases; asahi_g17_idle_hold 17/17 passed).
  • ./scripts/checkpatch.pl --strict --git 94ea195b6eb5..8c1b6d9d0a02: 0 errors, 0 warnings, 0 checks.

Updated the PR body with **Revert:**, explicit untested-family notes (external T6040/T6041 and T8140 hardware not in the local lab; J713 is T8132/G16G and J313 is T8103/G13G), the prior 60-frame 3e5458c00b30 J716c row, and the 8c1b6d9d0a02 J716c (T6050) batched trial row:

  • J716c at 8c1b6d9d0a02 in batched trial kernel 3545ebecb76f (kernel SHA-256 d56efde4c7232208bd29d5c4e5890319e0050595dd4f4b1c3844df6656a08312, Stage 2 SHA-256 b7d99286395ddd7dadccc6d9593f4bd55391d9e787af97c18b45f58688d9885d): vkcube --c 600 --wsi wayland (default Mesa) samples show /sys/kernel/debug/aurora-g17/power effort_full=false at idle, true while the cube runs, and false again 10 s after it ends (cores_powered=false, host_hold=false, idle_hold_ms=2); direct_submissions=2 stayed unchanged throughout, so this run demonstrates workload and idle smoke while direct-publisher race coverage comes from the automated host and KUnit tests. Batch observation (cause unassigned): the batched boot logged one deprecated-workqueue warning for an asahi_core::g17 work item ([ 6.526422] workqueue: work func _RNvXsd_NtCs5lxGbhOOw2k_6kernel9workqueueINtNtNtB7_4sync3arc3ArcNtNtCs1Hk8bfrjdzS_10asahi_core3g176SharedEINtB5_15WorkItemPointerKy6_E3runB13_ enqueued on deprecated workqueue.). Initial boot smoke snapshot clean (1 failed system unit aurora-peripherals.service, same as baseline warm reboots; later checks recorded additional messages).

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026
DjDeveloperr added a commit that referenced this pull request Nov 30, 2026
Resolved idle_check() to #3415's form (its `active` covers #3684's
retired-submission case) and kept #3407's resume_busy_if_inactive()
beside #3415's direct-admission helpers in port.rs.

Signed-off-by: DjDeveloperr <[email protected]>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (Neo, G17P) row at combined SHA 936d72d0 (wip/ewb-g17-rows-20261130 = main fe9af4b6 + #3684 + #3407 + #3306 + #3415 + #3346)

Kernel: one-shot trial boot 472ed0ed with the dead-man timer and the default command line. Stock Fedora -41 was restored and verified afterwards.

  • Built warm from an existing J700 tree; the source tree was verified to equal 936d72d0 (tree 9da3305d).
  • Image sha256 27185481, aurora.ko sha256 625c14e8, vmlinux build ID a7620fb3.

Results

  • GPU use on the KDE desktop: gpubench 4-queue render (per-queue CRC ok), 2-queue compute, concurrent render + compute, vkcube --c 300 on Wayland. All completed.
  • GPU effort after work: effort_full was true during work (48/49 samples) and cleared within about 0.3 s of idle.
  • Host hold at the default idle_off_delay_ms=2: stayed off.
  • Host hold at idle_off_delay_ms=50: on during work (18 samples), released as soon as the work ended, and stayed off through 5 s of idle.
  • Wi-Fi (wld0) connected and Bluetooth (hci0) powered, before and after the sleep.
  • One test sleep (rtcwake -m mem -s 30, deep): suspended and resumed on the same boot. Afterwards Wi-Fi was up and a GPU render readback was valid. During suspend entry the log had one line, dwc3-apple 40a280000.usb: PM: device_prepare(): genpd_prepare returns -11; the suspend still completed.
  • 0 GPU faults, timeouts or submission errors; 0 WARN, 0 AVC; 0 failed units (stock: 0).
  • Kernel error lines: 11, against 12 on a stock boot, with no new kinds. SMC 0 and PCIe 0, before and after the sleep.

This PR: non-M5 G17 hold path. With idle_off_delay_ms 50 the hold asserted after work and released after idle; it never stayed stuck.

Resolve idle_check() in drivers/gpu/drm/asahi/g17/mod.rs against #3684 by keeping DirectIdle::observe() and passing active (in_flight || direct_publishing) into Effort::idle() and idle_hold(), resolve drivers/gpu/drm/asahi/g17/port.rs against #3407 by preserving both the direct-publisher tracking/admission helpers and brief-idle busy-share tracking (resume_busy_if_inactive(), set_effort_full(), clear_effort_and_busy()), and update tools/asahi/g17-m5-effort-tests.py to cover DirectIdle::observe().

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged live origin/main (19ee1b5bc9d5) into fix/g17-idle-check-direct-submit at 6d76a4f2f10d, resolving drivers/gpu/drm/asahi/g17/mod.rs against #3684 (766fd2aa4699, keeping DirectIdle::observe() and active passed into Effort::idle() and idle_hold()), resolving drivers/gpu/drm/asahi/g17/port.rs against #3407 (43715890e29f, preserving both direct-publisher tracking/admission helpers and BusyShare brief-idle tracking in resume_busy_if_inactive(), set_effort_full(), and clear_effort_and_busy()), and updating tools/asahi/g17-m5-effort-tests.py to cover DirectIdle::observe() and its idle-counts-submitted mutation.

Verified at 6d76a4f2f10d:

  • python3 -I tools/asahi/run-host-tests.py --only g17: 292/327 passed (g17-m5-effort-tests with m5-ignores-bound and idle-counts-submitted, g17-m5-idle-housekeeping-tests, g17-m5-sibling-gate-tests, g17-render-return-observe-tests, and all 292 pre-existing g17 cases passed; the 35 failures are in g17-render-owed-stamp-tests from a pre-existing origin/main compile break unrelated to this PR).
  • python3 tools/asahi/clpc-gpu-demand-tests.py: passed.
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig: 521 passed, 4 skipped (apple_g17_rx_util_min_test needing CONFIG_UCLAMP_TASK and 3 asahi_fwid cases; asahi_g17_idle_hold 18/18 passed).
  • ./scripts/checkpatch.pl --strict --no-signoff: 0 errors, 0 warnings, 0 checks on origin/main..6d76a4f2f10d.

Updated the PR body to record the new merge head 6d76a4f2f10d, preserve @DjDeveloperr's Neo (J700, G17P) row at 936d72d0 and the J716c effort_full row at 465059fc3976, and scope **Not yet:** to CI, review, and a fresh J716c check at 6d76a4f2f10d.

@github-actions github-actions Bot removed the merge-conflict Conflicts with the base branch (bot) label Dec 1, 2026
@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

@RyanTheTide RyanTheTide 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 merge preserves the pre-scan publisher snapshot and recheck while retaining main’s queue in-flight and BusyShare accounting. Effort clear and hold release both use the combined active state. The focused host tests and Asahi KUnit passed. The reported owed-stamp compile failure is on the merge base.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 6d76a4f2f10d (B2 merge train, 12-01 merge bar). Approval at this head: RyanTheTide. Row: in the PR body at 8c1b6d9 (same PR files; this head is erikwb's merge of main, reviewed at this head). CI: linux train L9 = main + #3415: Apple driver compile pass, KUnit asahi pass; g17 host tests: the 39 that fail (g17-output-fence, g17-render-owed-stamp) fail identically on main 7126dae, not from this PR. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit ddaa29c into main Dec 1, 2026
6 of 12 checks passed
@RyanTheTide
RyanTheTide deleted the fix/g17-idle-check-direct-submit branch December 1, 2026 13:03
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:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo 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) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants