🐛 Release reims-graphics at a quit of a VM that was not running

vendor/qemu moves to f8a1f0c5 on the fork's steelbrain/reims-vgpu-rebase-2
(a60aa2b3 before it).

A quit of a VM that QEMU was not running (paused by QMP's stop or by a full
disk, never started past -S, or paused by a shutdown whose action pauses)
stopped no running VM, so the device's VM state handler never tore it down.
The device stayed to the exit, the library's quiesce at the end of QEMU's
cleanup answered that it still held a GPU device, and QEMU ended with _exit.
reims-ctl's stop of a VM paused for a full disk quits such a VM.

QEMU's cleanup notifier now first tears down each device no teardown ran for,
BAR 2 out of the guest's address space first, as at a stop. The release lets
go of the GPU device, the quiesce answers true, and QEMU ends with exit().
Only a device a display's read kept (a GPU that stopped answering) still
ends QEMU with _exit. docs/qemu.md and docs/api.md say so.

What changes for the host: such a quit ends by exit(), with its exit handlers
run. The guest sees nothing: it no longer runs.
This commit is contained in:
Anees Iqbal committed 2026-12-02 12:07:44 -08:00
1 parent f872c9ce21
commit 82d7064f04
3 files changed
+14 -8

No files matched your search

+5 -3
View File
@@ -238,9 +238,11 @@ the degradation counts). After a true answer the exit gate's handler still runs
writes the counts.
QEMU calls it, with a bound of 5 s, at the end of its cleanup (`qemu_cleanup`, through a notifier of
its own run there, `qemu_add_cleanup_notifier`), on every quit that reaches it: a released device,
a device kept by a shutdown action that pauses, a quit of a stopped VM, and a read of a display
that kept it. That runs before `exit` itself, so before every exit handler. It lets the BQL go
its own run there, `qemu_add_cleanup_notifier`), on every quit that reaches it: a device released at
the VM's stop, and a device kept by a read of a display. The notifier first releases each device
whose VM was not running at the quit (a VM paused or stopped before it, a shutdown action that
pauses), so that its quiesce answers true too. That runs before `exit` itself, so before every exit
handler. It lets the BQL go
around the call, as around the release. On a false answer it runs what `exit` would run of QEMU's
own: its exit notifiers (usb-host's return of host devices to their drivers, a tap's down script,
the pidfile's removal), the terminal's restore where a chardev took stdio, and the flush of the C
+8 -4
View File
@@ -558,10 +558,14 @@ is its transport:
handler tears the device down, BAR 2 out of the guest's address space
first, so that the library's release of its last device lets go of the
GPU device before the process exits (docs/api.md, "The process's exit").
A shutdown whose action pauses the VM (`-action shutdown=pause`,
`-no-shutdown`), and a quit of a VM stopped before it, keep the device to
the exit, as before. So does a quit while a read of a display (a
console's, above) still waits for its draw on the GPU: the teardown waits
A quit of a VM that was not running (paused by QMP's `stop` or by a full
disk, never started past `-S`, or paused by a shutdown whose action pauses,
`-action shutdown=pause` or `-no-shutdown`) stops no running VM, so no
VM-state handler hears it: the end of QEMU's cleanup tears such a device
down (the cleanup notifier, `reims_graphics_pci_cleanup`), and QEMU then
ends with `exit()`, as after a running VM's quit. A quit while a read of a
display (a console's, above) still waits for its draw on the GPU keeps the
device to the exit, and QEMU ends with `_exit`: the teardown waits
for every display's read at most 5 s, under the BQL, as the reads use the
device. A
screendump still waiting for the read is answered first, with what the
Vendored
+1 -1
Submodule vendor/qemu updated: 0f7f65aea1...21e663657d.