Repository navigation
drm/asahi: g17: M5: renew a watchdog while later work overtakes it - #3583
Conversation
On M5 a job that has not finished at its watchdog fails then (79c6eb6), so that a hung compute job started just after other clients finished is killed at 2 s instead of 6 s. That also fails work that is only waiting: with clients of mixed global priority, the firmware runs the higher-priority queues' later work ahead of a lower-priority client's oldest command for longer than one poll. gpubench-stress queue.depth (3 clients x 4 queues, low/medium/high priority) lost the low-priority client's device in 11 of 11 runs on the J815, each after "watchdog gave up on a compute command ... at the head of its queue for 2000 ms" while the GPU retired work continuously. Record each command's publication ordinal (the order both engines publish in) and the newest ordinal that retired. On M5, a job counts as sharing the GPU only while work published after it keeps retiring (timeout::overtaken), and is then renewed like a shared job elsewhere, at most SHARED_RENEWALS times (30 s). A hung job that nothing later overtakes still fails at its first expiry. Signed-off-by: Nick <[email protected]>
There was a problem hiding this comment.
Verdict: MERGE at e861dd85 once the fork PR's CI workflows are approved and pass.
Blockers: none in code (await fork CI workflow approval and green checks).
Checked: Full 7-file diff (drivers/gpu/drm/asahi/g17/{job.rs,queue/compute.rs,queue/render.rs,recovery.rs,recovery/safety.rs,runtime/backend.rs,timeout.rs}), shared cross-engine publication ordinal counter (port.rs:920, runtime.rs:2485,2583), replay ordinal refresh, atomic retirement tracking, GaveUp diagnostic formatting, unit tests, and exact-head J815 (T8142 / G17G) stress + CTS verification.
Evidence
- Shared publication ordinal and replay handling:
- Both
render::Pair(host.next_publication()) andcompute::Queue(host.next_compute_publication()->port.next_publication()) draw from the same monotonicself.publicationscounter starting at1, so cross-engine overtaking between render and compute shares a consistent total order. packet.note_ordinal(published)runs on both initial publication and replay, andrecovery::note_retired(front.published)records only error-free retirements.
- Both
- M5 overtaken renewal (
timeout.rs:198-200,job.rs:489-520):overtaken(own, newest, since_newest)requiresown != 0 && newest > own && retiring(since_newest), so a hung M5 job with nothing published after it still fails at its first 2 s expiry, while a lower-priority waiting job overtaken by newer retiring work is renewed up toSHARED_RENEWALS(30 s).- Non-M5 chips keep
renews_shared() == trueand stay on the existing path unchanged. PassingtruetoGaveUp::new()accurately logs M5 sharing renewal counts instead ofno sharing renewals on this GPU. - Unit test
overtaken_needs_later_work_retiring_recentlycovers positive, negative (newest <= own, expiredLIVENESS_NS,None, unpublished0), andSHARED_RENEWALScap cases.
- Verification at
e861dd85(J815M5/G17G):gpubench-stress-vk --test queue.depth6/6pass with0GPU errors (was11/11fail withVK_ERROR_DEVICE_LOST); fullgpubench-stress-vk16 pass, 0 fail, 1 skip;tools/asahi/g17-ray-query-timeout-tests.sh34/34;15,958-case dEQP-VK gate sample matchesmain;0failed units and0new GPU/watchdog kernel lines. Commit carries valid humanSigned-off-by.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Renew an M5 job's watchdog while work published after it keeps retiring. On M5 a job that has not finished at its watchdog fails then (
renews_shared()is false there since 79c6eb6), so a hung compute job is killed at 2 s instead of 6 s. That also fails work that is only waiting: with clients of mixed global priority, the firmware runs the higher-priority queues' later work ahead of a lower-priority client's oldest command for longer than one poll, and that client loses its device while the GPU retires work the whole time. Record each command's publication ordinal and the newest ordinal that retired; on M5 a job counts as sharing the GPU only while work published after it keeps retiring (timeout::overtaken), and is then renewed like a shared job elsewhere, at mostSHARED_RENEWALStimes (30 s). A hung job that nothing later overtakes still fails at its first expiry.Tested: J815 MacBook Air 15" M5 (T8142, G17G),
aurora.kobuilt frommain0701a920154e+ this commit (heade861dd8534f6), Borealisaurora-wip.gpubench-stress-vk --test queue.depth(3 clients × 4 queues, mixed global priorities): 6/6 runs with 0 GPU errors (before: fails every run,VK_ERROR_DEVICE_LOSTafter a 2 s watchdog kill). Fullgpubench-stress-vksuite: 16 pass, 0 fail, 1 skip (ray query), includingcompute.longandlife.fault. Host teststools/asahi/g17-ray-query-timeout-tests.sh: 34/34. dEQP-VK gate sample: same asmain. Light submit rows: same asmain. Regression line: 0 SELinux denials (N/A on this image), 0 failed units, 0 new watchdog or GPU kernel lines from the stress runs.Risk: two-way door · M5 Macs (J815 tested; the rule is per chip generation, not per board); other chips unchanged (
renews_shared()still true there and this path is not taken).Not yet: M5 Pro/Max rows. Fairness is unchanged: the low-priority client still waits up to 3–12 s behind the higher-priority clients in
queue.depth(now it waits instead of failing).Details
g17/job.rs,queue/compute.rs,queue/render.rs: each command keeps the publication ordinal it was published with (the order both engines publish in); a retirement without error reports it torecovery::safety::note_retired(published).recovery/safety.rs: besides the last retirement time, keep the newest retired ordinal and when it last rose (newest_retired()).timeout.rs:overtaken(own, newest, since_newest)is true when the command was published, something published after it retired, and that happened withinLIVENESS_NS. A unit test covers the cases and theSHARED_RENEWALSbound.runtime/backend.rs: on M5 the shared renewal is taken only when the job is overtaken; the comment onrenews_shared()says so. The rest of the watchdog (allowances, excuses, deferrals, attribution) is unchanged.queue.depth3 of 5 runs, because render and compute share the cores, so it was not kept.Evidence
Machine: J815 MacBook Air 15" M5 (T8142, G17G), GPU firmware 26B123, kernel
7.3.0-aurora-j815-dev, Borealis (aurora-wipbased),gpubench-stress-vksuitec36cbbe.queue.depthalonequeue.depth), 1 skipBefore, the kernel log of the failing client:
One of the six runs also logged an unrelated boot-time line from a system service (not from the GPU) while it ran; its GPU checks were all clean.