Repository navigation
drm/asahi: g17: arm idle recheck when a direct submission already retired - #3684
Conversation
…ired When a direct submission starts and finishes 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() made both return None instead of Recheck(IDLE_HOLD_NS), so IDLE_WORK was not armed, and effort_full and CLPC host_gpu active could stay asserted until another event triggered a check. effort.submit() has already cleared idle_since when submitted is true, and Hold::step() already checks submissions independently; pass in_flight so idle_check() arms the 16 ms recheck timer whenever no work remains in flight. Signed-off-by: Erik Bourget <[email protected]>
… submission Evaluate the work-in-flight arguments idle_check() passes to Effort::idle() and idle_hold() from its source. For a direct submission that was submitted and already retired before the check, the effort must arm its idle recheck and later clear, and the hold must see no work in flight; with work still in flight, both must keep it. The idle-counts-submitted mutation puts back the old `in_flight || submitted` and must fail. Signed-off-by: Erik Bourget <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: HOLD at 591d5feb
Blockers:
- Hosted CI on
591d5febis still queued (apple-build,host-tests, and 16 KUnit suites;pr-textandreadinessalready passed). - Non-M5 G17 hardware verification row for the
idle_hold()path (which returns early on M5 viaself.init.is_m5()), as noted under "Not yet".
Checked:
drivers/gpu/drm/asahi/g17/mod.rs(idle_check()) +drivers/gpu/drm/asahi/g17/power.rs(Effort::idle()andHold::step()):- When a direct submission starts and retires before
idle_check()runs (submitted == true,in_flight == false),self.effort.submit()already clearsidle_sinceand incrementsself.effort.submissions(). Passingin_flightinstead ofin_flight || submittedletsEffort::idle()armIdleAction::Recheck(IDLE_HOLD_NS)instead of returningNoneand leavingeffort_full/ CLPChost_gpuasserted indefinitely. - On non-M5 G17,
Hold::step()tracksfresh = submissions != self.seenindependently: iteration 0 still asserts the hold when!self.active && fresh, and passingin_flight == falselets iteration 1 (or an already-active hold) armHoldAction::Recheck(hold_ns)instead of stranding the hold active. - Active in-flight work (
in_flight == true) and submissions racingIdleAction::Clear(self.port.submissions() != submissions) remain unchanged.
- When a direct submission starts and retires before
tools/asahi/g17-m5-effort-tests.pyandtools/asahi/run-host-tests.py: extract bothidle_check()argument expressions from source, verify retired-submission recheck/clear and in-flight retention, and wire theidle-counts-submittedmutation.- Both commits carry human
Signed-off-by:trailers, clean PR metadata, and exact-head J716c (M5 Max) A/B verification showinghost_gpu: activedropping from 131/200 + 200/200 stuck samples to 0/200 + 0/200.
Evidence
- Diff audited: 3 files (
+51/-4), commits766fd2aaand591d5feb. - Verified
Effort::idle()(drivers/gpu/drm/asahi/g17/power.rs:179-201) andHold::step()(power.rs:350-381) state transitions for bothsubmitted && !in_flightandin_flight. - Status checks at review time: 2 passed (
pr-text / pr-text,readiness / readiness), 18 queued (apple-build,host-tests, 16 KUnit suites), 3 skipped.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approved. Passing only the work in flight lets Effort::idle() and idle_hold() arm their recheck when a direct submission retired before the check ran; effort.submit() still restarts the hold for the new submission. The J716c A/B matches: host_gpu stuck at 131/200 and 200/200 before, 0/200 after. The G17P row is in too: a Neo (J700) boot of a candidate carrying this head unchanged. Effort cleared within ~0.3 s of idle, and with idle_off_delay_ms=50 the host hold asserted under work and released right after it, with 0 GPU faults, timeouts or submission errors.
|
J700 (Neo, G17P) row at combined SHA Kernel: one-shot trial boot
Results
This PR: the idle recheck now runs after a retired direct submission. Effort cleared after every workload in this run. |
There was a problem hiding this comment.
Verdict: MERGE at 591d5febf96d
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - drivers/gpu/drm/asahi/g17/mod.rs (idle_check()) + drivers/gpu/drm/asahi/g17/power.rs (Effort::idle() and Hold::step()):
- When a direct submission starts and retires before
idle_check()runs (submitted == true,in_flight == false),self.effort.submit()already clearsidle_sinceand incrementsself.effort.submissions(). Passingin_flightinstead ofin_flight || submittedletsEffort::idle()armIdleAction::Recheck(IDLE_HOLD_NS)instead of returningNoneand leavingeffort_full/ CLPChost_gpuasserted indefinitely. - On non-M5 G17,
Hold::step()tracksfresh = submissions != self.seenindependently: iteration 0 still asserts the hold when!self.active && fresh, and passingin_flight == falselets iteration 1 (or an already-active hold) armHoldAction::Recheck(hold_ns)instead of stranding the hold active. - Active in-flight work (
in_flight == true) and submissions racingIdleAction::Clear(self.port.submissions() != submissions) remain unchanged. tools/asahi/g17-m5-effort-tests.pyandtools/asahi/run-host-tests.py: extract bothidle_check()argument expressions from source, verify retired-submission recheck/clear and in-flight retention, and wire theidle-counts-submittedmutation.- Both commits carry human
Signed-off-by:trailers, clean PR metadata, and exact-head J716c (M5 Max) A/B verification showinghost_gpu: activedropping from 131/200 + 200/200 stuck samples to 0/200 + 0/200.
Follow-ups (not blocking): queued CI; non-M5 G17 idle_hold row
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]>
What: When a direct submission is submitted and already retired by the time
idle_check()runs,idle_check()passedin_flight || submitted(true) toEffort::idle()andidle_hold(), so neither armed its idle recheck. The GPU effort (effort_full) and CLPC's host-GPU vote could then stay asserted until some other event triggered a check. This passes the actual work in flight, so the 16 ms recheck is armed whenever nothing is in flight.Tested: J716c M5 Max at
591d5febf96d(on main45d7f828e08awith #3662, which main needs to boot this board), desktop idle: CLPChost_gpu: activereads 0 in 200/200 samples (50 ms apart) in two 10 s windows. On the same base without this PR it read 1 in 131/200 and then 200/200 samples with no CLPC requests, stuck about 16 s. g17 host tests 292/292 (the new check fails on the old code and on theidle-counts-submittedmutation); this change has also run in the J716c daily since 2026-11-27.Risk: two-way door · every G17 Mac (the idle-check path is shared; on M5 only the effort side runs, since M5 takes no host hold)
Not yet: non-M5 G17 hardware row (the host hold path)
Details
idle_check()notes a new submission (submitted) by comparingport.submissions()with the last value it saw, and callseffort.submit()for it, which already restarts the continuous-idle interval (idle_since). Passingin_flight || submittedtoEffort::idle()then made a submission that had already retired look like work in flight, soEffort::idle()returnedNoneinstead ofRecheck(IDLE_HOLD_NS). Nothing armed IDLE_WORK, and the effort stayed full until the next event that ran a check.idle_hold()had the same argument.Hold::step()checks submissions itself, and M5 returns early from it.With
in_flight: a fresh submission still restarts the 16 ms hold (througheffort.submit()), bursts of submissions keep restarting it, and theClearbranch still re-checksport.submissions()for a submission racing the clear.will_clear(now, in_flight || submitted)above it is unchanged; after a fresh submission it answers the same with either argument.The host test (
tools/asahi/g17-m5-effort-tests.py) evaluates the two argument expressions taken fromidle_check()'s source against the extractedEffort: a submission that already retired must arm the recheck and later clear, and the hold must see no work in flight; work still in flight must keep both. Theidle-counts-submittedmutation puts backin_flight || submittedand fails.Evidence
J716c (T6050), kernels 7.3.0-ewb415+ (
591d5febf96d+ #3662) and 7.3.0-ewb413+ (main45d7f828e08a+ #3662, without this PR), same boot loader (aura main with #585), default command line pluswatchdog.open_timeout=120, desktop idle on the internal panel,host_gpu: activeread from the CLPC debugfsstatusevery 50 ms:After one tiny compute job, both kernels clear within one 50 ms sample in most runs; the stuck state needs the retired-before-check timing, which the desktop's own submissions hit.
python3 tools/asahi/run-host-tests.py --only g17: 292/292 passed.