Skip to content

drm/asahi: g17: allocate compute objects in SUBMIT, not at publication - #3704

Open
jgoyvaerts wants to merge 13 commits into
aurora-silicon:mainfrom
jgoyvaerts:m4pro/g17-compute-reserve
Open

jgoyvaerts wants to merge 13 commits into
aurora-silicon:mainfrom
jgoyvaerts:m4pro/g17-compute-reserve

Conversation

@jgoyvaerts

@jgoyvaerts jgoyvaerts commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What: Stacked on #3683; review only the top three commits. On G17, compute publication no longer allocates. A compute SUBMIT allocates what its publication would need, and a refusal is that SUBMIT's ENOMEM or ENOSPC, before the command is queued. Before, a refusal at publication (the scheduler's kworker, after SUBMIT returned) failed the job, and the client lost its device.

  • Commit 1: a compute queue's objects are allocated apart from the QID they are bound to; binding them only stores.
  • Commit 2: G17P's shared compute aperture and scheduler are allocated in SUBMIT and installed at publication.
  • Commit 3: each logical queue (owner) keeps a reserve of compute backing. SUBMIT provisions it: the pool pages and descriptor ring are charged to the client, and the kit is device memory. Publication takes from the reserve. Backing a queue gives back returns to its owner until the owner closes.

Tested: no Mac at this head yet (176d2fe, which merges #3683's head cf1d0db and with it main at 49424e0). KUnit (arm64 qemu) at 176d2fe: 1127 run, 1126 passed, 1 skipped, 0 failed. Host tests at 176d2fe: --only g17 449 of 449 pass; --only asahi- 22 of 23 (asahi-m4's test-stream-gate fails to link on this host, __stack_chk_guard, as before the merge). Earlier, at 9757985 (main at d0684a0): KUnit 1120 run, 1119 passed, 1 skipped; host --only g17 435 of 435. Earlier, at e005b68 (main at 9b8e29f): KUnit 1065 run, 1064 passed, 1 skipped; host --only g17- 396 of 396. Before the merge: A partial hardware run on an M4 Pro (J616s) at 2c8dfe7, before the two newest commits: see Evidence. KUnit (arm64 qemu) at 2c8dfe7: with CONFIG_MEMCG=y 955 run, 954 passed, 1 skipped, 0 failed; g17-compute-reserve host test and its 8 mutations pass. 2c8dfe7 differs from c769558 only in building Spares::is_empty and take_all for KUnit alone (a non-KUnit build warned they were unused); at c769558, with drivers/gpu/drm/asahi/.kunitconfig (no memory cgroups) 521 run, 517 passed, 4 skipped. Host tests at 9a9efbe (this head but for one KUnit assertion): 845 runs pass; the 29 that fail also fail at #3683's head (apple-dcp, test-m3-uapi, g15-pb-growth x2, g15-retention --mutations, g15-stats-drain x2, sep-suspend-errors x22). Hardware, backport (partial for this PR): M4 Pro (J616s), TEST kernel m4.235 = m4/private-232 + T142t-w: #4348 3ad4260 and #3976 b83c328 / 5b9b151 / 2529bca picked -x onto the private line, which already carries #3704's and #3683's commits as earlier backports (T142 series); hwrow7, 12-04 23:57-23:59 UTC, a capped dEQP-VK load (timeline-cases -j8 beside a compute-q4 -j2 loop, cage MemoryMax 25.8 GB, swap 0): PASS: 0 failures of any client outside the cage (a guard stopped the run at the first one; none came), 2298 SUBMIT refusals (ENOSPC), 0 lost devices, 0 render pool vacant at publication, 0 recoveries, root-only shmem 0.54-1.80 GiB (13.95 GiB on m4.228 before #3976), cage peak 11.6 GiB; 42 fresh surfaceless GL clients (Mesa I62 = mesa#1647) refused at their first SUBMIT with 0 resets. This is a backport row, not a row at this PR's exact head. Its compute side ran 9 compute-q4 passes at -j2 with compute provisioned at SUBMIT and 0 lost devices; the cage stayed below its limit (11.6 of 25.8 GB), so the reserve at the cgroup limit is still to run.

Risk: two-way door · M4 and M5 (G17). Every Mac running the driver: compute publication paths change. A compute owner that has commands keeps its backing, at least 23 MiB of pool pages on G17P, while they are pending. Idle owners hold what they held before.

Not yet:

  • Hardware: a full-length memory-capped (MemoryMax) compute-heavy run at this head, at the cgroup limit, with 0 lost devices reported from compute publication and SUBMIT refusals observed (the run above is partial).
  • Separate work, stage 3e: the small kernel allocations at publication stay: the queue's lists, its box and its client views (page tables). They are GFP_KERNEL and not memcg-charged, so a cgroup limit cannot refuse them. Stage 3e's lockdep annotation will show them.
  • Separate work, stages 3b-3c: render pairs, rings, generations, tiler heaps and render timestamps are still built at publication; the vacated render pool is re-armed at SUBMIT in drm/asahi: g17: re-arm a vacated render pool at SUBMIT, not at publication #3976 (3b), and the LowerVa placements are 3c.
Details

Where compute publication allocated (main), and where it moved:

Object Before Now
Pool pages (Pages::for_compute), descriptor ring publication: rearm_vacant, build_compute, try_add_compute_sibling, grow_compute SUBMIT, Backend::provision_backing, charged to the client
Pool control/state, kick ring, graph objects (compute::Kit) publication: PoolBacking::new, Backing::new, Queue::new SUBMIT, device memory (an installed queue outlives its owner)
ComputeShared (22 MiB on G17P), ComputeScheduler first compute publication SUBMIT, device memory, installed at publication as before

QID split (commit 1). Only stores depend on the QID: the pool control header's buffer slot (ComputePool::bind), the kick ring's id (kick::Queue::compute), and the owner's queue record (Graph::new). Kit::new allocates without a QID.

Device memory. Objects that outlive the client that caused them (the kit, the shared aperture and scheduler) are allocated in the client's ioctl. So that their pages are not charged to that client's memory cgroup, they are allocated under memacct::device_memory, which makes the root cgroup the active one. That matches what happened when the kworker allocated them.

The reserve (commit 3).

  • Provision: Registry::compute_lacks checks whether the owner's spares, or the queues holding its backing (also while they give it back), have pages that fit the command and a ring. If not, SUBMIT allocates them. An owner without a queue of its own also gets a kit.
  • Take: publication takes from the reserve. A fresh queue is built and installed in one device-mutex section, from the kit and the set.
  • Return: a queue records whose backing it holds (backing_owner). When it gives the backing back, the pages and ring return to that owner's spares, reset and cleared, while the owner has compute commands. A backing comes back from:
    • a pool release the firmware consumed;
    • the smaller pages after a pool grows;
    • a recycled ring;
    • a never-published queue's rollback.
  • Other owners: another open owner's backing is never bound. A queue that holds it is given back first, as a queue holding another VM's pool is.
  • Claims: each compute command holds a claim on its owner, from before its SUBMIT provisions until the command is dropped. Without claims an owner is idle: what its queues give back is freed, and the pool pass frees its spares. So an idle owner holds what it held before, and close frees the rest.
  • Siblings (M5): best effort, as before. A sibling that finds no spares asks the next SUBMIT for a set.

No deadlock: why a publication waiting for its backing always gets it.

  1. The command's SUBMIT made sure a set that fits exists among the owner's spares or the queues holding the owner's backing. The command's claim keeps that set from being freed until the command is dropped, and only the owner's own publications take from its spares.
  2. Owner publications run one at a time: run_job is serial per scheduler, and an early publication happens only without a backlog. So no earlier publication of the same owner holds the set at the same time.
  3. That leaves four places the set can be:
    • in the owner's spares: taken at once;
    • in a queue the owner holds: rebind binds it (Rebind::Done), or growth takes the queue's pages after draining its siblings;
    • in an idle queue that holds the owner's backing: bind_reusable binds it, or growth asks the queue to give it back (recall_backing);
    • in a queue that was taken from the owner or is giving it back: its release is published by the event pass (vacate_idle_pools forces queues marked for fresh backing).
  4. A release is consumed by the firmware's control ring. That does not depend on any client's fences. The event pass that observes the consumed release gives the set back (keep_backing) and wakes channel and progress waiters.
  5. The waiting publication holds no device mutex or preparation lease while it waits (wait_channels, wait_release).

So the wait does not depend on its own client: not on a fence the client waits for, nor on a later SUBMIT. A kill or a cancel ends it through the admission check. During recovery, the admission is extended as for every other publication wait. The 30 s admission deadline still bounds it, as it bounds every publication wait.

Evidence
  • Hardware, backport (hwrow7, partial for this PR): M4 Pro (J616s), TEST kernel m4.235 = m4/private-232 + T142t-w: drm/asahi: g17: give each render pool its own window of lower VA #4348 3ad4260 and drm/asahi: g17: re-arm a vacated render pool at SUBMIT, not at publication #3976 b83c328 / 5b9b151 / 2529bca picked -x onto the private line, which already carries drm/asahi: g17: allocate compute objects in SUBMIT, not at publication #3704's and drm/asahi: g17: charge a client's queue context to that client #3683's commits as earlier backports (T142 series); hwrow7, 12-04 23:57-23:59 UTC, a capped dEQP-VK load (timeline-cases -j8 beside a compute-q4 -j2 loop, cage MemoryMax 25.8 GB, swap 0): PASS: 0 failures of any client outside the cage (a guard stopped the run at the first one; none came), 2298 SUBMIT refusals (ENOSPC), 0 lost devices, 0 render pool vacant at publication, 0 recoveries, root-only shmem 0.54-1.80 GiB (13.95 GiB on m4.228 before drm/asahi: g17: re-arm a vacated render pool at SUBMIT, not at publication #3976), cage peak 11.6 GiB; 42 fresh surfaceless GL clients (Mesa I62 = mesa#1647) refused at their first SUBMIT with 0 resets. This is a backport row, not a row at this PR's exact head.

  • KUnit asahi_g17_compute_reserve (4 cases): spares move without being freed; the smallest fitting pages are taken; a full owner frees only covered pages; each spare is freed once.

  • KUnit asahi_memacct: device_memory_is_charged_to_the_root_cgroup.

  • Host tests, red at drm/asahi: g17: charge a client's queue context to that client #3683's head and green here, each with mutations that inject the fault and must be caught:

    • g17-compute-reserve-tests:

      • bind steps and the publication paths allocate no device memory;
      • SUBMIT charges pages and ring, and allocates the kit as device memory;
      • the claim precedes the provision, and the command is queued after it;
      • every give-back keeps the backing for its owner, and close and the pool pass free spares;
      • another open owner's backing is never bound;
      • compiled: the production keep_backing, stock and trim_reserves free every spare exactly once, also when the owner closes with its reserve unused.

      Mutations: 7.

    • g17-compute-constructor-tests: SUBMIT prepares the shared objects once as device memory, and a refusal fails it. Publication never builds them, and keeps them on cancel, a stale lease or a crash. Mutations: 3.

    • g17-admission-order-tests: every valid compute SUBMIT provisions, and a refusal fails it.

    • g17-queue-object-charge-tests: exactly QUEUE_CREATE's context and SUBMIT's compute backing name the client. Mutations: 2 new.

  • Fixtures updated for the changed functions: the g17 compute growth, retired, growth, uninstalled cleanup, M5 sibling compute, gate and rearm, object fence and render fast-done tests.

  • Hardware, partial (containment and a clean run; the reserve under memory pressure did not run): M4 Pro (J616s), the commits up to 2c8dfe7 backported onto a test kernel (not da65b3f or 936c70c), 2026-12-02. dEQP-VK timeline-semaphore cases at 10 jobs with the system Borealis, in a MemoryMax cgroup of 12.99 GB without swap. The cgroup reached its limit 2.5 s in and stayed there about 10 s, until a memcg OOM kill. The kill came from an ordinary GFP_NOFS allocation, and its victim was a deqp-vk with 1.89 GB shmem-rss. systemd then stopped the run, 13 s in. The compute list never started, and no SUBMIT was refused.

    • GPU memory stayed in the cgroup: the OOM report's memory.stat shows shmem 11.78 GB of the 12.69 GB limit. Shmem of every other cgroup stayed at its starting 3.8 GB.
    • 0 GPU recoveries, 0 "GPU work of a client failed", 0 refused submits, 0 allocation failures, 0 warnings.
    • System Shmem was back to its starting level within about 1.6 s of the kill.

The firmware objects of a G17 client's queues were kernel memory: counted
towards the device total (kernel_resident in gpu_memory) but owned by no
client, and owned by no memory cgroup when a kernel thread populated them.
Under a dq-fast timeline-cases load on an M4 Pro, kernel_resident peaked
at 2.4 GB.

This charges the objects that QUEUE_CREATE builds, the context's scheduler
storage and work state, to the client that creates the queue:
- **Driver accounting:** they count as the client's held memory (fdinfo
  drm-resident-system, its limits) instead of kernel memory.
- **Memory cgroup:** their pages are charged to the client's memory
  cgroup. That is the cgroup of the task that opened the DRM file, made
  the active memory cgroup while the pages are populated.
- **Failure:** QUEUE_CREATE builds them in the client's ioctl, so a
  failed allocation comes back from it as ENOMEM, which Borealis reports
  as VK_ERROR_OUT_OF_HOST_MEMORY.
- **Lifetime:** the charge belongs to the object. It is released when the
  object is freed, also after the client's file is gone while the
  firmware still holds the object.

The rest of a queue's objects stay uncharged, as before: render pairs,
kick rings, generations, tiler heaps, compute state and timestamps. G17
builds them when a submission is published, after SUBMIT accepted it. A
memory cgroup at its limit would fail them there, and a failure there
costs the client its device: a test kernel with all of them charged lost
4 devices with ENOMEM when its cgroup filled.
- They are charged once they are built in QUEUE_CREATE or SUBMIT.
- The Allocator now names its client: QUEUE_CREATE's names it, the
  publication paths say None.
- `KernelObject::queue_backing()` and `Allocator::backing()`/`object()`
  are the way in for both.

Device-global objects stay uncharged kernel memory: the boot-time firmware
structures and heaps (initdata.rs, initdata/m5.rs), the crash buffer, the
PM metrics and the M5 metrics in mod.rs, and the shared compute pool.

Tests:
- **KUnit:** a queue charge is taken past both limits, counts against the
  client's and the device's next objects, outlives the client's file and
  is released once with its object. A memory-cgroup scope restores what
  it replaced.
- **Host test** (g17-queue-object-charge-tests.py):
  - only QUEUE_CREATE's Allocator names a client, and every other one
    says None;
  - uncharged kernel objects appear only in the global boot files and in
    the three publication files that build objects outside an Allocator
    (buffer.rs, buffer/target.rs, completion.rs);
  - three injected faults are caught.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
A fresh G17 compute queue was built for the QID publication reserves: the
pool's control header names the QID's pool slot, and the kick ring carries
the QID. So its objects could only be allocated once the QID was known, at
publication, after SUBMIT accepted the job.

Only stores depend on the QID. Split construction in two:
- **Allocate:** `compute::Kit::new` allocates the pool's control and state
  (`freelist::PoolObjects`), the kick ring storage (`kick::ComputeRing`) and
  the graph's objects (`GraphObjects`), with no QID. The pool pages and the
  descriptor ring are allocated as before.
- **Bind:** `compute::Queue::new_channel(kit, pages, ring, id, ...)` binds
  them to the QID: `ComputePool::bind` writes the control header,
  `kick::Queue::compute` keeps the id and `Graph::new` writes the owner's
  queue record. No device memory is allocated.

Publication still calls both, in the same order of effects: the pool's row
is installed before the queue is built. A later change allocates in SUBMIT.

tools/asahi/g17-compute-reserve-tests.py checks that the bind steps allocate
nothing, with two mutations that inject an allocation.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
G17P's device-wide compute aperture (ComputeShared, 22 blocks of 1 MiB plus
its lists) and compute scheduler were built by the first compute
publication that needed them, on the scheduler's kworker, after SUBMIT had
accepted the job. A refused allocation there failed the job, and the
client lost its device.

A compute SUBMIT now allocates them while they are neither installed nor
prepared (`Backend::provision_compute`, from `ensure_compute`). A refusal is
that SUBMIT's error. The publication that needs them takes the prepared
object and installs it, as before; it allocates nothing, so its builder
flags, the waits for another builder and the condition variable they
waited on go. Installation keeps its timing:
the aperture with the first publication's lease, the scheduler with the
first fresh queue's pool row.

Both stay device memory: they serve every client until processor stop.
Allocated in a client's ioctl, their pages would be charged to that
client's memory cgroup, so `memacct::device_memory` charges them to the
root cgroup, as when the kworker allocated them.

M5 has neither and allocates nothing.

Tests:
- g17-compute-constructor-tests now runs the production SUBMIT and
  publication halves (prepared once, a refusal fails the SUBMIT and
  prepares nothing, publication never builds and keeps the prepared
  object on cancel, a stale lease or a crash) with three mutations.
- g17-admission-order-tests checks that every valid compute SUBMIT
  provisions and that a refusal fails it.
- g17-m5-render-fast-done-tests checks that note_changed wakes render
  waiters only.
- KUnit asahi_memacct: device_memory_is_charged_to_the_root_cgroup.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@jgoyvaerts
jgoyvaerts force-pushed the m4pro/g17-compute-reserve branch from 9a9efbe to c769558 Compare November 30, 2026 18:58
A G17 compute queue's backing (the pool pages, at least 23 MiB on G17P,
and the descriptor ring) and a fresh queue's kit were allocated when a
command was published, on the scheduler's kworker, after SUBMIT had
accepted it. A refusal there failed the job, and the client lost its
device. With the backing charged to the client's memory cgroup, a client
at its cgroup limit lost it that way.

Each logical queue (owner) now has a reserve of compute backing:
- **SUBMIT provisions.** A compute SUBMIT allocates what its publication
  would lack (`Backend::provision_backing`): pages that fit the command
  and a ring, unless the owner's spares or the queues holding its backing
  have them, and a kit while the owner has no queue of its own. Pages and
  ring are charged to the client through its
  Allocator; the kit is device memory (`memacct::device_memory`), since an
  installed queue outlives the owner. A refusal is that SUBMIT's ENOMEM or
  ENOSPC, before the command is queued.
- **Publication takes.** Re-arming a vacant queue, building a fresh one
  (now in one device-mutex section with its install), growing a pool and
  adding an M5 sibling take from the owner's spares and allocate no device
  memory. A sibling that finds none asks the next SUBMIT for a set.
- **Backing is the owner's until it closes.** A queue records whose
  backing it holds. When it gives the backing back (a pool release the
  firmware consumed, a grown pool's smaller pages, a recycled ring, a
  never-published queue's rollback), the pages and ring go back to that
  owner's spares, reset, while the owner has compute commands. Another
  open owner's backing is never bound: a queue holding it is given back
  first, as another VM's is.
- **Claims.** Each compute command holds a claim on its owner from before
  its SUBMIT provisions until the command is dropped. An owner without
  claims is idle: what its queues give back is freed, and the pool pass
  frees its spares, so idle memory is what it was. Close frees the rest.

A publication whose backing is on its way back waits as it waits for a
channel today, and the event pass that observes the consumed release
returns the backing and wakes it. That release is published by the pool
pass and consumed by the firmware, whatever the waiting client does.

Tests:
- KUnit asahi_g17_compute_reserve: spares move without being freed, the
  smallest fitting pages are taken, a full owner frees only covered pages,
  and each spare is freed once.
- g17-compute-reserve-tests: publication paths allocate nothing; SUBMIT
  charges pages and ring and allocates the kit as device memory; the claim
  precedes it and the command is queued after; every give-back keeps the
  backing for its owner; the production keep_backing, stock and
  trim_reserves free every spare exactly once; a queue-less owner always
  gets a kit. Six more mutations.
- g17-queue-object-charge-tests: SUBMIT's compute backing is the second
  allocator that names the client; two more mutations.
- Fixture updates for the changed functions in the g17 compute, growth,
  sibling and cleanup tests.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@jgoyvaerts
jgoyvaerts force-pushed the m4pro/g17-compute-reserve branch from c769558 to 2c8dfe7 Compare November 30, 2026 21:05
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Fixed compute backing ownership, channel rollback and concurrent shared-aperture allocation in 936c70c.

Main at 9b8e29f. Conflicts resolved keeping both sides:
- Makefile: main's object list (g17/mesh_exclusion.o is gone) plus memcg_scope.o.
- queue/compute.rs: main's new protections for the queue objects (records firmware-only, the lower-VA context and operand GPU+FW, the M5 timestamps) applied where this branch allocates them, GraphObjects::allocate(); main's removal of install_job_context_aliases() applied to map_binding(); main's pending_failed allocated before the pool row is installed.
- runtime.rs: the compute growth path keeps main's unbound exit (no primary queue: EAGAIN, rebound by build_compute) around this branch's provisioned pages; DeferredBatch::is_idle() is main's pub(super) form with the object_pool check.
- job.rs, queue/mod.rs: Packet takes main's batch_renders and producers and this branch's compute claim.
- context.rs: both main's render_active helpers and compute_claimed().
- object.rs: main made a retained object's fence optional (None: kept until firmware stop); the reap of charged objects uses Retained::ready().
- g17-object-fence-tests: main() runs both client_pool_retirement() and cached_queue_lifetimes(); main's new test builds its Allocator with client: None.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 4, 2026
Main at 9b8e29f. Conflicts resolved keeping both sides:
- Makefile: main's object list (g17/mesh_exclusion.o is gone) plus memcg_scope.o.
- As in the merge of main into aurora-silicon#3704's branch for queue/compute.rs, runtime.rs, job.rs, queue/mod.rs and context.rs.
- object.rs: main made a retained object's fence optional (None: kept until firmware stop); the reap of charged objects uses Retained::ready().
- g17-object-fence-tests: main() runs both client_pool_retirement() and cached_queue_lifetimes(); main's new test builds its Allocator with client: None.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Conflicts resolved as the union:
- Makefile: keep this branch's memcg_scope.o; drop g17/mesh_exclusion.o
  as main's b01db93 did;
- g17/runtime.rs: is_idle() takes main's pub(super) from dc93841
  and keeps this branch's object_pool check, so a batch that still holds
  a client's object pool is not idle;
- g17-object-fence-tests.py: run both this branch's
  client_pool_retirement() and main's cached_queue_lifetimes() from
  6d632d4, whose harness allocator now names no client
  (client: None), like the branch's other uncharged callers.

Main's 6d632d4 also makes a pool entry's fence optional: a cached
queue record (prefix != 0) waits for firmware stop. reap_deferred() now
retires a client-charged entry through main's Retained::ready(), so such
a record stays mapped until firmware stop as main requires, and an entry
with a fence is retired once the firmware has met it, as before.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@jgoyvaerts
jgoyvaerts marked this pull request as ready for review December 4, 2026 03:39
@jgoyvaerts
jgoyvaerts requested review from a team and DjDeveloperr as code owners December 4, 2026 03:39
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merge readiness at 176d2fec: not ready yet

Check Detail
CI at head ok 10 checks passed
Review no needs one approving review from Core, Omarchy Mac or Aurora Maintainers (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 176d2fec, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · M4 and M5 (G17). Every Mac running the driver: compute publication paths change. A compute owner that has commands keeps its backing, at least 23 MiB of pool pages on G17P, while they are pending. Idle owners hold what they held before.

Areas: area:gpu

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

DjDeveloperr
DjDeveloperr previously approved these changes Dec 4, 2026

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

Approving the code at e005b68b1d46. I'll merge after the J714s and J700 rows pass at this head.

What I read: everything this merges into main. Because #3683 is still a draft, that includes its two commits (2dc7fb52d56d, da65b3f1562c), plus the four commits here and the main merge.

  • 7ff8f5a44062 only moves the allocations ahead of the QID reservation. Binding to the QID is stores only.
  • The reserve in 2c8dfe7aa8ac matches the description:
    • The claim is taken before ensure_compute() provisions the backing.
    • keep_backing() only keeps backing while the owner still holds a claim.
    • close_reserve() untags the owner's queues and frees its spares after the device mutex is dropped.
    • An owner that gets no reserve slot fails its SUBMIT with ENOSPC. It never queues a command that has no backing.
  • The main merge in e005b68b1d46 resolves all 7 files correctly:
    • The Makefile drops mesh_exclusion.o, as main did.
    • GraphObjects takes main's lower and FW-shared timestamp protections.
    • Dropping install_job_context_aliases() matches main's 969bbd2.
    • reap_deferred() uses main's entry.ready().

Local checks, on current main 35ddf947 (after #4020 and #4258 landed):

  • This PR and then #3976 merge cleanly (tree 13e3b683; merging #3976 alone gives the same tree).
  • run-host-tests.py --only g17- in the host-tests container: 425/425 pass.
  • Built on main a16156f8, before those two landed: aurora.ko builds, and W=1 of drivers/gpu/drm/asahi adds no warnings (43 on main, 43 here).
  • Hosted CI is green at this head.

For landing:

  • The readiness bot reads "no Mac at this head yet (e005b68...)" in the description as a hardware row. It isn't one. The rows are still owed: J714s (kit with the M5 lead) and J700 (with the Neo lead). Both test the driver of all three PRs on main 35ddf947.
  • Merge order: this PR, then #3976 (clean), then #3956. #3956 conflicts with this PR only in tools/asahi/g17-queue-object-charge-tests.py and run-host-tests.py. The forward merge has to keep both sides' checks: the allocator list {Backend::new, provision_backing}, the client_backing() → charged() check, and all seven mutations.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 4, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s (M5 Pro) row: this head loses the device at boot, so this PR shouldn't merge as it is. I've withdrawn my approval.

Setup. Base and head boot the same kernel, and only aurora.ko differs:

Cause: my commit 936c70c9dbdd in this PR.

  • It replaced self.context.is_m5() with self.shared.variant.compute.needs_shared_aperture() in three places: shared_compute(), provision_shared(), and the scheduler install in the compute publication.
  • The M5 firmware variants inherit compute: ComputeProgram::G17P from V26A428 (V26A428_M5 ends in ..V26A428). So needs_shared_aperture() is true on the M5 too.
  • Each client's first compute publication then calls install_compute_shared(). That fails with ENODEV at self.boot_control.ok_or(ENODEV), because only the G17P InitData graph creates boot_control; build_m5() never does.
  • finish_publication() turns that ENODEV into a lost device.
  • On the J700 and other G17P Macs the old and new tests agree, so only M5 is hit.

Fix: put main's test back in those three places:

     fn shared_compute(&self, admission: &Admission<'_>) -> Result {
-        if !self.shared.variant.compute.needs_shared_aperture() {
+        if self.context.is_m5() {
             return Ok(());
         }
@@
-            if self.shared.variant.compute.needs_shared_aperture() && !firmware.init.has_compute_scheduler() {
+            if !self.context.is_m5() && !firmware.init.has_compute_scheduler() {
@@
     fn provision_shared(&self) -> Result {
-        if !self.shared.variant.compute.needs_shared_aperture() {
+        if self.context.is_m5() {
             return Ok(());
         }

Two notes on the fix:

  • The same commit also stops building the shared aperture on V25F84, which main still builds. Plain is_m5() restores main's behaviour there as well. If V25F84 really doesn't need it, self.context.is_m5() || !...needs_shared_aperture() keeps that, but it then needs its own row.
  • The Layout(bool) fixture in g17-compute-constructor-tests.py follows needs_shared_aperture(), which is why the host tests passed. A case for an M5 variant whose program is G17P would catch this.

The commit is on your branch, so the change is yours to make. If you'd rather I push it, say so. #3976 carries the same commit, so it is held too. #3956 is not involved. I'll re-cut the J714s and J700 rows at the new heads.

@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 4, 2026
@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 4, 2026
@jgoyvaerts
jgoyvaerts marked this pull request as draft December 4, 2026 17:25
@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 4, 2026
@jgoyvaerts
jgoyvaerts marked this pull request as ready for review December 5, 2026 00:03
@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 5, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

@jgoyvaerts This branch now conflicts with main (1da341136110) in:

  • drivers/gpu/drm/asahi/g17/job.rs
  • drivers/gpu/drm/asahi/memacct.rs
  • tools/asahi/g17-m5-sibling-rearm-tests.py
  • tools/asahi/run-host-tests.py

Note: this branch carries #3683's commits (memacct.rs, run-host-tests.py) alongside the compute SUBMIT conflicts.

Could you forward-merge main into this branch (normal git merge, no rebase/force-push)? If you haven't had a chance within 24 hours, a maintainer can forward-merge main on top for you.

Main at f02bd68. Conflicts resolved keeping both sides:
- memacct.rs: main's ledger (reserve() with the reclaimable/unreclaimable split and their
  limits, release(), Commit::reclaimable, and its own private commit()) with this branch's
  commit for a client's queue objects, renamed Ledger::commit_queue() (object.rs calls it):
  they are committed whatever the limits, as before, and now also count as unreclaimable
  (idle reclaim never releases a queue's objects), with reclaimable: false so release() gives
  back both. Tests: main's new ones and this branch's queue-object, root-cgroup
  and charging-scope tests, side by side.
- job.rs: Packet::new() is main's (the command moved in from the queue's pending entry, the
  footprint passed in, shared_inputs) with this branch's compute claim.
- run-host-tests.py: main's idle-reclaim and held-ceiling tests and this branch's
  queue-object charge tests.
- g17-m5-sibling-rearm-tests.py: resolved as in the previous merge (rerere).
- g17-compute-reserve-tests.py: enqueue() borrows the command now (main): the checks and the
  claim-after-provision mutation follow (ensure_compute(command), main's
  entry.command.as_ref() line).

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 5, 2026
Brings aurora-silicon#4348 and aurora-silicon#3704 up to main at f02bd68. Conflicts resolved keeping both sides:
- job.rs: Packet::new() is main's (the command moved in, the footprint passed in,
  shared_inputs) with the compute claim and this branch's render claim.
- queue/mod.rs: enqueue() borrows the command as main does; a render command still takes
  its claim on the armed pool (Backend::claim_render()), then main's query_access.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 5, 2026
Brings aurora-silicon#3704's merge of main at f02bd68. Conflicts resolved keeping both sides:
- g17/capacity.rs: main's M5 render template counters and this branch's lower_band line.
- run-host-tests.py: main's idle-reclaim and held-ceiling tests and this branch's
  g17-lower-window-tests.
- g17-lower-window-tests: its admission check accepts main's Pool::with_waiters_and_depth()
  (any constructor given the variant's queue limit).

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 5, 2026
Main at d0684a0 (includes aurora-silicon#4382). Conflicts resolved keeping both sides:
- runtime.rs: main's 9583ee4 made ComputeShared an identity with no memory behind it
  (nothing of the device-wide compute pool is mapped into client VMs any more). This branch
  keeps building it in the SUBMIT (provision_shared) and only installing it at publication
  (shared_compute); the SUBMIT now calls main's ComputeShared::new() without an allocator.
- g17-compute-constructor-tests.py: this branch's fixture with main's ComputeShared::new();
  the publication-builds mutation follows, and swallow-refusal swallows both the aperture's
  and the scheduler's refusal, as the refusal case needs both.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 5, 2026
Brings aurora-silicon#3704's merge of main at d0684a0 (includes aurora-silicon#4382). No conflicts.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 5, 2026
Brings aurora-silicon#4348 and aurora-silicon#3704 up to main at d0684a0 (includes aurora-silicon#4382). No conflicts.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 5, 2026
Conflicts resolved as the union:
- memacct.rs: main's 5ce50e0 adds the unreclaimable totals and
  limits and a private Ledger::commit(client, bytes, reclaimable) for
  admit()/admit_reclaimable(). This branch's public commit(client,
  bytes), which charges a queue's kernel objects whatever the limits,
  becomes commit_kernel(). Idle reclaim never releases those objects, so
  it now also adds to the unreclaimable totals and returns a Commit with
  reclaimable: false, which main's Commit drop gives back from both. The
  queue-object test checks the unreclaimable total too. Both sides'
  tests stay.
- g17/runtime.rs: main's 9583ee4 builds ComputeShared without
  backing, so it needs no allocator; this branch's uncharged allocator
  there goes.
- run-host-tests.py: both sides' entries stay.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Brings aurora-silicon#3683's merge of main at 49424e0 (cf1d0db), so this branch matches its
base. Conflicts resolved keeping both sides:
- memacct.rs: both merges of main renamed aurora-silicon#3683's commit() for queue objects; aurora-silicon#3683 named it
  commit_kernel(), so this branch takes that name and aurora-silicon#3683's test asserts on the
  unreclaimable total; this branch's device_memory test stays.
- object.rs: queue_backing() calls commit_kernel().
- run-host-tests.py: this branch's g17-queue-object-charge mutations beside main's
  g17-submit-refusal-untouched entry.
- runtime.rs: this branch's shared_compute(), as in its merge of main at d0684a0.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 5, 2026
Brings aurora-silicon#3704's merge of aurora-silicon#3683 (cf1d0db, main at 49424e0). One conflict, in
run-host-tests.py: main's g17-submit-refusal-untouched-tests entry beside this branch's
g17-lower-window-tests, both kept.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
jgoyvaerts added a commit to jgoyvaerts/linux that referenced this pull request Dec 5, 2026
Brings aurora-silicon#4348's merge of aurora-silicon#3704, which brings aurora-silicon#3683 (cf1d0db, main at 49424e0).
No conflicts.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>

This branch has not been deployed

No deployments
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:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants