Repository navigation
drm/asahi: keep timestamp buffers out of the shared firmware range, charge binds to their client, and bound per-file window share - #2531
Conversation
df120a7 to
d92d363
Compare
|
No blockers. What I checked at d92d363. On G17 the only consumer of a bound timestamp buffer is drivers/gpu/drm/asahi/g17/completion.rs:50-66. It goes through Nit: file.rs:1593-1602 checks the 4096 cap only after HW row: the run lists the M5 Ultra only. The Assisted-by: LLM (Claude:Opus 5.5) |
d92d363 to
60e5bda
Compare
|
Thanks, Ryan. The nit is fixed in the second commit, now at 60e5bda: J775D on this head (stacked with #1973 and our other three open drm/asahi PRs on integration/aurora cc14570, 27.0 firmware, default command line; the kernel also carries a local fix for an appledrm boot oops, see #1973):
Rows we can't run: we only have the M5 Ultra, where every bind takes the host path. Could your lab, or a J616s or Neo owner, run this head with the timestamp window filled (bind timestamp buffers until binds land outside it)? The row we need is |
|
Re-review of 60e5bda: No blockers.
The first commit is unchanged since the last review; the second changes only in HW row: the new numbers are from the M5 Ultra, which takes only the host path, on an integration stack with other open PRs and a local appledrm fix. Still needed: J616s or Neo on this head with the 64 MiB window filled, Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist review (§1–§6) on 60e5bdaae4cec3e495996a83d412b5bf8e3ef61b: 0 code, policy, attribution, naming, or CI blockers; holding for §5 hardware proof rows on non-M5 G17 and G13.
Verified against surrounding source:
- §1 No model gating:
Buffer::HostvsBuffer::Firmware(window: true) is selected by whether the buffer fits in the timestamp window (firmware.uat.is_m5()was pre-existing), and the 4096-object cap lives in shareddrivers/gpu/drm/asahi/file.rsacross every GPU family. - §2 / §3 Code & safety verification:
bound_size()(drivers/gpu/drm/asahi/timestamp.rs:16-22) enforces non-empty,UAT_PGMSK-aligned, in-bounds ranges with overflow checks and KUnit coverage (asahi_timestamp_buffer).Buffer::host()(timestamp.rs:72-83) refusesis_vm_private()withEINVAL, maps viaTimestampVmap::new(&bo.gem)->owned_vmap::<0>()(which refuses external/user_memoryBOs atrust/kernel/drm/gem/shmem.rs:261and pins shmem pages viadrm_gem_shmem_vmap_locked), and wraps the buffer incleanup::Deferredsodma_resv_lock-taking drop runs off fence-producer paths. Verifieddrivers/gpu/drm/asahi/mmu/residency.rs:481, 519, 615only walk VM-private BOs (for_each_private_bo), so omittingKernelMappingPinonHostBuffercannot race with idle reclaim or purge.Buffer::timestamp_offset()(timestamp.rs:153-166) checksoffset + 8 <= buffer.size(ERANGE/EOVERFLOW) and returnsbuffer.start + offset;window_va()returnsNoneandfirmware_mapping()/timestamp_mapping()returnErr(EINVAL). Verifieddrivers/gpu/drm/asahi/g17/completion.rs:45-65, 160-188routeswindow_va == Noneexclusively towrite_timestamp().do_gem_bind_object()(drivers/gpu/drm/asahi/file.rs:1595-1609) reserves the XArray slot (1..=4096,GFP_KERNEL_ACCOUNT) beforemap_timestamp_buffer(), so binds past 4096 fail withEBUSYbefore creating any window alias or vmap; failed mapping releases the slot onReservationdrop;resv.fill(obj)?unlocks the XArray before dropping any rejectedStoreError. Verifiedrust/kernel/xarray.rs:321, 558:remove()on an unfilled reservation coercesXA_ZERO_ENTRYtoNULL(ENOENT), and any concurrent race fails cleanly withEBUSY. (cleanup::Deferred::newatcleanup.rs:93still usesGFP_KERNELfor the work item wrapper, which is pre-existing, small, and now bounded by the 4096/file cap — non-blocking.)
- §4 Clean-room & attribution: Both commits (
a9d3d1658565,60e5bdaae4ce) carry human author/committer + humanSigned-off-by(plusReported-by/Suggested-by) and zero AI trailers; PR body includesAssisted-by:. - §6 Naming: Clean.
- CI:
host-testspassed (sole workflow matchingdrivers/gpu/drm/asahi/**).
Holding for §5 hardware proof rows on 60e5bdaae4ce:
Your J775D (M5 Ultra) run covers the host-only path, cap enforcement, KUnit, and render CTS, though on a stacked branch with other open PRs + a local appledrm fix, and M5 Ultra does not exercise the 64 MiB timestamp-window spillover path. Still needed:
- Non-M5 G17 (J616s or Neo) on this head with the 64 MiB timestamp window filled so binds spill into
Buffer::Host:dEQP-VK.query_pool.*timestamp*and a GLGL_TIMESTAMPquery test unchanged before/after, out-of-window binds succeeding with monotonic timestamps, KUnit pass counts, 0 failed units, and 0 new kernel errors. - One G13 Mac (M1/M2) running the same timestamp tests unchanged (covering the shared 4096-cap path), with clean regression counts.
Assisted-by: LLM (Gemini 4 Neon)
|
Thanks, dj. Here is the J775D row on this PR's own base: integration/aurora b21dcc6 plus this PR, and only what the board needs for a GPU, which is #1973 (the J775D GPU node). The baseline is the same kernel without this PR. 27.0 firmware, default command line, read-only root, one boot each.
The two CTS failures are the stage-stamp ordering cases ( On 27.2 firmware, on this branch's merge-base 61295c2, the cap, timestamp-buffer, CTS and GL rows came out the same, with and without this PR. Those kernels also need #1650 and two of our GPU-driver commits that aren't public yet, so the body lists them only as extra evidence, as it does the earlier stacked row. The spill path isn't exercised here. The M5 Ultra has no timestamp window, so all of its timestamp binds take the host-written path, which is what the rows above test. The body now has a "Why this shape" section, and its Testing section leads with this row. On RyanTheTide, could you run the two open rows: this head on your J616s or J700 with the timestamp window held full, and the same timestamp tests on your M1 Pro? We only have the M5 Ultra, which has no window. To hold the window: it is one 64 MiB range per device, so one process that keeps more than 64 MiB of timestamp binds open (for example five 16 MiB buffers bound with Assisted-by: LLM (Claude:Opus 5.5) |
|
Review notes (non-author):
|
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.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 re-review on 60e5bdaae4ce:
What passes
- G17
Buffer::Host& shared object-table cap (file.rs,g17/mod.rs,gem.rs,timestamp.rs): Code correctness, locking,is_vm_private()guard,TimestampVmaplifetime +cleanup::Deferreddrop, and reserving the XArray slot (1..=4096,GFP_KERNEL_ACCOUNT) beforemap_timestamp_buffer()are all sound. - §4 Attribution & §6 Naming: Clean — both commits (
a9d3d1658565,60e5bdaae4ce) carry human author/committer + humanSigned-off-by:only (zero AI commit trailers), and the PR body carriesAssisted-by:. - Clean-base J775D (M5 Ultra) row & live CI: The updated J775D A/B run on
integration/aurora b21dcc633b32 + #1973cleanly covers the M5 host-only path, cap enforcement, Vulkan/GL timestamps, and KUnit; livehost-testsCI is green on60e5bdaae4ce.
Blocking findings
- §1 Cross-generation shared timestamp window protection (per @RyanTheTide's open review note): The 64 MiB shared firmware timestamp window on G13/G14 (
IOVA_KERN_TIMESTAMP_RANGEindrivers/gpu/drm/asahi/gpu.rs:141,1698), G15 (drivers/gpu/drm/asahi/g15/timestamp.rs:27), and M3 (drivers/gpu/drm/asahi/m3/m3_runtime.rs) is still first-come with no per-file byte quota or per-buffer range cap. Even with the 4096-object cap, a single client can exhaust the 64 MiB window with a handful of large binds (e.g., 4 × 16 MiB). Please bound the bytes one file may hold in the firmware timestamp window so G13/G14/G15/M3 receive equivalent protection before merge, and trim the hold-scenario description from "Still to run" in the PR body until that lands. - KUnit coverage:
asahi_timestamp_buffercurrently testsbound_size()only. Please add KUnit coverage for the per-file cap (and window quota / host-buffer bounds where reachable from KUnit). - §5 Hardware proof rows still open: M5 Ultra (
uat.is_m5()) has no 64 MiB timestamp window, so the non-M5 G17 spillover path (J616sorNeospilling intoBuffer::Hostonce the window is full) and aG13(M1/M2) regression row covering the shared cap/quota path still need to be run on the updated head.
Assisted-by: LLM (Gemini 4 Neon)
On M5, and on the other G17 GPUs once the 64 MiB timestamp window is full, GEM_BIND_OBJECT mapped a timestamp buffer into the kernel VM's dynamic range, the range every firmware object (queues, kick rings, render state) is allocated from. The driver never gives the firmware that address: outside the window the host writes every stamp through the buffer's CPU mapping. The mapping only held shared address space, as much as the bound range, for as long as the buffer stayed bound. Give such a buffer only its CPU mapping (timestamp::Buffer::Host), as G16 and G18 keep theirs without a firmware alias. It refuses the same ranges and VM-private objects the alias did. Buffers mapped in the window, and every other GPU family, are unchanged. Share the bound-range check with Buffer::cpu, and the VM-private test with gem::validate_vm_binding, and test the range check in a new asahi_timestamp_buffer KUnit suite. Reported-by: Erik Bourget <erik@ebourget.net> Suggested-by: Erik Bourget <erik@ebourget.net> Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…stay within its memory limit GEM_BIND_OBJECT stores a record in the file's object table for every bind, and the number of records per file was not limited. The record and the timestamp buffer it names are small kernel allocations that no GEM object accounts for, and they were not charged to the client. The buffer's pages and its CPU mapping belong to the object: the shmem helper shares one vmap between every mapping of an object, and the object's size is charged when it is created. Charge every bind the size of what it keeps (the table entry, the buffer record and the buffer's heap records) against the client's and the device's memory limits, through the Ledger::admit() that object creation uses, as a user object of that size would be. A bind past either limit fails with ENOMEM. The charge is held with the bound buffer and given back with its last reference: after the unbind, or when the file is closed, once no command still uses the buffer. To ensure no command can keep a firmware timestamp mapping alive after unbind without also keeping its Bound record (and charge) alive, store the KernelMapping directly in FirmwareBuffer, return a borrowed &mmu::KernelMapping from firmware_mapping() instead of cloning an Arc, and have G13/G14 (fw::job::UserTimestamp), G15 (g15::command/job) and M3 (m3::m3_submit::Destination) retain Arc<timestamp::Bound>, matching G16, G17 and G18. The bind charges and takes its table slot before it maps the buffer, so a refused bind gets no window alias or CPU mapping at all. The record, the buffer and the table's nodes are allocated with GFP_KERNEL_ACCOUNT, so they also count towards the memory cgroup of the task that binds. Also add a host_offset() KUnit case (a_host_stamp_lies_inside_the_bound_range) in asahi_timestamp_buffer alongside the new asahi_bound_object_charge suite. This applies to every GPU family and to every GEM_BIND_OBJECT usage: the table is shared code. Reported-by: Erik Bourget <erik@ebourget.net> Suggested-by: Erik Bourget <erik@ebourget.net> Suggested-by: Ryan Murray <ryan@aurorasilicon.org> Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…dow, so other clients' timestamp binds still fit Every family that aliases timestamp buffers for its firmware does so in one fixed range per device: IOVA_KERN_TIMESTAMP_RANGE on G13/G14, the timestamp arena on G15, TIMESTAMP_RANGE on M3 and the timestamp window on G17 (64 MiB each). Binds from every file share it, and one file could fill it. Every other client's timestamp bind then failed with ENOSPC on G13/G14, G15 and M3, which Mesa reports as out of device memory for a query pool, or fails GL context creation with. Give each file a share of that range: a sixteenth of its size, 4 MiB of a 64 MiB window. Mesa binds one small buffer per GL context, one per timestamped query pool and one debug buffer. A bind takes its range from the file's share before it maps anything, and the share comes back with the buffer's last reference. Past its share a file's buffer may not be mapped in the window: G17 gives it a host-written buffer, as for a full window, and the families whose firmware writes the stamps refuse the bind with ENOSPC, as for a full window. Every other file keeps its own share. Each backend reports its range's size (timestamp_window_size(), 0 for none) and is told whether the buffer may go there, so the policy lives in one place, the bind. G16, G18 and the M5 backend alias nothing and are unchanged, as is G17 on the M5 firmware graph, which has no window. The share is counted in the file's memacct::Client, next to its committed bytes. Reported-by: Erik Bourget <erik@ebourget.net> Suggested-by: Erik Bourget <erik@ebourget.net> Suggested-by: Ryan Murray <ryan@aurorasilicon.org> Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
60e5bda to
13f0a8a
Compare
|
Thanks for the review, @DjDeveloperr and @RyanTheTide. This update rebases onto
Hardware rows still to run on Assisted-by: LLM (Claude:Opus 5.5, Gemini:Neon) |
|
Fresh own-base J775D (Mac Studio, M5 Ultra) A/B hardware row at live head
Assisted-by: LLM (Gemini:Neon) |
Change of approach
This update replaces the earlier 4096-object count cap with two complementary bounds and rebases onto
integration/aurora(c91527272e90):Ledger::admit()that object creation uses, and drops the count. A bind past the client's limit now fails with ENOMEM, as an object creation would. G13/G14, G15 and M3 commands now retainArc<timestamp::Bound>(withfirmware_mapping()returning a borrowed&mmu::KernelMapping), matching G16, G17 and G18, so both the bind charge and the window share below stay held until every referencing command retires.queue_sharecan be considered separately if large query pools hit 4 MiB.The first commit is unchanged.
Problem
On M5, and on the other G17 GPUs once the 64 MiB timestamp window is full,
GEM_BIND_OBJECTmapped a timestamp buffer into the kernel VM's dynamic range, the range every firmware object (queues, kick rings, render state) is allocated from. The driver never gave the firmware that address: outside the window the host writes every stamp through the buffer's CPU mapping. So the mapping only held shared address space for as long as the buffer stayed bound.Across all families, two shared-bind gaps remained:
Why this shape
map_timestamp_buffer(). G13/G14 (gpu.rs), G15 (g15/mod.rs) and M3 (m3/m3_drm.rs) map it into their fixed 64 MiB firmware timestamp range because their firmware writes the stamps. G16 and G18 keep only a CPU mapping (Buffer::cpu), because the host writes them. The separate M5 backend (m5/, T8142) refuses timestamp buffers (ENOTSUPP), so only the bind's charge below is new there. G17 maps into the 64 MiB window when the buffer fits; otherwise, and always on the G17 code's M5 firmware graph (uat.is_m5()), it mapped the buffer into the kernel VM's dynamic range instead, although the host writes those stamps and the firmware is never given that address. The per-file object table infile.rs, which every family shares, accepted any number of binds without charging their records or bounding a file's share of the firmware timestamp window.Ledger::admit()), whose limits come from the machine's RAM; the object's pages and shared shmem CPU mapping remain charged to the object at creation. For the firmware timestamp window, each backend reports its fixed range size viatimestamp_window_size()(0 when none), anddo_gem_bind_object()enforces a single 1/16 per-file share (memacct::Client::take_window()) before callingmap_timestamp_buffer(..., window).Change
timestamp::Buffer::Host), as G16 and G18 keep theirs. It refuses the same ranges and VM-private objects as before. Buffers mapped in the window, and every other GPU family, are unchanged.GEM_BIND_OBJECTcharges the bind's records (BOUND_OBJECT_BYTES: the table entry, theArccount,timestamp::BoundincludingOption<WindowShare>, andtimestamp::Buffer::HEAP_BYTES, computed from the types' sizes — 152 bytes on arm64 in the default all-backends config after storingKernelMappingdirectly inFirmwareBufferwithout a redundant innerArc) throughLedger::admit()before reserving the table slot or mapping anything. A bind past the client's or the device's limit fails with ENOMEM with nothing mapped.Buffer::firmware_mapping()returns a borrowed&mmu::KernelMappingand G13/G14, G15 and M3 commands now retainArc<timestamp::Bound>alongside G16, G17 and G18, so the charge (and any window share below) stays held until every referencing command retires. The records and table nodes are allocated withGFP_KERNEL_ACCOUNT.Gpu::timestamp_window_size()(IOVA_KERN_TIMESTAMP_RANGEon G13/G14,TIMESTAMPS_SIZEon G15,TIMESTAMP_RANGEon M3,TIMESTAMP_WINDOWon non-M5 G17 via a singleFirmware::timestamp_window()helper; 0 on G16, G18, M5 and G17's M5 graph).do_gem_bind_object()reserves the bound range from the file's 1/16 share (memacct::Client::take_window(), 4 MiB of a 64 MiB window) before mapping and passeswindow: booltomap_timestamp_buffer(). Past a file's share, G17 falls back toBuffer::Hostand G13/G14, G15 and M3 return ENOSPC; any buffer not mapped into the window releases the share immediately. The share is per file, matching the review ask and the existing per-file accounting model; a single-client-full-window policy likequeue_sharecan be considered separately if large query pools hit 4 MiB.This PR does not depend on #2530: it uses the ledger already in the base, not #2530's page-table charge, and the two merge cleanly in either order.
Testing
KUnit and all-backends build on this head (
13f0a8aa2b26, baseintegration/aurora c91527272e90):pr2531-r4k3, built withCONFIG_KUNIT=yandCONFIG_DRM_ASAHI=y, run underkunit-vz): 80 suites; 395 of 397 cases pass, 0 fail, 2 skip (apple_mbox_g17_stall/apple_g17_rx_util_min_test, which needsCONFIG_UCLAMP_TASK, andasahi_fwid/j713_accepts_all_loaded_images).asahi_bound_object_charge: 2 of 2 pass (a_bind_is_charged_its_records_and_refused_past_the_client_limit,a_file_holds_at_most_its_share_of_the_timestamp_window).asahi_timestamp_buffer: 2 of 2 pass (a_bound_range_is_whole_pages_inside_the_object,a_host_stamp_lies_inside_the_bound_range).pr2531-r4m3,CONFIG_DRM_ASAHI=mwith G15, G16, G18, M3_T8122 and M5 all enabled): builds cleanly with 0 new warnings in any touched file; compiledBOUND_OBJECT_BYTESis 152 bytes on arm64.A fresh own-base J775D hardware A/B run on this 3-commit head (
13f0a8aa2b26onintegration/aurora c91527272e90+ #1973) is pending under Still to run.Extra evidence, not this PR's own row (earlier 2-commit head
ce717ff67cceonintegration/aurora 95a13cf618b1+ #1973, kitspr2531-r3andpr2531-r3b, J775D Mac Studio M5 Ultra, 27.0 firmware, Aura maindff1235d, default command line, read-only root; covers commits 1 and 2 prior to addinghost_offset()KUnit and commit 3):pr2531-r3bvspr2531-r3, base95a13cf618b1)ce717ff67cce)GL_TIMESTAMP/GL_TIME_ELAPSED(3 runs of 10 rounds)run-host-tests.py)Regression run on those kits (ALARM has no SELinux, so there is no AVC count): 0 new failed units (
iwd.serviceandsystemd-networkd-persistent-storage.servicefail on the read-only root in both boots) and 0 new kernel error lines; the 8 are the same in both boots.Extra evidence from the first version (commit 1 + the earlier 4096 count cap at
60e5bdaae4ce, baseb21dcc633b32) is in the details below.Still to run
13f0a8aa2b26) onintegration/aurora c91527272e90plus arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973 (the J775D GPU node): bind-charge accounting and ENOMEM refusal at the client limit, timestamp binds, Vulkan/GL timestamp tests, host tests, 0 new failed units and 0 new kernel errors.J616sorNeo) spillover row: verify timestamp binds spilling past a file's 4 MiB window share (and past a full 64 MiB window) ontoBuffer::Host, with Vulkan and GL timestamp queries passing, KUnit pass counts per suite, 0 failed units and 0 new kernel errors.Full description of the three commits
timestamp::Buffer::Host: it keeps a CPU mapping of the bound range and no firmware alias. The host writes its stamps through that mapping (the only consumer is the G17 completion path, which takes object offsets). It refuses the same ranges and VM-private objects the alias did. The bound-range check is shared withBuffer::cpuand the VM-private test withgem::validate_vm_binding;asahi_timestamp_buffertests the range check.GEM_BIND_OBJECTadmitsBOUND_OBJECT_BYTES(the table entry, theArccount,timestamp::Boundandtimestamp::Buffer::HEAP_BYTES, computed from the types' sizes — 152 bytes on arm64 with commit 3'sOption<WindowShare>included) throughmemacct::LEDGER.admit(), then reserves the table slot, then maps the buffer, then fills the slot. The returnedCommitis held intimestamp::Boundnext to the buffer.FirmwareBufferownsmmu::KernelMappingdirectly (no redundant innerArc) andBuffer::firmware_mapping()returns a borrowed&mmu::KernelMapping; G13/G14 (fw::job::UserTimestamp), G15 (g15::command/g15::job) and M3 (m3::m3_submit::Destination) now retainArc<timestamp::Bound>, matching G16, G17 and G18, so no command on any family can keep a firmware mapping alive after unbind without also keeping its bind charge and window share alive until retirement. A refusal (ENOMEM) or a failed mapping drops the charge and the slot with nothing mapped. The record, the buffer and the table's nodes stay onGFP_KERNEL_ACCOUNT.asahi_bound_object_chargetests the charge and ENOMEM refusal past the client limit;asahi_timestamp_bufferalso testshost_offset()bounds viaa_host_stamp_lies_inside_the_bound_range.memacct::Clienttracks per-filetimestamp_windowbytes with an RAIIWindowSharetoken acquired viaClient::take_window()(atomic CAS viatry_add_within(), no overshoot under concurrency) and stored ontimestamp::Bound. Each backend reports its fixed window size throughGpu::timestamp_window_size()(64 MiB on G13/G14, G15, M3, and non-M5 G17 viaFirmware::timestamp_window(); 0 on G16, G18, M5, and G17's M5 graph).do_gem_bind_object()computeswindow_limit = window_size / 16, takes the file's share before mapping, passeslimit == 0 || share.is_some()tomap_timestamp_buffer(), and dropsshareimmediately ifbuffer.window_bytes() == 0(e.g. G17 falling back toBuffer::Hostwhen the global window is full).asahi_bound_object_charge::a_file_holds_at_most_its_share_of_the_timestamp_windowtests single-file limit enforcement, cross-file isolation, release on drop, and zero-limit behavior.Earlier extra evidence details
Extra evidence, not this PR's own row: 2-commit head (
ce717ff67cce) (kitpr2531-r3:integration/aurora 95a13cf618b1+ #1973 + commits 1–2; baseline kitpr2531-r3b: the same without this PR), Mac Studio (M5 Ultra), 27.0 firmware, read-only root, one boot each, 2026-11-22:WindowSharetotimestamp::Bound), returning to its starting value once the file is closed.QUEUE_CREATEafter the binds succeeds in both, and again after the binding file is closed.vulkan-cts-1.4.7.1) whose name containstimestamporcalibrat, 1149 in all. Both kernels: 1093 Pass, 2 Fail, 54 NotSupported (pipeline.monolithic.timestamp.misc_tests.timestamp_stage_top_of_pipe_stageandtimestamp_stage_host_stagefail on both kernels; the 54 NotSupported are present-timing cases requiring a window system).GL_TIME_ELAPSEDaround 1 to 512 full-target triangles withGL_TIMESTAMPqueries before and after; 3 runs, 30 of 30 rounds pass on both kernels.95a13cf618b1: with commits 1–2, 79 suites, 380 of 382 pass, 2 skipped; without it 77 suites, 378 of 380, the same two skips.tools/asahi/run-host-tests.pyon95a13cf618b1and on the base with arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973 and commits 1–2: 461 of 461 on both, no result differs.iwd.serviceandsystemd-networkd-persistent-storage.service) in both boots.Extra evidence, not this PR's own row: first version (
60e5bdaae4ce) (second commit used the 4096 count cap; kitspr2531-1andpr2531-1bonintegration/aurora b21dcc633b32+ #1973, 27.0 firmware, Aura main3efa4a81with aura#407 and aura#408, both since merged). Commit 1 is unchanged: 256 of 256 timestamp binds at +0 MiB against 223 then ENOSPC, the same timestamp CTS, GL and render CTS results with and without the PR, 0 new failed units and 0 new kernel errors. Its 4096-then-EBUSY cap row no longer applies.Thanks to ewb, who reported the unbounded binds and suggested the fix, and to RyanTheTide and DjDeveloperr for the reviews.
13f0a8aa2b26; J775D own-base A/B re-run on13f0a8aa2b26, non-M5 G17 spillover row, and G13/G14/G15/M3 window-share row are under Still to run)Assisted-by: LLM (Claude:Opus 5.5, Gemini:Neon)