Repository navigation
drm/asahi: g17: count a queue's overlapping stages once in fdinfo - #1869
Conversation
The G17 firmware runs several commands of one queue at once, so a queue that keeps commands in flight retires stages whose intervals overlap. fdinfo summed them, and a client's drm-engine-* counted the same engine time once per command in flight: on the A18 Pro one client saturating compute at queue depth 4 read three seconds of compute per second, and ordinary GL and Vulkan loads read up to 2.2 times their busy time. Charge each queue's stages through a lane that keeps, per engine, the latest end it has charged, and add only the part of a stage after it. A queue's stages retire in the order they started, so this is the exact union of its intervals, without a lock. Queues of one file still add up. A stage more than 60 s behind the mark, longer than any stage runs, restarts it, so a timestamp jump cannot stop the accounting. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Compile/link gate: full arm64 build of integration/aurora 5d112b1 + #1853 + this PR (Image, modules, aurora.ko) OK, same warning count as without it. |
|
Hardware check on the A18 Pro (J700, Fedora), new default kernel (integration 2129f55), same slot, same load (one client saturating compute at queue depth 4, then a light render at depth 1):
The light render barely overlaps at depth 1, so it is unchanged. #1853's frequency keys were checked in the same run: |
The G17 backend runs several commands of one queue at once, so the stages a queue retires overlap in time. fdinfo summed their intervals, so a client's
drm-engine-*counted the same engine time once per command in flight. On the A18 Pro, one client saturating compute at queue depth 4 read 3.00 s ofdrm-engine-computeper second of wall time. In completion traces of ordinary GL and Vulkan loads, the sum per queue reached 1.1 to 2.25 times the queue's busy time, with overlaps up to about 40 ms.This charges each G17 queue's stages through a per-queue
usage::Lane. For each engine, the lane keeps the latest end it has charged and adds only the part of a stage after that mark. In the same traces (about 280k completions on 52 loads), no queue ever retired a stage that started before an earlier-retired one. A queue's retirement order is its start order, so the mark gives the exact union of the queue's intervals. It is lock-free: one compare-and-swap per stage before the existing counter update.Documentation/gpu/asahi-usage-stats.rstnow says which backend does what.Tests (
tools/asahi/usage-tests.rs,rustc --test): 14/14 pass with 0 warnings, of which 7 are new: depth 1/4/8 pipelines count exactly the wall time (the plain sum counts depth times it), idle gaps and disjoint stages, a covered stage keeps the mark, separate engine marks, queues of one file add up, the timestamp-jump restart, and 8 threads on one lane never exceed the union. Mutations are killed: dropping the clip, the jump rule, or the covered-stage return each fail at least one test.A kernel compile against the 2129f55 kit tree and a hardware check on the A18 Pro (the same depth-4 compute load should read at most 1 s/s) follow; results will be posted here.
🤖 Generated with Claude Code