Skip to content

drm/asahi: g17: check queue capacity before reserving a slot (no admission spin) - #1146

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
gpux/g17-capacity
Nov 7, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
gpux/g17-capacity

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

G17 logical-queue creation that has to wait for capacity now sleeps instead of spinning.

Problem

Backend::new() reserved the new queue's admission slot first and then checked whether a render QID pair and an execution context were left. On a refusal it dropped the slot. QueueSlot::drop() notifies the queue-slot availability domain, and the creator had sampled that domain just before. Its wait in new_queue() (and the retained-context wait inside Backend::new()) therefore returned at once, so a creator that could not be admitted re-ran admission under the device mutex for the whole 2 s window.

Reproduced on the Neo (J700, G17P), fleet23, system Mesa: 8 processes x 8 VkQueues, each holding its queues for 3 s. The kernel logged G17 capacity refusal LogicalQueues 2,003,282 times in about 2 s. The queues the creators waited for were busy and closing on the same mutex.

Fix

Check the queue count (Pool::has_room()), the render pair (render_fits(open + 1)) and the execution-context count before reserving. A refused creator holds nothing, so it sleeps until a queue slot is returned or a retained context is reclaimed. Admission limits, error codes and the wait window do not change.

What this does not fix

The lost device seen by clients over the budget is a separate problem: Mesa creates the kernel queue on first submission, so any capacity refusal becomes vk_queue_set_lost. The Mesa side reserves the kernel queues at vkCreateDevice: aurora-silicon/mesa#184. The system-wide budget itself (58 execution contexts, fewer once installed compute channels have narrowed the render QID pairs, e.g. 50 on the Neo after 26 compute channels) is unchanged. M1/M2 (G13/G14) have no such limit: 70 concurrent clients pass on the M2.

Testing

Neo (J700, G17P), one-shot test kernel 7.3.0-aurora-gpux1 = fleet23 (810b92c) + this commit + linux#1096 + linux#1065. Boot was clean: SELinux enforcing, 0 AVC, 0 failed units, os_uuid pin kept, glmark2 build 6441. Same harness on both kernels: 8 processes x 8 VkQueues, each holding its queues 3 s.

Kernel Mesa LogicalQueues refusals Clients
fleet23 installed 26.3.0-14 2,003,282 4/8 DEVICE_LOST
gpux1 (this fix) installed 26.3.0-14 12 6/8 DEVICE_LOST (the Mesa side, not this commit)
gpux1 (this fix) mesa#184 10 4 clean vkCreateDevice errors, 0 lost

The refused creators now sleep until a slot returns or the 2 s window ends. Raw logs: traces/gpu/20261107-g17-queue-capacity, traces/gpu/20261108-gpux1-neo (lab S500). Build: fleet config, LLVM=1, no Rust warnings in the asahi crate.

Assisted-by: LLM

🤖 Generated with Claude Code

Logical-queue creation reserved its admission slot first and only then
checked whether a render pair and an execution context were still
available. On a refusal it dropped the slot, and that drop notifies the
queue-slot domain the creator had observed just before. Its wait in
new_queue() (or the retained-context wait) therefore returned at once,
so a creator that could not be admitted spun on the device mutex for the
whole wait window. On the Neo, eight clients with eight Vulkan queues
each logged 2,003,282 LogicalQueues refusals in two seconds while the
queues they waited for were being used and closed.

Check the queue count, the render pair and the execution context before
reserving. A refused creator now holds nothing, so it sleeps until a
queue slot is returned or a retained context is reclaimed. Admission
limits and the wait window do not change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J616s data point on fleet27 (integration/aurora 95e30d5, which does not include this PR), 2026-11-08 05:02 AEDT. A 6-shard dEQP-VK timeline_semaphore run (3834 cases) with the system Mesa logged G17 capacity refusal LogicalQueues 9 times and LowerVa 23 times. Three clients saw GPU work of a client failed (EBUSY ...); the client sees a lost device. The capacity file read logical_queues total=42, physical_qids 90/128. With 4 shards: 3834/3834 pass and no refusals. This PR's no-spin admission still needs its own J616s run (MTR-LINUX mtrl3 slot). Note: LowerVa refusals (g17/object.rs:401) also show up under this load, separate from the queue budget.

@RyanTheTide
RyanTheTide merged commit 255350c into integration/aurora Nov 7, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the gpux/g17-capacity branch November 7, 2026 19:23
RyanTheTide added a commit that referenced this pull request Nov 7, 2026
Brings aurora-wip up to the 11-08 morning integration tip: DT
descriptions for every Mac family (#1094, #1097, #1111, #1131, #1132,
#1148, #1149, #1155, #1156, #1157, #1172), the J616s scaler (#1168), the
panel primaries from boot data (#1105), AVD macOS command parity
(#1116), AVD dma-coherent (#1169), the M2 PMU RTC alarm (#1151), G17
admission without spinning (#1146) and the AOP map wait (#1147).

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant