Repository navigation
drm/asahi: g17: M5: keep the host's QoS table words and effort; one history pass per render pair - #1508
Merged
Conversation
Each QoS publication read the queue, owner and data-master submission counts back from the uncached table before storing them incremented, and the busy-interval count when an engine went busy: seven or eight loads per render pair, made under the device mutex. Only the host writes these words; the firmware reads them. Keep the values last stored in the accounting and count on from those. The rows are still read, and the stores and their order are unchanged. Signed-off-by: Diljit Singh <hey@djdev.me>
A QoS publication still read each owner's row from the uncached table, for the record a cancellation compares and to refuse an owner change while work is in flight, and every completion read the row's owner byte back to validate it: two loads per render pair under the device mutex and two in the event worker's. Only the host writes the rows. Keep them with the counts and check against the copy; a cancellation still compares the table. Signed-off-by: Diljit Singh <hey@djdev.me>
The render doorbell counted the pair's tiling and fragment submissions with two passes over the firmware's submission history, each loading the history generation and the slot byte (uncached, under the device mutex) and ending in a full fence. Count both in one pass, in the slot of that moment, as two passes microseconds apart do. Signed-off-by: Diljit Singh <hey@djdev.me>
Every submission re-applies full effort, and when the value is unchanged it read the firmware's effort word back from region C to confirm it: one uncached load per compute and render submission, under the device mutex. On M5 region C is mapped read-only to the firmware, so once the host has written the word, or read it back equal, it holds the value applied. Skip the read-back then; other generations keep it. Signed-off-by: Diljit Singh <hey@djdev.me>
This was referenced Nov 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #1504. After it, an M5 render submission still held the device mutex for about 20 µs. Several of the uncached loads left in that time read words only the host writes. This series takes four of them out:
Why the copies are safe
The firmware reads the QoS table and does not write it. This was checked on an M5 Pro (J714s, firmware 26A428) with two measurement-only builds, under render, compute, multi-queue and idle workloads:
The stores to the table and their order are unchanged.
Measured
M5 Pro, gpubench pinned to a P core. Each change was switched at runtime and interleaved on one boot, 4-6 rounds, and every change was faster on both render rows. Microseconds per submit:
Per change, as the paired median change per round on render d16 / d64 and compute d16 / d64:
On fresh boots, one pass each, render.light d16 reads 25.05 µs with these four on #1504's kernel and 25.66 µs on this branch's own kernel.
Tested
🤖 Generated with Claude Code