Repository navigation
drm/asahi: g17: reuse cached queue records after a later release - #3721
Open
DjDeveloperr wants to merge 1 commit into
Open
DjDeveloperr wants to merge 1 commit into
DjDeveloperr wants to merge 1 commit into
Conversation
A returned G17P queue-state object, whose records the firmware caches, waits for firmware stop before reuse, because consuming its owner's scheduler release does not show that the firmware dropped their lines. Firmware stop only comes at teardown. After 64 retired render graphs, every new graph gets uncached records again. On the J700 one multi-queue CTS run filled the pool, and q4 on new queues went from 40.35 to 42.52 us, main's level. The scheduler release carries what the older firmware's DestroyContext did: the context page and its bytes 0, 1, 4 and 0x23 (here 0x26). That command also flushes the firmware data cache, and the older firmware's driver frees firmware-cached memory only after one (flush_fw_cache). Do the same: reuse a returned cached queue state once a release published after its fence has been consumed. Track the latest release and the latest consumed one next to the control-ring counts. The host harness checks that a release published before the return does not count, that a later one counts only once consumed, and that retired graphs with releases between them never fall back to uncached records. Three new mutations cover each rule. Signed-off-by: DjDeveloperr <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
This branch has not been deployed
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.
What: Reuse a returned G17P render queue-state object once the firmware has consumed a scheduler release published after the object's fence. Until now it waited for firmware stop.
DestroyContextcarried: the context page and its bytes 0, 1, 4 and 0x23 (0x26 here). The older driver uses that command as a full firmware data-cache flush (flush_fw_cacheingpu.rs), and frees firmware-cached memory only after one. This PR applies the same rule to cached queue records: once a release published after the object's fence is consumed, the firmware no longer holds the record lines, so the pool may zero and rewrite them.channel.rstracks the latest scheduler release and the latest one the firmware consumed.object.rsmarks cached queue states and checks that rule instead of the plain fence. Other families keep their fences.tools/asahi/g17-object-fence-tests.py: a new test and three new mutations (release published before the return, reuse without a later release, retention until stop).Tested: J700 (A18 Pro, G17P), Mesa
089aeb0eprivate ICD. One trial boot at98cef721, run in the same order as the #3705 row: packet rows, then the full multi-queue CTS, then q4 again on queues created after the CTS. Median µs, range and visits, lower is better:dEQP-VK.synchronization2.op.multi_queue.*16,680 Pass, 7,080 NotSupported, 0 Fail.dEQP-VK.synchronization.op.multi_queue.*12,798 Pass, 9 NotSupported, 0 Fail. 0 recoveries.+0x1cand+0x94, as on drm/asahi: g17: keep G17P render queue records firmware-cached #3705. The CTS ran on reused records with the same result (16,680 and 12,798 Pass, 0 Fail, 0 recoveries, 0 GPU faults), and q4 was 40.27 µs before and 40.30 µs after.tools/asahi/run-host-tests.py --only g17298/298, including the three new mutations.checkpatch.pl --strict: 0 errors, 0 warnings.Risk: two-way door · G17P Macs (A18 Pro, M4 Pro/Max) reuse a cached render queue-state object after a later scheduler release instead of never. If a release did not flush the firmware data cache, the firmware could read a stale record line after reuse. The rule relies on the release behaving like the older
DestroyContext. The test-only check above found no stale host word in a reused record.Not yet:
Details
Why the pool filled
Pool::return_objectgave a cachedFamily::QueueStateobject no fence (None), soRetained::readynever became true. The object kept its reserved slot untilPool::stop_after_firmware, which runs only fromFirmware::drop. Each new render graph allocates one queue-state object, so 64 retired graphs filled the family, and every later graph fell back to an uncached allocation.The rule
published_release()records the control-record count of each scheduler release at publication (runtime/teardown.rs).observe_controlmoves the consumed mark up to that release once the firmware has consumed it.control_published()on the A18 Pro,control_fence()elsewhere). It becomes reusable only when a release published after that fence has been consumed (release_witnessed() > fence). A release published before the return never counts, so the flush runs after the firmware last named the records.DestroyContextflush (gpu.rs). On G17 the release record has the same contents.Not run