The reset batch hung on a_raise_may_call_the_device_at_once, past its 540 s
slow mark, on every leg. Its raise resets the device, as the header lets it.
On the doorbell's thread, inside mmio_write_taking, the raise comes as a
CB_SUBMITTED is answered, with the decoder's contexts' lock held. The reset's
new settle (Host::reset_settles) then took that same lock and waited for it
for good: gdb's stacks in job m3-max-79063 show the thread blocked in
release_waits_for_reset on the lock it holds. api.md section 5 lists that
lock, a context's table read and the device caches' lock among those the
library may hold around a raise, and said no function of the device takes
them. The settle took all three.
A behaviour change the host observes, in two parts:
- A reset made inside the device's raise, on the raising thread, asks for no
settle and waits for no GPU work, so that work may write the guest's memory
after the reset returns: the one reset without the settle. That thread may
hold what the settle takes, and the work it raises for began before the
reset and ends only once the reset returns. The device crate counts the
raises on each thread (raise_through) and skips Host::reset_settles inside
one. QEMU's raise never resets the device or writes STATUS.
- The 30 s bound now covers every wait of the settle. Before, it covered only
the GPU wait, and the hang was a lock taken before that wait, which no timer
reached. The settle now takes the contexts' lock, each context's table read
and the caches' lock in 10 ms slices against the same bound, on the
platform's clock. Past the bound the process ends with the bound's death,
naming the lock.
The raise rule widens with this: no raise_interrupt, on any thread, may wait
for a lock the host holds around a reset. The settle waits for locks the
library may hold around any raise, not only for the threads that run completed
handlers. QEMU's raise waits for none: reims_graphics_pci_raise_interrupt_cb
writes the vector's irqfd, or takes msi_lock, which the vector's mask and
unmask hold under the BQL and which waits for nothing else, or schedules a
bottom half.
The header's raise and reset docs and docs/api.md sections 1 and 5 say so.
Tests: a_raise_may_call_the_device_at_once, unchanged, hung before this change
and passes now; a_reset_inside_a_raise_asks_for_no_settle (device crate); and
a_reset_whose_settle_waits_past_the_bound_for_a_lock_ends_the_process.