Skip to content

drm/asahi: g17: keep pooled objects mapped until their control fence - #2959

Merged
RyanTheTide merged 3 commits into
mainfrom
asahi/g17-pool-fence
Nov 29, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
asahi/g17-pool-fence

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The G17 firmware object pool holds a returned object back until the firmware has consumed the control record that ends its previous owner's use of it. That fence exists because the firmware can still follow a released object's address. Once a family runs out of cache room, the pool stopped holding to it in two ways. allocate() could hand out a returned object whose fence was not met yet (the family's overruns counter). And a fresh object made while the family was full had no cache lease, so its drop unmapped and freed it at once, with no fence at all.

Change

  • A returned object is never reused before its fence, on any family or GPU. With no met fence and no room, allocate() makes a fresh uncached object. The A18 Pro already did this for work states.
  • A dropped uncached object stays mapped on a per-pool deferred list until the firmware has met control_fence(), the fence a cached object would wait for. allocate() and every deferred drop reap the list. Firmware stop releases whatever is left, the same way it releases kept objects.
  • Only an object whose address reached the firmware is deferred (since 77229d8). A context attaches an object::Exposure to its work state and its M5 scheduler page. The exposure is set by work_head_va()/node_va() (expose_work), scheduler_va() and publication. An uncached object whose exposure is still unset is unmapped at its drop. So queues created and closed without work do not grow the list (capacity line unexposed_freed=).
  • The list entry is reserved when the object is made, so the drop never allocates. An allocation that cannot reserve the entry fails. Mapping teardown never runs under the pool mutex.
  • The capacity file gets an uncached_objects_fenced waiting= bytes= line, and a one-time warning prints if the list grows large. If the firmware stops consuming control records, the objects stay mapped until firmware stop and are not freed early. The existing overruns counters stay and now read 0.

Testing

  • tools/asahi/g17-object-fence-tests.py, updated: the new checks fail on the current integration/aurora pool ("an uncached object was unmapped before its fence") and pass with this change. run-host-tests.py --only g17-object-fence passes 9/9, including the 4 new mutations.
  • drivers/gpu/drm/asahi/ builds with the fleet85 release config. No new warnings, none in g17/object.rs.
  • Neo (A18 Pro): many concurrent render+compute Vulkan queues fill the pool families, then close in mixed order while more open. Every render and compute result is checked on the host. Stock module: one reuse before its fence across three runs, and objects freed at drop with no fence in every run. Patched module: three runs, 0 overruns, deferred objects seen waiting and all reaped by the end (0 left, 0 bytes), no GPU faults or kernel messages, all results correct.

Still to run

  • A row on the M4 Pro (T6040). There every family uses the strict fence, so the deferred list and the no-overrun path see more traffic.
Host test details

The full-family scenario now runs on every family with and without after_release. With only waiting entries, a full family hands out an uncached object instead of one of them. The dropped uncached object stays mapped until control_fence() is met and is unmapped at the next allocation after that, or at firmware stop. An uncached object kept with retain_until_stop stays off the deferred list.

The random model records the control-ring witness at every unmap and checks it against the fence of each deferred object. The differential against the pool before linux#1978 (M4/M5 decisions) now limits BASE's reuse to met fences.

New mutations, each of which must fail the run: overrun-full-family (reuse a waiting entry), unmap-uncached (free at drop), reap-early (reap one record early), stop-keeps-deferred (firmware stop leaves the list mapped).

Neo row details

The patched aurora.ko was built M= against the fleet85 tree and loaded from rootfs on a one-shot boot of the default entry. The stock module ran on production fleet85. Counters come from /sys/kernel/debug/aurora-g17/capacity, and the deferred-list line was sampled every 50 ms during the patched runs.

run overruns (fam 0/2/3) deferred max seen deferred at end processes / errors
stock 1 0/0/0 n/a n/a 55 / 0
stock 2 1/0/0 n/a n/a 95 / 0
stock 3 0/0/0 n/a n/a 95 / 0
patched 1 0/0/0 not sampled 0 95 / 0
patched 2 0/0/0 3 0 95 / 0
patched 3 0/0/0 3 0 95 / 0

Each stock run also freed 10 uncached objects at drop. On the patched one-shot boot the desktop was not a GPU client, so the patched runs show more fresh uncached allocations: new objects where the stock pool would have reused a waiting one.

Tested: run-host-tests 732/732 at 77229d8 (g17-object-fence create_close_loop: 4096 create/close cycles leave waiting=0; 14/14 mutants killed incl. defer-unexposed and unexposed-head); KUnit asahi 490/494 (4 skip); fleet-config asahi build OK; Neo rows above predate 77229d8.
Risk: G17 object pool on M4 Pro/Max, M5, A18 Pro; uncached (unpooled) objects now wait for the control fence when exposed and are freed at drop when never exposed; a missed exposure site would free a firmware-named object early (source rules pin the address readers).

The firmware can follow a released object's address until it has
consumed the control record that ends the owner's use of it. The
object pool honours that fence for cached objects, with two exceptions
once a family is full:

- With no room for a fresh cached object, allocate() reused the oldest
  returned object even when its fence was not met yet (counted in the
  family's overruns, A18 Pro work states excepted).

- A fresh object made while its family was full got no cache lease,
  and its drop unmapped and freed it at once, with no fence at all.

Never reuse a returned object before its fence, on any family: with no
met fence and no room, allocate() makes a fresh uncached object, as it
already did for A18 Pro work states. When an uncached object is
dropped, keep it mapped on a per-pool deferred list with
control_fence(), the strict fence a cached object would wait for, and
unmap it once the firmware has met it. allocate() and every deferred
drop reap the list; firmware stop releases what is left, as it does
for kept objects. The list entry is reserved when the object is made,
so the drop does not allocate; an allocation that cannot reserve it
fails. Teardown never runs under the pool mutex.

The list holds only objects whose fence the firmware has not met. It
is shown in the capacity file as uncached_objects_fenced with its
bytes, and a one-time warning is printed past 256 entries. If the
firmware stops consuming control records, the objects stay mapped
until firmware stop instead of being freed early.

The overruns counters stay in the capacity file and now read 0.

The object-fence host test now checks, on every family with and
without after_release, that a full family hands out an uncached object
instead of reusing a waiting one, that a dropped uncached object stays
mapped until control_fence() is met and is unmapped then or at
firmware stop, and that an uncached object kept until stop leaves the
list alone. Its random model records the control-ring witness at every
unmap. The differential against the pool before linux#1978 now limits
BASE's reuse to met fences. New mutations: overrun-full-family,
unmap-uncached, reap-early, stop-keeps-deferred.

Signed-off-by: Ryan Murray <[email protected]>

@DjDeveloperr DjDeveloperr 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.

Formal §1–§6 pre-PR checklist review against 2dedb1a1e82492e1876a8cbd176a7f246f2b9a65.

Summary

The core lifetime mechanics in drivers/gpu/drm/asahi/g17/object.rs are clean and well-structured: pre-reserving deferred capacity at allocation time avoids allocating in Drop, cancel_deferred() keeps deferred_reserved balanced on retain_until_stop(), mapping teardown never runs under the pool mutex, stop_after_firmware() drains deferred and handles late drops safely, and G13/G14/G15/G16/G18 are untouched.

However, there are two concrete blockers that prevent approval / MERGETRAIN-LINUX4:


Blockers

  1. §1 / §3 — Unbounded inner.deferred growth & kernel memory / upper-VA exhaustion on unpublished queue churn (M4 Pro/Max, M5, and saturated A18 Pro)

    • Previously, when a family filled its 64 slots with waiting entries, Pool::allocate() overran the oldest slot (!room && !marked), bounding kernel GEM backing and upper UAT VA to POOL_SLOTS / POOL_BYTES.
    • With this change, allocate() never reuses a waiting entry and instead allocates a fresh uncached KernelObject (defer: Some(self.clone())). On drop, defer_object() pins it in inner.deferred until control_fence() = CONTROL_PUBLISHED + 1.
    • Creating and closing a logical queue without submitting work (Context::new() followed by close where !context.is_published()) publishes no device-control record (teardown::Pending::close skips unpublished contexts), and observe_control() is only called on control publication, teardown, or compute pool release.
    • On M4 Pro / M4 Max / M5 (objects_after_release = false): after 64 unpublished queue create/destroy cycles, all 64 Family::WorkState slots (and on M5 all 64 Family::Scheduler slots as well) sit in returned[] waiting on CONTROL_PUBLISHED + 1. Every subsequent unpublished queue create/destroy allocates fresh uncached kernel backing + upper UAT VA (32 KiB on M4, 48 KiB on M5) and appends it to inner.deferred with fence = CONTROL_PUBLISHED + 1. Because CONTROL_CONSUMED never advances, reap_deferred() can never free a single entry.
    • On A18 Pro (objects_after_release = true): the same unbounded growth triggers whenever 64 WorkState slots are held live (inner.reserved[WorkState] == 64) and a 65th queue is created and destroyed without submitting, because uncached objects carry no ReturnMark and always take control_fence().
    • Because gem::new_kernel_object* uses uncapped memacct::Charge::kernel, defer_object() has no cap (only pr_warn_once! at KEPT_WARN = 256), and M5 pins Firmware until reboot (SESSION_RETAINED), an unprivileged userspace loop creating/destroying idle queues can pin arbitrary kernel RAM and exhaust the upper dynamic UAT VA range (UpperVa ENOSPC), breaking GPU allocations for all clients on the device.
    • What is needed: Either avoid deferring objects that were never exposed to firmware (e.g. only arm deferral once exposed / carry exposure tracking for uncached objects and non-after_release GPUs), or enforce a bounded deferred cap / backpressure (or explicit control-ring fence advance) so inner.deferred cannot grow without bound.
  2. §1 / §5 — Missing M4 Pro/Max and M5 hardware evidence (and full §5 regression row)

    • The PR body explicitly leaves M4 Pro (T6040) under ## Still to run, and provides no M5 (T8142 / T6050 / T6051) test row at all.
    • Both M4 Pro/Max and M5 run g17/object.rs with objects_after_release = false (and M5 additionally pools Family::Scheduler and retains the firmware session until reboot), so the no-overrun + deferred-list paths take substantially more traffic there than on A18 Pro.
    • Per §1 ("Prove the change on every Mac you have that contains the block") and §5 (hardware run with numbers + regression run reporting 0 SELinux denials, 0 failed units, 0 new kernel errors on the default boot), hardware results on M4 Pro/Max and M5—plus the full §5 regression check—are required before approval (or keep the PR as a draft while Still to run is pending).

Non-blocking Notes

  • Idle retention & uncached_objects_fenced waiting= accuracy (object.rs:960-975, object.rs:1076):
    • reap_deferred() is only called from Pool::allocate() and Pool::defer_object(), not when observe_control() advances CONTROL_CONSUMED (e.g. during service_teardown / drain_reclaims). As a result, the trailing wave of deferred objects from a burst stays mapped while the GPU is idle even after its fence is met, until the next allocate().
    • Pool::write_capacity() prints inner.deferred.len() as uncached_objects_fenced waiting= without filtering fence > witnessed (unlike cached_objects_fenced waiting= on line 1070), so after witnessed advances it counts already-met unreaped entries as waiting, which also slightly diverges from the commit message ("The list holds only objects whose fence the firmware has not met").
  • Quadratic scan in reap_deferred() (object.rs:961-974):
    • Scanning from index 0 with iter().position(...) on every swap_remove is O(N²) when unready entries sit at the front of inner.deferred, and reacquires self.inner per reaped object. Scanning backwards (or popping ready entries into a local batch and dropping outside the lock) avoids this.

Checklist Audit (§1–§6)

Section Status Notes
§1 No model gating / correctness FAIL Uniform across G17 (removes model-gated overrun exception; G13–G16/G18 untouched), lock ordering and Drop/stop paths are sound, but unbounded inner.deferred growth on unpublished queue churn and missing M4/M5 coverage block.
§2 Production-ready / scope PASS (minor) Clean 3-file diff, no cmdline/module params or hacks; should remain Draft while Still to run is open.
§3 Safety / isolation FAIL Cross-context isolation is preserved (zeroed on fenced reuse; deferred objects never reused), but unbounded deferred kernel GEM + upper UAT VA growth is an unprivileged local DoS vector.
§4 Clean-room & attribution PASS Single commit by human author/committer (Ryan Murray <[email protected]>) with human Signed-off-by: only, zero AI trailers in commit, Assisted-by: present in PR body.
§5 Evidence FAIL Host tests & 4 new mutations pass; Neo (A18 Pro) row passes; M4 Pro/Max still pending, M5 missing, full §5 regression tuple (SELinux denials / failed units / kernel errors) not reported.
§6 Naming & CI PASS Naming clean (aurora.ko, aurora-g17). Live CI host-tests (Host tests, run 45142201867) is SUCCESS on 2dedb1a1e82492e1876a8cbd176a7f246f2b9a65.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 77229d88: 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 no requested by DjDeveloperr
Hardware row at head ok in the PR body at 77229d88
Conflicts ok none
PR text adopt when you next edit add 'one-way' or 'two-way' in Risk (guide)

Areas: area:gpu

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

@DjDeveloperr DjDeveloperr 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.

Verdict: FINISH, then merge at 2dedb1a1e824

Blockers:

  1. drivers/gpu/drm/asahi/g17/pool.rs: Pool::allocate() no longer reuses a waiting entry; it allocates a fresh uncached object and defers its drop until control_fence(). A queue created and closed without submitting publishes no control record, so after 64 such cycles on M4 Pro/Max or M5, every further create/close pins another 32–48 KiB of kernel memory and upper UAT VA in inner.deferred, with no cap. An unprivileged loop can then exhaust the upper VA range for every client. Fix: only defer objects that were exposed to firmware, or cap inner.deferred and push back.

Rows before merging: pool.rs runs on M4 Pro/Max and M5, so at the new head it needs one run on each, with queues created and closed in a loop and no growth in deferred objects.

Checked: no Apple material, no gates.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 25, 2026 00:00

Superseded by the review at 2dedb1a

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Nov 25, 2026
An uncached pool object is kept mapped after its drop until the
firmware has met control_fence(). A queue created and closed without
submitting publishes no control record, so that fence does not move.
Once such cycles had filled a family's 64 cache slots with entries
waiting for it (M4 Pro/Max and M5 keep the strict fence), every further
create/close left another 32-48 KiB work state (and M5 scheduler page)
and its upper UAT VA on the deferred list, with no bound: an
unprivileged loop could exhaust the upper VA range for every client.

Defer only an object whose address reached the firmware. A context
attaches one object::Exposure to its work state and its M5 scheduler
page (PooledObject::defer_once_exposed) and sets it wherever those
addresses can reach the firmware: the work-storage accessors that
already mark the A18 Pro work state (work_head_va, a command's
node_va), scheduler_va(), the only reader of the scheduler page's
address, and publication. An uncached object whose exposure is still
unset is named by nothing the firmware reads and is unmapped at its
drop; one without an exposure (every other pooled object) keeps waiting
for the fence. The capacity file counts the immediate drops
(uncached_objects_fenced ... unexposed_freed=).

g17-object-fence-tests gains a create/close loop: with the work-state
family full of exposed objects waiting for their fence, 4096 contexts
created and closed without work each get an uncached work state that is
unmapped at once, the deferred list stays empty and no reservation is
left; one exposed by a queue record or a command still waits and is
unmapped once the fence is met. Source rules pin scheduler_va() as the
only reader of the scheduler page address, and the exposures. New
mutations defer-unexposed (the previous behaviour) and unexposed-head
fail it.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide requested review from a team as code owners November 27, 2026 14:35
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr, I've pushed a fix for your blocker using the design you preferred: only objects that were exposed to firmware are deferred. The branch is forward-merged onto main fca33ed6, which is after the #3302 revert. New head: 77229d88. Please re-review.

Blocker: unbounded inner.deferred growth from queues created and closed without submitting

77229d88 adds a per-object exposure flag:

  • g17/object.rs:606 adds object::Exposure, an AtomicBool that the owner sets with expose().
  • PooledObject::defer_once_exposed() (object.rs:731) attaches it to an object.
  • On drop, an unpooled object goes to Pool::defer_object(object, exposure) (object.rs:759, :1006-1018). If the object carries an exposure that is still unset, nothing the firmware reads names it. It is then unmapped at once, its list reservation is given back, and it is never pushed onto inner.deferred.
  • An object without an exposure keeps waiting for the fence as before. That covers every other pooled object: physical queue descriptors and configs, and render queue state. Unpublished create/close churn cannot reach those.

Where the flag is set (g17/context.rs):

  • Each context makes one Exposure (:295). It attaches it to its work state (:338) and to its M5 scheduler page (:305).
  • expose_work() sets it (:573). Those are the accessors that already mark the A18 Pro work state: work_head_va() for queue records and a command's node_va().
  • scheduler_va() sets it (:493). That function is the only reader of the scheduler page's address, and every caller can hand it to firmware (queue records/config, QoS, ContextKill, scheduler release).
  • mark_published() sets it as well (:639), as a backstop.
  • Comparisons that use work_head_address() do not set it.

On the 64 cache slots: on M4/M5 a cached work state still returns with the strict fence (unchanged), so those slots can still fill with waiting entries. That is bounded by POOL_SLOTS. After that, each unexposed context's unpooled objects are freed at drop, so the create/close loop no longer pins memory or upper VA.

The capacity file now counts the immediate drops: uncached_objects_fenced waiting= bytes= unexposed_freed= (object.rs:1157). That is the counter the hardware row should read.

Tests (tools/asahi/g17-object-fence-tests.py)

  • New context::create_close_loop (:878), on both after_release settings:
    • fill the WorkState family with 64 contexts whose queue record exposed their work state and that nothing released;
    • run 4096 create/close cycles without work. Each context gets an uncached work state that is unmapped at its drop, and afterwards the deferred list holds waiting=0 bytes=0, unexposed_freed=4096, deferred_reserved == 0;
    • an uncached work state exposed by a queue record (work_head_va), and one exposed by a command (node_va), each stay mapped (waiting=2). Both are unmapped by the next allocation once the fence is met.
  • Source rules: scheduler_va() is the only scheduler.gpu_va() reader in context.rs and exposes. expose_work() and mark_published() expose. Both pooled context objects are attached. No scheduler_owner()...gpu_va read exists anywhere in the driver.
  • g17-object-fence-tests.py: all scenarios pass, including the 24-trace differential (48940 allocations, 0 overruns), 24 random models, accessors and create_close_loop.
  • run-host-tests.py (GIT_NO_LAZY_FETCH=1): 732/732 in 113 s; --only g17 236/236.
  • KUnit (kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig): Ran 494 tests: passed 490, skipped 4.
  • Fleet config (LLVM=1): prepare and drivers/gpu/drm/asahi/ build. There are 17 warnings, all already on main, and none in object.rs or context.rs.

Mutants (each must fail; all 14 do):

  • defer-unexposed: the fix reverted, every uncached object deferred. Fails at "round 0: an unexposed work state waits for a fence".
  • unexposed-head: expose_work() does not set the flag. Fails at "an exposed uncached work state was unmapped before its fence".
  • The 12 existing ones still fail: overrun-full-family, unmap-uncached (re-pointed at the new call), reap-early, stop-keeps-deferred, unseen-strict, retain-not-sticky, node-unmarked, no-release, m5-cached-nodes, m5-cached-descriptors, cached-queue-records, uncached-g17p-nodes.

Both new mutants are registered in run-host-tests.py.

Merge note: main's #3186/#3065 renamed "uncached" to "unpooled" in the allocate() doc and added prefix == 0. The conflict in that doc and in the run-host-tests.py mutation list was resolved to keep both sides. overrun-work-states stays dropped, as this PR intends.

Your non-blocking notes (no reap on observe_control(), the waiting= count including met-but-unreaped entries, the O(N²) reap scan) are not changed here.

Rows owed at 77229d8: M5 (queue create-close loop, no deferred growth: uncached_objects_fenced waiting= flat, unexposed_freed= rising) from @DjDeveloperr or an M5 owner; M4 Pro (J616s) no-change row by FIXUP-A.

Tested: g17-object-fence-tests (create_close_loop 4096 cycles, waiting=0) and 14/14 mutants killed; run-host-tests 732/732; KUnit asahi 490/494 (4 skip); fleet-config asahi build OK.
Risk: G17 pool (M4 Pro/Max, M5, A18 Pro). Only context work states and M5 scheduler pages that went unpooled change: if their address never reached firmware they are now freed at drop instead of waiting for the control fence. A missed exposure site would free an object early; the source rules pin the address readers.

@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) labels Nov 27, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

M4 Pro (T6040, J616s) row at this head (77229d8). The kernel was the combined fixa5 test kernel, linux main fca33ed plus the heads of #2887 #2959 #3384 #2919 #2393 #2895. g17/context.rs, g17/object.rs and tools/asahi/g17-object-fence-tests.py are byte-identical to this head. run-host-tests.py also carries the other PRs' registrations, and nothing else differs from this head there. One-shot BLS entry, default command line.

No-change smoke:

  • 0 failed units, Enforcing, 0 AVC denials, 0 oopses, 0 err-level kernel lines.
  • eDP connected, Wi-Fi up, aurora bound. s2idle x1 (rtc1) rc=0 with network and NVMe fine after.
  • dEQP-VK api.smoke.* 8/8 and draw.renderpass.simple_draw.* 4/4. glmark2 off-screen 22375. gpubench quick set rc=0.
  • 0 GPU fault/timeout/crash/recover lines.

Pool churn. These are the qpair waves from the Neo row (traces/gpu/20261123-g17-pool-fence-118), run locally. Each qpair process is one Vulkan device and queue, doing a render pass plus a compute dispatch per submit, with every result checked on the host.

  • Wave A: 40 processes open at once, then 10..400 submits each.
  • Wave B: 15 more started 0.4 s apart. Wave C: 40 short-lived ones (1..3 submits).
  • Then 300 serial create/close cycles (one device at a time, 1 submit each) and a flush device.
  • The deferred-list line was sampled every 50 ms (3850 samples).
capacity read fam 0/1/2/3 used (of 64) overruns uncached cached fenced waiting uncached_objects_fenced
before 6/6/3/6 0 0 3 waiting=0 bytes=0 unexposed_freed=0
wave A open (37 queues) 55/39/38/54 0 0 0 waiting=0 bytes=0 unexposed_freed=0
after waves + flush 57/39/38/54 0 0 3 waiting=0 bytes=0 unexposed_freed=0
after 300 create/close 57/39/38/54 0 0 4 waiting=0 bytes=0 unexposed_freed=0
final flush 57/39/38/54 0 0 0 waiting=0 bytes=0 unexposed_freed=0
  • Results: 92 wave processes and 300 loop processes, 0 result errors.
  • Deferred waiting was 0 in all 3850 samples, and the deferred list did not grow over the 300 create/close cycles.
  • Overruns were 0 in every family. 0 kernel faults, timeouts or crashes.
  • Three wave-A processes (seeds 38-40) got VK_ERROR_OUT_OF_DEVICE_MEMORY on submit. They matched 3 G17 capacity refusal LogicalQueues lines: the 42-logical-queue cap (gnome-shell holds 2) refusing admission, as designed.

On T6040 this workload never fills a family. The peak was 57/64 at the logical-queue cap, so no uncached object was made. The deferred path and unexposed_freed were therefore not exercised: both stayed 0, where the Neo row filled families to 64/64. So this is a no-regression row for T6040: no overrun, no reuse before the fence, no growth, every result correct. It does not exercise deferral on the strict-fence families.

Exercising deferral on T6040 would need a client that holds more pool objects per logical queue, so a family fills below the 42-queue cap.

The J616s was restored to fleet89 and verified: saved entry unchanged, next_entry empty, test kernel removed, Enforcing, 0 failed units.

Evidence (lab store): traces/kernel/20261128-fixa5-rows/j616s/ (B-pool.txt, B-out/pool/ with cap-*.txt, sampler, qpair logs, kmsg). Script: kits/test/20261128-fixa5/pool.sh.

@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 77229d88

Blockers: none (re-run the cancelled pr-text check before landing; 21/21 build/host/KUnit checks green).

Checked:

  • drivers/gpu/drm/asahi/g17/object.rs & context.rs: commit 77229d88 cleanly resolves the prior unbounded inner.deferred growth blocker by deferring uncached pooled objects only once they have actually been exposed to firmware, keeping pre-reserved drop capacity and control-fence lifetime safety intact.
  • Host fence tests (tools/asahi/g17-object-fence-tests.py) and 21/21 CI checks pass; exact-head J616s (M4 Pro / T6040 fixa5) hardware row PASS; MERGEABLE on main.
  • Checked for Apple material, tool attribution, private serials, and gating: clean; human Signed-off-by present.
Evidence
  • Head: 77229d888257 (base: main, mergeable: MERGEABLE, +424/-95 across 4 files).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping @DjDeveloperr: closeout merge at 77229d88. App approved at this head, CI green. Your change request from 2dedb1a1 is addressed with the design you suggested; please dismiss it or say what is still missing. Rows: J616s at this head (fixa5, files byte-identical: smoke, s2idle, dEQP smoke, 392-process pool churn, 0 overruns) and J700 regression in the same kernel. The M5 create/close loop row goes to a known-gap issue. Merging under the 6-point rule 1 h from now unless you object.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at 77229d88. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J616s@fixa5(byte-identical)+J700. (5) There's no blocking review. (6) Dj was pinged here 91 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit feded1d into main Nov 29, 2026
22 of 23 checks passed
@RyanTheTide
RyanTheTide deleted the asahi/g17-pool-fence branch November 29, 2026 02:23
@jgoyvaerts

Copy link
Copy Markdown
Contributor

M4 Pro (T6040, J616s, 25G83 firmware, 16K pages) row, as a backport: 2dedb1a and 77229d8 cherry-picked
onto aurora main a851ca0 plus our local G17 patches (kernel tree 5935d22f2e92).

Load: a GPU recovery storm (3 passes, 87 hang cases, 493 recoveries in 16.5 min) next to a running desktop.

  • Pooled objects: 0 reuse-before-fence overruns and 0 uncached objects in every pool family, in every capture
    (cached_objects_fenced 0/0, uncached_objects_fenced waiting=0). The work-state family peaked at 56 of 64.
  • Our previous kernel on the same base, without the backport (and without a few later local changes), under the same load: 195 overruns and 388 uncached objects in the work-state
    family, and a firmware crash 4 minutes in (agx_scheduler, NULL+0x8 read).
  • With the backport: no firmware crash in all 3 passes.

One run, so the crash result is evidence, not proof, and the tree also carries other local changes on the kill path,
so it does not pin the crash on this PR alone. The overrun and uncached counts are this PR's.

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) changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants