Repository navigation
drm/asahi: g17: keep userspace-sized submit vectors off contiguous pages - #2858
jgoyvaerts wants to merge 9 commits into
Conversation
The submit ioctl collects its validated commands and their VM pins in KVecs, and builds each command's dependency, checked-input and firmware fence lists in KVecs too. All of them are sized by userspace: up to 64 commands per submission, each over a kilobyte once validated, and as many dependencies as the command waits for, which for the other engine's unfinished commands can be thousands. kmalloc() needs them physically contiguous, so a large submission asks for an order-3 block for its commands alone, on every ioctl. On a machine without compaction that is never allowed to fail and ends in the OOM killer instead, five times in one dEQP-VK run on an M4 Pro, with 26 GB available: deqp-vk invoked oom-killer: gfp_mask=0x40cc0(GFP_KERNEL|__GFP_COMP), order=3 krealloc_node_align_noprof+0x154/0x238 rust_helper_krealloc_node_align+0x10/0x20 ..._asahi_core3g175queue...18prepare_submission... Nothing needs these contiguous: only the ioctl and the job read them. Make them KVVecs, and the cursor array the merge of a long dependency list allocates a kvmalloc_array(). Small ones keep their kmalloc memory. Userspace decides how large they get, so charge all of them to the caller's memory cgroup (GFP_KERNEL_ACCOUNT). A vmalloc()ed vector must be freed where vfree() may sleep. The command, dependency and merge vectors are freed in the ioctl. A job's packet keeps its checked inputs and firmware fences, and its owners release it under the runtime's mutexes or from drm_sched's free_job() work, never under a spinlock or in a fence callback. The fence array of the merged dependency itself is allocated by __dma_fence_unwrap_merge() and freed with kfree() by dma_fence_array, so it stays contiguous. It holds only unsignalled fences, 8 bytes each. Signed-off-by: Jonathan Goyvaerts <[email protected]>
5ba7b33 to
b99cc53
Compare
|
Review at b99cc53 (non-author, draft). No blocker.
Small points, not blocking:
Assisted-by: LLM (Claude:Opus 5.5) |
|
Partial hardware evidence from the J616s (M4 Pro). The same change, in our tree as one commit on top of #2228's per-queue scratch, is in our m4.179 kernel, which also turns compaction back on. On this boot:
This stays a draft. I haven't rerun the large dEQP-VK run that hit the OOM killer, and with compaction now on in that kernel, 0 OOM kills on this boot doesn't show this change on its own. The next check is that dEQP-VK run, with a Assisted-by: LLM (Claude:Opus 5.5) |
Several ioctls size a kernel allocation straight from userspace: - SUBMIT copies cmdbuf_size bytes (a u32, so up to 4 GiB) into a KVec. Only G16 bounds it before the copy (4 MiB); every other GPU kept the trait default of usize::MAX. - SUBMIT allocates in_sync_count + out_sync_count sync items before any per-GPU check. - VM_BIND copies stride * num_binds bytes and then reserves num_binds prepared operations. Without a GPU batch limit (bind_batch_limit() returns None), both are up to u32::MAX. A request past the page allocator's largest order hits WARN_ON_ONCE_GFP() in __alloc_pages(). Any user with the render node can trigger it, and with panic_on_warn it takes the machine down. Short of that limit, a valid but large request still needs high-order contiguous pages: an order-3 allocation of the sync array failed on J616s under deqp-vk. For SUBMIT: - Copy the command stream and build the sync array in KVVec with GFP_KERNEL_ACCOUNT. kvmalloc() falls back to vmalloc() instead of failing on fragmented memory, and the memory is charged to the caller's memcg. The sync array keeps this type through every generation's submit() (G13/G14, G15, G16, G17, G18, M3, M5); the G17 job vectors are converted in aurora-silicon#2858. - kvmalloc() refuses, and warns about, more than INT_MAX bytes. The trait default for max_cmdbuf_size() is now INT_MAX, so a larger command stream fails with E2BIG. This rejects no stream any GPU could accept before. A sync array larger than INT_MAX bytes fails with E2BIG too. - G17 returns its own bound: the largest valid G17 stream, MAX_COMMANDS_PER_SUBMISSION * (1 + 5) * (size_of::<drm_asahi_cmd_header>() + u16::MAX) = 25,168,512 bytes, checked at build time to be at most INT_MAX. - G15 returns its 4 MiB MAX_CMDBUF, as G16 already does. Its parser refused a longer stream before, but only after the copy, with EINVAL. Such a stream now fails before the copy, with E2BIG. - G18, M3 and M5 use the shared default until their own largest stream is known. For VM_BIND, pass __GFP_NOWARN on the user-sized allocations, so a request that is too large fails with ENOMEM and no warning. Its sizes are not changed. The timestamp mapping limit is left to aurora-silicon#2531. Checked by reading the call paths (file.rs submit, parse_array, vm_bind, vm_bind_g17, mmu/bind.rs, and each generation's submit()). rustfmt is clean on the changed code. The kernel Rust code was not compiled here. What userspace can see: on G17, a stream over 25,168,512 bytes, which its parser cannot accept, now fails before the copy; on G15, a stream over 4 MiB fails with E2BIG before the copy instead of EINVAL after it; on G13, G14, G18, M3 and M5, only streams over 2 GiB fail early. The allocation path changes on every GPU, so deqp-vk or CTS runs on G13, G14 and G17 (J616s among them) are needed before this is merged.
|
@jgoyvaerts checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
Conflicts, and how they were resolved: - g17/queue/mod.rs, prepare_submission(): main (aurora-silicon#2228) keeps pending and guards in the per-queue Scratch, already KVVec and charged with GFP_KERNEL_ACCOUNT. Main's version is taken; this branch's local KVVecs and the ValidatedBatch alias go. - g17/queue/mod.rs, enqueue(): main (aurora-silicon#3119 and the timestamp overlap work) builds the producer waits in EnqueueOrdering and feeds the firmware-ordered ones through ProducerWaits. Main's logic is taken; dependencies, checked_inputs and firmware become KVVecs charged with GFP_KERNEL_ACCOUNT, as this branch did for the old loops. job.rs, sync_input.rs and sync_input.c merged without conflicts. No behaviour change beyond this branch's: which fences each command waits for, checks and hands to firmware is main's; only where the vectors that hold them are allocated, and who is charged, changes. Signed-off-by: Jonathan Goyvaerts <[email protected]>
Since this branch was written, main builds a command's producer waits in two steps: EnqueueOrdering collects the covered predecessors, host waits, firmware waits and inherited timestamp waits from the frontier, and the publication's Prepared links one record per predecessor. Each of those vectors grows with the same covered prefixes this branch's dependency vectors do, pushed one entry at a time from empty, so a deep prefix of the other engine reallocates them into high-order contiguous blocks on every command. Make them KVVecs charged to the caller with GFP_KERNEL_ACCOUNT, and charge the per-predecessor link records too. vfree() context: EnqueueOrdering and Prepared are consumed or dropped in the ioctl; Prepared::activate() frees its links after the target's mutex is released. The inherited timestamp waits end up in Fences, which only the Queue holds, and the Queue already keeps KVVecs. Signed-off-by: Jonathan Goyvaerts <[email protected]>
test-fence-signalling.py compiles the production g17/sync_input.c against host shims. Its fence merge now takes its cursor array with kvmalloc_array(GFP_KERNEL_ACCOUNT) and frees it with kvfree(), so the shim provides those instead of kmalloc_array(), kfree() and GFP_KERNEL, which nothing else in the harness uses. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
Merged Conflicts, all in
The resolution changes no behaviour: main still decides which fences a command waits for, checks and hands to firmware. Comparing this PR's diff against its old base with the merge's diff against main shows only that move. Two commits on top, both for what main added since this branch was written:
Checks at
Next: the same dEQP-VK run that hit the OOM killer, with a |
There was a problem hiding this comment.
Verdict: FINISH, then merge at cab09747
Blockers:
- Wait for the 21 queued CI checks (
apple-build,kunit,host-tests,pr-text,readiness, 16 KUnit suites) atcab09747to finish green. - Complete the queued exact-head J616s (M4 Pro) hardware row at
cab09747(dEQP-VK + regression check; no Mac boot at this head yet).
Checked:
- All 6 modified files (
g17/completion/publication.rs,g17/job.rs,g17/queue/mod.rs,g17/sync_input.c,g17/sync_input.rs,tools/testing/selftests/drivers/gpu/asahi-m4/test-fence-signalling.py): 0 code blockers.- Verified all userspace-sized submit vectors (
Prepared::links+KBox<Link>,Packet::{inputs, firmware},Fences::timestamp_waits,dependencies,checked_inputs,EnqueueOrderingvectors,sync_input::merge(), andasahi_g17_merge_fences()cursors) move cleanly toKVVec/kvmalloc_array()withGFP_KERNEL_ACCOUNT. - Verified
vfree()drop contexts are sleepable:Prepared::activate()releasesself.target.state.lock()before consuming/droppingself.links,EnqueueOrdering/merge/dependency vectors drop in the ioctl path, andPacket/Fencesdrop under queue/scheduler workqueue/teardown contexts (no spinlock/IRQ drop). - Verified
test-fence-signalling.pyshimsGFP_KERNEL_ACCOUNT,kvmalloc_array(), andkvfree()cleanly (251/251g17 host tests,927/928KUnit,checkpatchclean,MERGEABLEonmain).
- Verified all userspace-sized submit vectors (
Evidence
- Head:
cab09747(MERGEABLEonmain,+57/-48across 6 files). - CI at review time: 21 checks
QUEUED/PENDING, 0 failures. - Code is clean; ready to approve once CI and the exact-head J616s row at
cab09747pass.
|
Note on where the hardware row will come from: our J616s test kernels are based on main
KUnit and the g17 host harnesses pass on the backport. I'll post the run's result here, naming the kernel and that base, and the Tested: line will say the same. |
|
J616s (M4 Pro) result, on our m4.201 test kernel. That kernel is main
Open: a Cyberpunk profile on the same kernel shows more time in the memcg slab charge and free hooks. That is consistent with the per-submit |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Prepared::new() takes one link record per covered predecessor, and the vector holding them, with GFP_KERNEL_ACCOUNT. Every submit charges them to the caller's memory cgroup, and the event work that publishes the predecessor uncharges them, which puts memcg's slab hooks on both paths. On an M4 Pro, Cyberpunk 2077 spent 0.35-0.40% of its samples in them, against 0.03% before, and its median frame time rose from about 48 to 52-53 ms; without the charge both come back. The charge buys nothing here: the links are transient, bounded by the frontier, and never outlive the predecessor's publication. Take them with GFP_KERNEL; the vector stays a KVVec, so a deep prefix still needs no contiguous pages. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
New head
That is the cost my earlier comment left open, now measured. A Cyberpunk 2077 A/B on our J616s (M4 Pro) test kernels compared the a851 backport with and without this commit. Each run is 8 profiled launches plus 3 traced, with 0 recoveries.
Checks at
The other vectors keep |
There was a problem hiding this comment.
Verdict: FINISH at e25c142. The delta preserves KVVec backing and removes accounting from both the per-submit links vector and each Link. The backported J616s A/B quantifies the accounting cost. Please document the aggregate bound on live uncharged Link records across submissions: a frontier bound per submit does not itself cap the number of successors attaching to the same unfinished predecessor. Identify the submission or fan-out limit that supplies that bound. Exact-head hosted CI and the current-base J616s dEQP-VK regression row remain open.
A command's publication waits on every covered unfinished predecessor through one link each. Since "drm/asahi: g17: don't charge a publication's links to the caller", each link is its own uncharged KBox. Nothing caps how many a client keeps alive: every command behind a stalled predecessor adds one link per covered unfinished publication, so n such commands hold n(n-1)/2 links for as long as the stall lasts. They are per-job state of the same kind as the job's fence vectors (Packet::inputs and Packet::firmware hold one fence per covered producer): sized by what the command covers, and charged to the client, so the client's memory cgroup is their bound, as it is for those vectors. What made charging them cost frame time was one charge and uncharge per link: on an M4 Pro, Cyberpunk 2077 spent 0.35-0.40% of its samples in memcg's slab hooks, on the submit path and in the event work that frees links. Allocate all of a successor's links in one block, charged with GFP_KERNEL_ACCOUNT. The successor's publication owns the block from activation on, and predecessors' lists point into it. That is one charge and one uncharge per job, whatever the number of links. The block outlives every link in it: a publication publishes only after each predecessor has consumed its link, and each link holds its successor until then, which a predecessor dropped before publishing releases (State::drop). A link reaches no other thread while it sits in one list, under that predecessor's lock, or in the one traversal that detached it. KUnit checks that a successor with three predecessors makes exactly one allocation, charged, and frees it exactly once: after an error in the middle of its prefix, after a clean settle, when setup is dropped before activation and when a predecessor is dropped unpublished. Allocating per link again, or dropping __GFP_ACCOUNT, fails it. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
New head Why the links are charged again: nothing else caps them. Every command behind a stalled predecessor adds one link per covered unfinished publication, so n such commands hold n(n-1)/2 links for as long as the stall lasts. The job's fence vectors ( Where the measured cost came from: one charge and one uncharge per link. Now all of a command's links are one
Tests:
Not yet: the same Cyberpunk A/B with one-block charging. The backport is queued for our next J616s test kernel. Pass means fps within noise of the uncharged run and memcg hooks near 0.05% of samples. |
There was a problem hiding this comment.
Verdict: HOLD — single-block charged link design clean, awaiting queued CI and exact-head J616s hardware rows at edade58c698e
Blockers:
- Hosted CI at
edade58c698e(apple-build,host-tests,pr-text, and KUnit suites) is still queued and must finish green. - Exact-head G17 hardware verification on current
mainremains open (J616sdEQP-VKregression row atedade58c698eplus the queued one-block Cyberpunk A/B confirming frame time and memcg hook parity with the uncharged baseline).
Checked:
- Commit
edade58c698eindrivers/gpu/drm/asahi/g17/completion/publication.rs: replaces per-linkKBoxallocations with a singleGFP_KERNEL_ACCOUNT-chargedLinkBlock(KVVec<UnsafeCell<Link>>)owned byState::blockfromPrepared::activate(), restoring client memcg bounding for stalled-predecessor link fan-out while reducing charging to one allocation per job. unsafelifetime, aliasing, and cycle teardown invariants:- Each
LinkretainsOption<Arc<Publication>>(target) untilrelease()drops the takenArcafter removing the link from its predecessor list and (when reused as a traversal frame indrain()) popping it fromframes; this guaranteestargetandtarget.state.blockstay alive for every reachable link even aftertargetpublishes. State::dropwalks remainingsuccessorsand callsrelease(), breaking thetarget -> block -> link -> targetcycle if a predecessor is dropped before publishing.- Pre-activation drops of
PreparedfreeLinkBlockdirectly without forming a cycle; zero-predecessor submissions perform no link-block allocation. - Disjoint
UnsafeCell<Link>slots are touched only under their respective predecessor's mutex or by the single owningdrain()traversal, andstate.blockis never mutably borrowed as a slice after installation.
- Each
- New KUnit tests (
consumer_links_are_one_charged_allocation,link_block_is_freed_once_on_release_and_drop_paths) covering prefix failure, clean settle, pre-activation drop, unpublished-predecessor drop, and empty predecessor sets (929 pass / 1 skipKUnit,251/251g17 host tests, checkpatch clean).
Evidence
- Verified
release()takes(*link.as_ptr()).target.take()into a stack temporary beforedrop(...)so no reference intoLinkBlockremains live if thatArcdrop freesPublicationandState::block. - Verified
Prepared::activate()holdstarget: Arc<Publication>across the entire0..countinstallation loop andadd_successor()completestarget.predecessor_done(immediate)beforerelease(link)andSelf::drain(children). MERGEABLEonmain; no code blockers found atedade58c698e.
A publication's link block is a KVVec, so a large one may come from vmalloc, and vfree() may sleep outside interrupt context. Its last reference drops wherever the publication's does: in the ioctl, at queue teardown, in drm_sched's free_job and kill work, and in the event work through Deferred::finish(). None of them holds a spinlock, has interrupts disabled or is in an RCU read side. The hard interrupt and the rescan hrtimer only queue the event work. Dropping a publication already takes a mutex (fence::Member's drop, through Submission::release_state()), so those places had to be able to sleep before the block existed. Make that a checked rule at the free site: might_sleep() when a block that owns memory is freed. With CONFIG_DEBUG_ATOMIC_SLEEP, KUnit runs clean, and dropping only an unactivated block under a spinlock reports "sleeping function called from invalid context" from LinkBlock's drop. Signed-off-by: Jonathan Goyvaerts <[email protected]>
|
New head A link block can be large enough to come from vmalloc, and
None of them holds a spinlock, has interrupts disabled or is in an RCU read side. The RTKit hard interrupt and the rescan hrtimer only queue the event work. Dropping a publication already took a mutex ( The commit makes it a checked rule:
Checks at
Not yet now also says that the number of pending commands per queue has no cap, so charging bounds this memory only under a memcg limit. A per-queue cap is being looked at separately, for its own PR. |
There was a problem hiding this comment.
Verdict: HOLD — might_sleep() check clean, awaiting queued CI and exact-head J616s hardware rows at 25ac1dfa71be
Blockers:
- Hosted CI at
25ac1dfa71beis still queued and must finish green. - Exact-head G17 hardware verification on current
mainremains open (J616sdEQP-VKregression row plus the queued one-block Cyberpunk A/B confirming frame time and memcg hook parity with the uncharged baseline).
Checked:
- Commit
25ac1dfa71be(+3/-0indrivers/gpu/drm/asahi/g17/completion/publication.rs): callskernel::task::might_sleep()inLinkBlock::drop()wheneverself.0.capacity() != 0, enforcing at runtime underCONFIG_DEBUG_ATOMIC_SLEEPthatKVVec/vfree()drops only in sleepable context (matchingPublication's existing sleepable drop requirement viafence::Member->Submission::release_state()). - Verification reported clean at
25ac1dfa71be: KUnit929 pass / 1 skipwithCONFIG_DEBUG_ATOMIC_SLEEP=y(0atomic-sleep warnings; negative control under a spinlock triggers fromLinkBlock::drop),251/251g17 host tests, checkpatch clean.
Evidence
- Confirmed all
Publicationdrop sites (ioctl, queue teardown,drm_schedfree_job/kill work, and event work viaDeferred::finish()) are sleepable contexts; hard IRQ and rescan hrtimer only schedule work. MERGEABLEonmain; no code blockers found at25ac1dfa71be.
|
On the aggregate bound on live uncharged What bounded live links at
Why not a structural cap here:
What the PR does now: the links are that same kind of per-job state, and get the same bound: the client's memory cgroup.
Hardware, Cyberpunk 2077 on a J616s (M4 Pro). Every kernel is main
A hard per-client bound on the whole submit path needs a cap on pending commands per queue. That is a uAPI change and is #3602, not part of this PR. |
Signed-off-by: Ryan Murray <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
|
I merged current |
There was a problem hiding this comment.
Verdict: HOLD at 5a735f9c.
Checked: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks and the current J616s Vulkan/memory-pressure regression plus the one-block accounting A/B.
There was a problem hiding this comment.
Verdict: MERGE at 5a735f9cf848
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: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks and the current J616s Vulkan/memory-pressure regression plus the one-block accounting A/B.
Follow-ups (not blocking): hosted checks, J616s Vulkan/memory-pressure regression, one-block accounting A/B
What: Keep the G17 submit path's userspace-sized vectors (the per-command dependency and ordering lists, the publication links, the merge arrays) off contiguous pages and charge them to the caller, after an order-3 GFP_KERNEL OOM kill under deqp-vk. The per-ioctl commands and VM pins already got this in main with #2228.
Tested: J616s (M4 Pro), our m4.201 test kernel = main
a851ca0edfc9+ our carried patches + this change backported (not this head itself): dEQP-VK.synchronization{,2}.timeline_semaphore.* 5,753/5,753 Pass; 0 OOM kills, 0 page allocation failures, 0 GPU recoveries; a kmem:mm_page_alloc probe shows 0 asahi order >= 2 allocations that could reach the OOM killer (none from the submit path); compaction is on in that kernel. Cyberpunk 2077 A/B, J616s, each kernel = maina851ca0edfc9+ our carried patches + this change backported (not this head itself): links charged per KBox (m4.201) 18.5-19.2 fps, memcg slab hooks 0.35-0.40% of samples; links uncharged (m4.202) 20.0-21.0 fps, hooks 0.04-0.05%; links in one charged block with the might_sleep() guard (m4.205, the backport ofedade58c698e+25ac1dfa71be; 8 profiled + 3 traced launches, 0 recoveries, 0 client failures) 24.6-25.9 fps, frame p50 38.5-40.6 ms, hooks 0.055-0.077%. So the one charge per job costs ~0.02 percentage points of samples and no frame rate against the uncharged links; m4.205 also carries other G17 changes against m4.202 (pooled fences, a per-queue pending cap, others), so its fps gain belongs to that kernel, not to this PR. At25ac1dfa71be: KUnit (arm64 qemu, asahi + SEP + ISP config) 930 tests: 929 pass, 1 skip, including the new link-block cases (red on the per-link code; allocating per link again or dropping __GFP_ACCOUNT fails them); the same KUnit with CONFIG_DEBUG_ATOMIC_SLEEP=y runs with 0 "sleeping function called from invalid context" reports, and dropping a link block under a spinlock reports one from LinkBlock's drop;tools/asahi/run-host-tests.py: all 251 g17 entries pass, and the 29 failures are the set that fails on plain main in this environment; checkpatch clean.Risk: two-way door · M4, M4 Pro, M4 Max and M5 (shared G17 code)
Not yet: a row at this head on current main; the dEQP-VK run with CONFIG_COMPACTION off; the M4, M4 Max and M5 rows; and a cap on pending commands per queue: none exists here, so charging bounds this memory only under a memcg limit (the cap is #3602)
Details
Trigger: an order-3 GFP_KERNEL OOM kill under deqp-vk. On a J616s (M4 Pro, 16K pages) the OOM killer fired five times in one dEQP-VK run, from the submit ioctl, while 26 GB was available. It killed unrelated processes:
That kernel had
CONFIG_COMPACTIONoff, which is our own config and is being fixed there. With nothing to compact, an order <= 3 allocation is never allowed to fail, so it ends in the OOM killer. Compaction makes order 3 recoverable, but the driver still shouldn't need physically contiguous memory per submit for data userspace sizes.What userspace sizes, and what changes
prepare_submission'spendingandguardsMAX_COMMANDS_PER_SUBMISSION), each(Validated, Order, Destinations)over 1 KB, which needs order 3Scratch(#2228)dependencies,checked_inputs,firmwarePacket::{inputs, firmware}EnqueueOrdering's predecessors, host waits, firmware waits and inherited timestamp waits;Fences::timestamp_waitssync_input::merge()'s pointer arrayasahi_g17_merge_fences()'s cursor arraykvmalloc_array()/kvfree()All of them use
GFP_KERNEL_ACCOUNT, so a client that submits huge batches or waits on huge prefixes is charged in its own memory cgroup, which is their bound. The links are the same kind of per-job state as the job's fence vectors: a command behind a stalled predecessor adds one link, and one fence, per covered unfinished publication, so nothing but the memcg caps them. Charging one KBox per link put memcg's slab hooks on every submit and on the event work that frees links (measured above), so a command's links are one block, charged once, that its publication owns: it publishes only after every predecessor has consumed its link, and each link holds the publication until then. kvmalloc still tries kmalloc first, so small sizes keep their current memory.vfree() context. A vmalloc'ed vector must be freed where
vfree()may sleep.EnqueueOrderingis freed in the ioctl. A command's link block is freed with its publication, which drops where itsCompletion, frontier entry or last link does: the ioctl, the queue's teardown, drm_sched's free_job and kill work, or the event work throughDeferred::finish(). None of them holds a spinlock, has interrupts disabled or is in an RCU read side; the hard interrupt and the rescan hrtimer only queue the event work. Dropping a publication already took a mutex (fence::Member->Submission::release_state()), andLinkBlock's drop now assertsmight_sleep().Fences(and their timestamp waits) are held only by the Queue, which main already fills with KVVecs.Packet's two vectors go with the packet. Its holders are runtime state behind mutexes, the drm_sched job (free_jobruns from the scheduler's workqueue or at teardown), and the ioctl.Packettakes a spinlock or RCU read lock, or disables IRQs. The only fence callback (sync_scope.c) holds no packet.Left contiguous, by design. The merged
dma_fence_array's own fence array is allocated by core__dma_fence_unwrap_merge()and freed withkfree()indma_fence_array_release(), so it can't move to vmalloc from the driver. It holds only unsignalled fences, 8 bytes each.Merged with main. #2228 landed first, with
pending/guardsin a KVVecScratch; the merge77eb06bd5c89takes main's version there and main'sEnqueueOrdering/ProducerWaitslogic inenqueue(), and only moves the vectors that hold the fences.ad7c997ec0f2covers the vectors main added since this branch was written.Evidence
Testing
cab097479b9a: KUnit (arm64 qemu, asahi + SEP + ISP config) 928 tests, 927 pass, 1 skip;tools/asahi/run-host-tests.pyall g17 entries pass (251), with only the 29 failures plain main has in this environment.test-fence-signalling.py's host shim now provideskvmalloc_array()/kvfree()(cab097479b9a).--only g1790/90; checkpatch 0 errors (the 1 warning is the quoted kernel log line). checkpatch on the new commits: 0 errors, 0 warnings.Not done
file.rs's sync array and command copy are the same kind of userspace-sized allocation, shared by every generation: drm/asahi: keep a submission's syncs and command copy off contiguous pages #3021.