Files
reims-vgpu/docs
Anees Iqbal 7e8ea3c46f 🐎 Post a process's destroys in one kext call
Each destroy cost the guest a trip into the kext, and a post that found the
host's control thread asleep a doorbell's exit too: 14 us a destroy in a Vision
request on the RTX 3090 host, 3415 destroys and 68 to 70 ms a process, in runs
an app lets go back to back. The kext now carries SubmitBatch (selector 5,
feature bit 1 << 1): the bundle holds each destroy (RgfxRingWriter::postLater)
and posts what it holds in one call of at most 4096 bytes, before anything
else the process posts or asks of the kext (every IOConnectCall goes through
rgfxKextConn, which posts the held first), once the held fill a call, or 1 ms
after the first held. The kext checks each as Submit checks one, all before it
posts any, puts the runs on the ring under one hold of its lock with one
doorbell at most, and ends a queue's as Submit does. A texture over an
IOSurface goes at once: a present of the surface waits for its destroy.

What an object lay over goes back as its destroy is held, as it went back once
the destroy was posted: whatever takes it again is posted after the destroy,
so the host drops the object first, and every answer the guest reads (a heap's
usedSize, a new object's GPU address and resource id) is the one it read
before (shell_tests' test_held_destroys_change_nothing_seen). Where the kext
stops taking them (control ring full 5 s, or the device stopped), the rest stay
held; the next post retries them under its own bound and is refused only where
they are refused again. The one difference, under that exhaustion only: what
the held destroys lay over has gone back, so a heap's usedSize read during a 5 s
stall of ring 0 reads lower than before (design.md, "Destroys go together").

Measured, Vision cold request, RTX 3090 host (rts1 against rts2, load 3.6 and
3.4): destroys 69.6 -> 18.6 ms in the first process, 67.7 -> 14.7 ms in the
second; all kext calls 216 -> 162 and 188 -> 135 ms.
2026-11-13 04:02:30 -08:00
..