A pipeline create waited 60 s for its reflection. On a slow host or a cold
compile the app got nil, and the destroy posted behind the create cancelled a
compile that would have succeeded. Other waits for host answers had the same
problem. A queue's create (30 s), SURFACE_PAGES (30 s), shared events (60 s),
a CPU lock's wait for its surface's writes and the host's copies (2 s), a new
block's wait for a write-back (10 s) and the bundle's library chunk acks
(10 s) all sit behind the context's earlier work on the host, a compile among
it. At their bounds a lock read whatever bytes the pages held.
Each of those waits now has no deadline, as Metal's own calls wait for the
GPU's driver (RgfxAnswerWait.hpp). It sleeps THREAD_INTERRUPTIBLE, so a caught
signal never ends it, and it ends only:
- at the answer;
- at the device's stop: quiesce wakes every waiter, and the waiter finds the
device stopped;
- at the thread's abort (SIGKILL, a fatal signal, exit), returning
kIOReturnAborted.
An aborted create still gets its destroy posted behind it. A CPU lock waits
with no deadline for the device to complete its writes' buffers. Its 2 s bound
now counts only from that completion to the bundle's retire, so a process
that locks a surface on the thread that would retire it still goes on.
The 64 lifecycle waiters are split by kind: 32 for the processes' creates and
shared events, 16 for surface pages and downloads, and 16 for the device's
own asks (queue create, close, pool takes, kept answers, video). Creates
waiting on compiles can no longer take the waiters WindowServer's surface,
queue and close asks need. A waiter take that ends unanswered returns
kIOReturnBusy, so a caller never mistakes an unposted message for a posted
one.
The waits that do not depend on host work keep their deadlines, each with its
reason in a comment: ring room, display commands, the start's kept answers,
a context's close, the display pipe, arm64 video sends and the region-room
wait.
What the guest now sees: a lock or present behind a slow compile waits for
it, and a create returns its pipeline however long the compile takes.