Files
reims-vgpu/docs
Anees Iqbal fe09ba3c59 🐛 Begin a buffer named ahead of its walk only after its commit
Each queue's ring is taken on a thread of its own, so the host can take a
buffer whose SURFACE_ORDER names a buffer of another queue, committed earlier
by the guest, before the host has walked the named one. Until now the naming
buffer waited for it on the GPU alone, and that can close a loop. The named
buffer, a decode, fills its output's device cache at its begin for the CPU's
newer generation. The fill waits on the GPU for the end of each buffer that
used the cache, the naming buffer among them when it was begun and finished
first. The naming buffer waits on the GPU for the decode's signal, which the
decode's commit carries after its walk. The walk's video op waits on the CPU
for the fill. None of them ever finishes: the Windows host's video decodes
stopped this way.

What changes for the guest: such a buffer's begin now waits, on its queue's
thread, until the named buffer is committed. Its uses then count among no
cache user that the named buffer's fill waits for. Its CB_SUBMITTED and
CB_SCHEDULED, and the buffers behind it on its queue, come after that commit
too. A buffer that names only buffers the host has walked, or not yet
published, is begun as before.

The wait is counted on the surface order's summary line (begins that waited,
and the longest wait), and a wait past 2 s is named in the log with the
buffer it waits for. The module doc of surface_order and the design's
"Surface order" section give the wait and why the waits end. They also give
the one shape that holds: names written wrong, by a process that writes the
slots itself, which can make two buffers of two queues wait for each other
until either queue ends or the device resets.

Tests:
- The test committed alone before (a buffer naming a decode not yet walked
  begins after its commit) now passes: the reader's begin waits, it counts one
  wait, and no fill waits behind a later buffer.
- New: two buffers that name each other hold their queues, each named in the
  log, until one's process closes.
- New: a buffer waiting so is answered at no doorbell, so it holds no ticket.
- Changed, because they held the old order: the device tests of a reader in
  another process and of a buffer named while its queue's later buffer is
  walked first. Each reader is now committed only after the buffer it names,
  then waits on the GPU for its signal.
- The counter test of a fill behind a later buffer now runs on rings the host
  gives no published seqnos. That is the one place its order is left.
2026-11-27 00:20:15 -08:00
..