Repository navigation
drm/asahi: g18: async submit follow-ups (comment, rate limit, device cap, teardown) - #2850
Conversation
asahi_g18_fence_error() walks a dma_fence_chain with dma_fence_chain_walk(), which unlinks the earlier points that have signalled. A job's inputs have all signalled when it runs, so of a timeline only the head point's own fence is checked, and an error on an earlier point is not seen. The comment said every fence was checked. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
21d1574 to
6252dbc
Compare
|
Review at 6252dbc. Thanks, this addresses the #2679 points cleanly. The teardown ordering looks right to me: the worker holds only
The comment change in |
6252dbc to
0990461
Compare
|
Re-review at 0990461. Points from the review at 6252dbc:
Moving Still open:
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist review (§1–§6) at 09904614535b1f464900fe6b9d7262db6145d04e (REQUEST_CHANGES).
Checklist Summary
- §1 (No model gating): Pass — scoped to
drivers/gpu/drm/asahi/g18/; other GPU generations are untouched. - §2 (Production-ready / default cmdline): Pass — works on default cmdline; respects existing
VerboseFaultsdebug flag for failure log throttling, matchinggpu.rs. - §3 (Safety & concurrency): Pass with non-blocking lockdep/reclaim observation below —
OwnedQueue::new_unbound_reclaim()(WQ_MEM_RECLAIM) fixes the reclaim rescuer requirement fromrust/kernel/workqueue.rs:416-418; hard cap viaRoom/reservedis sound (declaringlet _room = room;beforelet mut state = self.state.lock();guaranteesstatedrops beforeRoom::droplocksstate);G18DrmGpu::dropdrainsworkersoutsideself.state.lock()whileG18Jobholds no reference back toG18DrmGpu; movingwait_room()afterwait_foreign_inputs()avoids pinning a device slot while waiting on foreign fences. - §4 (Clean-room & attribution): Pass — both commits (
cdd27c5b135e,09904614535b) carry human author/committer and humanSigned-off-by:only; PR body includesAssisted-by:. - §5 (Evidence): Blocked — see Blockers below.
- §6 (Naming): Pass — uses
aurora_g18_jobsfor the new workqueue and only touches existingdrivers/gpu/drm/asahi/g18/paths.
Blockers
- §5 (Evidence) — No J873 hardware run (or compile check) on
09904614535b:- The M6 (J873g) A/B table in the PR body was run on a different out-of-tree branch predating
asahi_g18_fence_error()and prior to the09904614535bchanges (Room/reservedhard cap,new_unbound_reclaim,VerboseFaultsbypass, and movingwait_room()afterwait_foreign_inputs()). - Note also that CI on this PR only runs
host-tests, which does not compiledrivers/gpu/drm/asahi/. - Please build and run
g18burst(both burst cases, including concurrent submitters to exercise the hard cap, plus the flood test),synctest, and a short regression check (0 SELinux denials, 0 failed units, 0 new kernel errors — ideally withCONFIG_PROVE_LOCKING) on J873 at09904614535b(or the updated head).
- The M6 (J873g) A/B table in the PR body was run on a different out-of-tree branch predating
- Stale PR body: The PR body still states "The cap is soft: submits that wait together can each still add one job" and does not reflect the
09904614535bhard cap (Room),WQ_MEM_RECLAIM,VerboseFaults, orwait_room()placement afterwait_foreign_inputs(). Please update it to match the commit.
Non-blocking Technical Notes
- Reclaim allocation under
self.state.lock()(g18/drm.rs:523-536):JobQueue::push()performsstate.pending.reserve(1, GFP_KERNEL)andworkers.try_spawn(GFP_KERNEL, ...)while holdingself.state.lock(), which is also acquired on thedma_fencesignalling path (drain()pops jobs whoseJobFenceis already published, andfailure_report()takesself.state.lock()beforeJobFence::dropsignals). This was pre-existing from#2679, but withWQ_MEM_RECLAIMnow set it is worth eliminatingGFP_KERNELallocations underself.state.lock()(e.g., pre-allocatingpendingtoDEVICE_DEPTHinJobQueue::new()or reserving outside the lock) and verifying underCONFIG_PROVE_LOCKING. - Double lock & spurious
notify_all()onpush()success (g18/drm.rs:519-541): Letting_roomdrop afterstateunlocks acquiresself.state.lock()a second time and broadcastsretired.notify_all()on every accepted submit (and briefly double-counts the job inpending.len() + reserved). Consuming the slot under the heldstatelock (state.reserved -= 1; core::mem::forget(room);) on the success path avoids both.
Assisted-by: LLM (Gemini 4 Neon)
|
Thanks. 0990461 (amended) covers 1-4:
The build is clean (no new warnings), and checkpatch
Assisted-by: LLM (Claude:Opus 5.5) |
Three follow-ups to the asynchronous submit path (aurora-silicon#2679): - A failed job is reported at most once a second, with the number of failures not reported in between, unless VerboseFaults is set, as for GPU faults. A client that submits failing jobs in a loop could otherwise flood the log; the output fence and the queue's next submit still carry every error. - The device holds at most 256 jobs waiting to run, over all queues and files. Each queue was bounded at 32, but a file can open any number of queues. A submit takes one of the 256 slots after it has waited for other drivers' fences and before it publishes anything, so a signal restarts the ioctl as the existing waits do. The slot becomes the job, or is given back if the submit fails. The bound is device-wide on purpose: one worker runs the jobs in the order they were accepted, so a client blocked by a full device would only have waited on its fence instead. - Jobs run on the device's own unbound workqueue instead of system_unbound, with WQ_MEM_RECLAIM, since memory reclaim can wait for the fences its jobs signal. The worker is a work item that is part of the job queue, and the queue of waiting jobs is allocated for 256 up front, so nothing is allocated under the state lock, which the worker takes while fences are pending. When G18DrmGpu is dropped, the queue is taken out of the job state and destroyed, which waits for the worker to return, so no job work item outlives the device. A submit after that is refused with -ENODEV. On the J873 this happens only on the probe error path today: once the firmware session starts, the module is pinned until reboot and the platform driver has no bind attributes. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
0990461 to
676064c
Compare
|
Re-review at 676064c. Commit 1 is unchanged; commit 2 changes only The embedded worker looks right to me:
The PR body is current now. One thing for later, not for this PR: the job path itself still allocates with GFP_KERNEL while its fence is published, e.g. the alias reserve/push in Still open: the J873 row at this head (both bursts, one with concurrent submitter threads for the hard cap, the flood, synctest, a short sway/GL session, with CONFIG_PROVE_LOCKING). Assisted-by: LLM (Claude:Opus 5.5) |
|
J873 row at 676064c (0990461 + Dj's two notes, see below). Kernel
Why 255 and not 256: the cap is device-wide, so one slot was held by another waiting job, sway's or the test's own GL context. The 600-job case got all 256. With the soft cap, 32 racing threads could have pushed past it (up to 256 + 31); here none did. Counts: 0 AVC denials (no SELinux on this install), 0 failed units. 7 kernel error lines; these 5 are not on the default boot:
Also in 676064c, from @DjDeveloperr's non-blocking notes:
The PR description now matches the commit (hard cap, WQ_MEM_RECLAIM, VerboseFaults, room after the foreign waits). The M6 is back on its default kernel. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist re-review (§1–§6) at 676064c49b98365cac91ac0662c9524d8d3b63f8 (REQUEST_CHANGES).
What Changed Since 09904614
All code and PR-body items from the previous reviews are now cleanly addressed:
- Reclaim-safe
JobQueue::push()(g18/drm.rs:483-557): Embeddingwork: workqueue::Work<JobQueue>(impl_has_work!/WorkItem for JobQueue) and pre-allocatingpendingviaKVec::with_capacity(DEVICE_DEPTH, GFP_KERNEL)inJobQueue::new()eliminates allGFP_KERNELallocations underself.state.lock(). - Single-lock slot handoff (
g18/drm.rs:554, 626-644):Room::consume(&mut state)transfers the reservation intopendingunder the held lock, removing the extra lock acquisition, brief double-count, and spuriousnotify_all()on the success path while preserving safe drop order (statedrops before parameterroom) on error paths. - PR body & build hygiene: PR description now matches the code (
DEVICE_DEPTH = 256hard cap,WQ_MEM_RECLAIM,VerboseFaults,wait_room()placement afterwait_foreign_inputs(), embedded worker + pre-allocatedpending), with arm64LLVM=-22clean build andcheckpatch.pl --strictclean reported.
Checklist Summary
- §1 (No model gating): Pass — scoped to
drivers/gpu/drm/asahi/g18/; other GPU generations are untouched. - §2 (Production-ready / default cmdline): Pass — works on default command line; honors
VerboseFaultsmatchinggpu.rs. - §3 (Safety & concurrency): Pass —
OwnedQueue::new_unbound_reclaim()(WQ_MEM_RECLAIM), allocation-freepush()understate.lock(), hard device cap viaRoom, and deadlock-freeG18DrmGpu::drop()->shut_down()drain outsidestate.lock(). - §4 (Clean-room & attribution): Pass — both commits (
cdd27c5b135e,676064c49b98) carry human author/committer and humanSigned-off-by:only; PR body disclosesAssisted-by:. - §5 (Evidence): Blocked — see Blocker below.
- §6 (Naming): Pass — uses
aurora_g18_jobsand touches only existingdrivers/gpu/drm/asahi/g18/paths.
Blocker
- §5 (Evidence) — J873 hardware run at
676064c4not yet completed (and CI still running):- The code is ready, but the only hardware A/B table in the PR body is from the earlier
6252dbc9revision on a different tree (predating the hard capRoom,WQ_MEM_RECLAIM, embeddedWork<JobQueue>, pre-allocatedpending,VerboseFaults, andwait_room()placement). - As noted in
## Still to run, please post the J873 run at676064c4(onintegration/aurora+ the J873g DT stack withCONFIG_PROVE_LOCKING): both bursts plus concurrent submitters exercising the hard cap, the failure flood,synctest, a short sway/GL session, and the regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors), and confirmhost-testsCI passes (currentlyIN_PROGRESS).
- The code is ready, but the only hardware A/B table in the PR body is from the earlier
Assisted-by: LLM (Gemini 4 Neon)
|
Thanks. That's the J873 row at 676064c I asked for. PROVE_LOCKING and PROVE_RCU end with Assisted-by: LLM (Claude:Opus 5.5) |
|
@DjDeveloperr the J873 run at 676064c went up 37 s before your re-review: #2850 (comment). It covers what you listed:
Ryan's note on GFP_KERNEL allocations in the job path after the fence is published (no Assisted-by: LLM (Claude:Opus 5.5) |
|
676064c merges without conflicts on integration/aurora daa9e2d, which has #2679 but none of these follow-ups. The J873 row at this head (lockdep on, the hard device cap under concurrent submitters, the failure flood, synctest) and the green host-tests run cover the evidence the last review asked for, so this is waiting only on that review being cleared. The allocation-after-publish note is a separate follow-up. |
|
I tested head
|
|
I retested A valid 1024×1024 blended draw kept the GPU busy while 32 independent DRM clients each submitted 16 asynchronous jobs. On the control all 512 submit calls returned within 2.52 ms of starting the draw. With #2850 the largest pause was 12.71 ms after submission 256. The 256th call returned at 2.10 ms and the 257th at 14.81 ms. All 512 fences reported successful completion, and the draw produced the expected pixel. In the client-exit run, all 32 clients submitted their jobs and closed. A fresh client then submitted 16 jobs and verified all 16 fences. The hardware pixel checks passed, all 12 CPUs were online, kernel taint remained zero, lock debugging stayed enabled and no new workload warnings appeared. The clock provider also released its request after all six rendering benchmarks on the combined build. The controlled-clock test of the submitted logging function passed again, including the one-second boundary and verbose mode. |
Follow-up to #2679: the four points from the review there (comment).
Changes
g18/sync_input.c).dma_fence_chain_walk()unlinks the earlier points of a timeline once they have signalled. A job's inputs have all signalled when it runs, so of a timeline only the head point's own fence is checked. The comment now says that instead of "each fence is checked".VerboseFaultsset, every failure is reported, asfault_log_ratelimit()ingpu.rsdoes. The output fence and the queue's next submit still carry every error.DEVICE_DEPTH). The per-queue cap stays 32.RoominJobQueue::wait_room(), under the state lock, whilepending + reserved < 256.push()turns it into the job under the same lock. Dropping it on any error path gives the slot back and wakes the waiters.wait_foreign_inputs(), so a submit waiting for another driver's fence holds no slot, but before anything is published, so a signal restarts the ioctl.aurora_g18_jobs) withWQ_MEM_RECLAIM, since memory reclaim can wait for the fences its jobs signal.pendingis allocated for 256 jobs up front. So nothing is allocated under the state lock, which the worker takes while fences are pending.G18DrmGpuis dropped, the workqueue is taken out and destroyed, which waits for the worker to return. A submit after that gets-ENODEV. The drop never runs on the worker: a job holds the runtime, the VM and the queue's error flag, but notG18DrmGpu.retain.c), and the G18 platform driver suppresses bind attributes.Testing
arm64 build with
LLVM=-22:drivers/gpu/drm/asahicompiles with no new warnings. The 20 dead-code warnings are all in other files and are there at the base too.checkpatch.pl --strict: clean on both commits.CI
host-tests: pass. No host test coversg18/drm.rs.M6 (J873g) row of the first version (6252dbc), on the M6 desktop GPU module, A/B:
G18 job failedlinesG18: 39 more failed jobs not reported, 1 linesynctest passed 5 x 50/50.
J873 row at 676064c. Kernel: integration f5fae3c + the J873g DT stack + this head, with
CONFIG_PROVE_LOCKING, under sway on three displays.Assisted-by: LLM (Claude:Opus 5.5)