scrotwmos

GPUs and VMs

Which driver each GPU gets, what draws your desktop, what a VM can get, and what each choice costs you. The measurements behind every one of those choices are at the end.

The rule is simple. Browsers get near-hardware speed on the GPU that drives the screen, in containers and in VMs. Every other GPU is grabbed at boot, before any driver can touch it, and goes whole to one VM, or to no one. The BIOS picks which GPU drives the screen; we do not second-guess the firmware.

No VM path in the matrix is a guess. A path is on because it was measured, and off because it was not, or because it broke.

Words you need first

The matrix

The terms in these tables are explained in “What the choices mean” below.

The display GPU

Hardware Kernel driver Your desktop is drawn by A VM gets What it means for you
Intel Tiger Lake, Rocket Lake i915 the GPU, in the screen VM native context the fastest setup: desktop and VMs near native; a VM that hangs the GPU freezes the screen for about 0.1 s
Intel Meteor Lake i915 the GPU, in the screen VM native context fast desktop; VMs near native, rendering alone (Firefox and Chromium 60 fps at 1080p); with dom0, at 4K, and a VM that hangs the GPU: not measured
Intel Lunar Lake, Battlemage and later xe the CPU no GPU the screen VM draws only on i915, so the CPU draws the desktop; VMs draw with their CPU: fine for text, useless for 3D
Other Intel on i915 (Gen9 to Gen11, Arc Alchemist) i915 the CPU no GPU no native context measured on these, so no screen VM: the CPU draws the desktop; VMs draw with their CPU
AMD amdgpu (radeon for older cards) the CPU no GPU the screen VM draws only on i915, so the CPU draws the desktop; VMs draw with their CPU
Nvidia nvidia, Turing (RTX 20, GTX 16) and later; nouveau for older cards the CPU no GPU the CPU draws the desktop; Nvidia’s driver cannot share the display GPU with VMs
A GPU the kernel cannot drive simpledrm (shows the boot screen) the CPU no GPU the screen always works, at the resolution the firmware set

A whole NVIDIA GPU in a VM: two stacks

A VM with session_gpu = graphics or compute that gets a whole NVIDIA GPU picks its stack from its own root, with no setting:

PID 1 decides once the root is mounted; dom0 holds none of this.

The wizard and swmtool session fill the root. On a box with a GPU past the display GPU (display class, 0x03) each asks whether a VM takes it, named by its address and ids (“Held GPU 0000:01:00.0 10de:28b0”), the first VM by default; a box with none is asked nothing. An accelerator (an NPU, class 0x12) is held but given to no VM, so it is never asked. When the GPU is NVIDIA’s, a yes gives the VM’s root the nvidia package set: NVIDIA’s user side and nouveau’s, never NVIDIA’s kernel side or a compiler. A VM already filled gets the set at once, from its own xbps-install.

Void carries one version of NVIDIA’s libraries. When it moves past the guest kernel’s, the VM runs nouveau until a release brings the kernel up.

Every second GPU

Hardware Kernel driver A VM gets What it means for you
Nvidia Turing or later, on PCIe, a measured card (the RTX 2000 Ada) none: held the whole GPU, one VM near native 3D in that VM (54 fps at 4K); the VM cannot reach dom0’s GPU code
Nvidia Turing or later, any other card none: held no GPU each card is measured before it is allowed
Nvidia before Turing none: held no GPU its firmware updates are not signed: a VM could flash the card, and the next owner, VM or not, inherits that firmware
AMD, Intel Arc none: held no GPU not measured, and whether their firmware updates are signed is not checked
A second onboard GPU (you set a discrete card as the display GPU in the BIOS) none: held no GPU Intel’s onboard GPU shares memory with the CPU through a reserved memory region the card can still reach around the IOMMU
Any GPU on Thunderbolt none: held no GPU Thunderbolt and PCIe hotplug are off in the kernel: every GPU is present, and checked, at boot
A slice of a GPU (SR-IOV) not used no GPU on Tiger Lake, one VM drawing on its slice reset the whole GPU, and dom0’s screen with it

If no display GPU is found (a headless box), every GPU goes to its own driver, nothing is held, and no VM gets a GPU.

What the choices mean

How the desktop is drawn

dom0 runs the compositor: the program that puts every window on the screen. It shows the desktop in one of two ways, and says which on the console.

On the GPU, in the screen VM. The screen VM is a small VM of dom0’s own. Its one program composites the desktop on the display GPU: dom0 sends it the windows each frame, and shows the picture it draws. It reaches the GPU through native context (below), and runs Mesa, the open GPU driver library, inside the VM. The GPU does the work; the CPU stays free. A bug in Mesa is then a bug in the screen VM, not in dom0. It needs an Intel display GPU on i915 whose row in the GPU table allows native context (Tiger Lake, Rocket Lake, Meteor Lake), and a box that passes the GPU sharing gate: the kernel and GPU settings dom0 needs to trace a GPU hang to the VM that caused it. The F4 alerts #08030007 and #08030008 say when a box gets no screen VM, and why (doc/installing.md).

On the CPU (pixman). pixman is a library that draws with the CPU. dom0’s compositor draws with pixman alone, and holds no GPU driver code. It works on any screen, with any kernel driver. The cost: CPU time on every frame the desktop changes (not measured here). dom0 draws this way when no screen VM draws: on a box with no screen VM, after GPU hangs turn the shared paths off (rule 8), and while the screen VM starts again after it ends.

GPU buffers, or copied windows. While the screen VM draws, a session that draws on the GPU hands its buffers over, and the screen VM reads them in place. A window drawn with the CPU is copied to the screen VM on every frame it changes. While dom0 draws with pixman, every session copies its frames into memory dom0 reads (copy mode), which costs CPU in the session too.

What a VM gets

Best to worst for a browser in a VM. The numbers are WebGL frames per second in a browser at 4K, with dom0 drawing the VM’s frames; the host itself reaches 60, the screen’s refresh limit.

The whole GPU (VFIO). A second GPU goes to one VM. The IOMMU keeps the GPU inside that VM’s memory, and the VM runs the vendor’s own driver on real hardware. Near native: 54 fps on an RTX 2000 Ada. The VM never touches dom0’s GPU code, and a GPU hang in the VM does not stall the screen. The cost: one GPU per VM, so you need a second GPU in the box; and each frame is copied to dom0, 2.3 ms at 4K.

Native context. The guest runs Intel’s normal driver, and that driver’s requests go through a virtual GPU device (virtio-gpu) to dom0’s i915. Several VMs share the display GPU. Near native: 53 to 59 fps on Tiger Lake and Rocket Lake; 60 fps on Meteor Lake at 1080p, the one size measured there. The cost: a guest’s requests reach virglrenderer and dom0’s kernel driver, a large body of code a guest can attack; and a guest that hangs the GPU freezes dom0’s screen until the kernel kills the stuck job, about 0.1 s (the preempt timeout, rule 6).

The gfx VM (Venus). Venus is the path for a guest whose Mesa has no native context: the guest’s Vulkan calls (Vulkan is the newer GPU API) go through virtio-gpu to a Vulkan driver, and the guest’s OpenGL is translated to Vulkan on top. dom0 runs no Vulkan driver and no Venus decoder. A VM of dom0’s own, the gfx VM, runs them for up to four VMs, its clients. A client’s messages pass through the gfx VM’s virtual machine monitor in dom0, tagged with the client, to a decoder of the client’s own inside the gfx VM. The gfx VM draws on the display GPU through native context, with one virtual GPU device for each client, so dom0 still limits each client’s GPU memory and blames its hangs. What it gives: a guest that breaks out of the Venus decoder lands in the gfx VM, not in dom0. The cost: it lands beside every other client’s GPU buffers, and each message takes one more hop (“The gfx VM against Venus in dom0”, below, measures the hop against the decoder and driver in dom0, which scrotwmos ran before). A client is never a VM that must not leak to other VMs (below).

No GPU. The guest draws with its CPU (llvmpipe), and dom0 shows the result. Always there, and none of dom0’s GPU code is in reach. WebGL at 4K: 3 fps in Chromium, 14 in Firefox, with up to three CPU cores busy. Fine for text, useless for 3D.

On native context and the gfx VM, VMs on one GPU also share its caches and timing: a side channel one VM can use to learn about another. A VM that must not leak to other VMs gets the whole GPU, or no GPU, and never the gfx VM.

The gfx VM: what it keeps apart, and what it does not

The gfx VM moves the Venus decoder and the Vulkan driver out of dom0 and into a VM of their own. One gfx VM serves up to four client VMs, one in each of its slots. Inside it, each client has its own decoder process, in a jail of its own: its own user ID, its own namespaces, its own seccomp list (the kernel’s filter of the system calls a process may make) and its own cgroup (the kernel’s group of processes that it charges and limits, here for memory and CPU). dom0 keeps apart, whatever the gfx VM does:

What it does not keep apart: the gfx VM’s kernel, its GPU driver and the GPU itself are shared by every client. A guest that breaks out of its decoder’s jail and then into the gfx VM’s kernel can read and change every client’s GPU buffers and command streams (so, what every client shows), fill any client’s window with what it likes, stop every client’s GPU, and hold each client’s frames at dom0 for up to 1 s at a time. It cannot reach dom0’s memory, a client’s own RAM, or another client’s slot in dom0. Shared caches and timing on the GPU and the CPU are a side channel between clients, as on any shared path.

So a VM that must not leak to other VMs gets the whole GPU or no GPU, never the gfx VM. A guest that breaks out of the decoder reaches every client’s GPU buffers, never dom0.

What was tested, on Rocket Lake: the dom0 process that serves one client’s slot, killed, ends that client’s GPU at once (0.02 s), and a second client keeps its frame rate; the gfx VM killed ends every client’s GPU within 0.3 s. A hostile gfx VM, in tests that send bad records and name another client’s buffers, gets each record refused and that client’s connection closed, no other client touched. Not yet tested: what one client leaves behind for the next in GPU memory, a client that hangs the GPU or floods it, and a client that fills its share of memory.

Other words

From driver to driver

power on
  |  the signed kernel command line: pci-stub claims every
  |  display and accelerator device (PCI class 0x03, 0x12)
  v
PID 1 looks for the display GPU
  |  the device holding the firmware's boot screen,
  |  else the boot VGA device
  |
  +--- none found ---> every GPU to its own driver;
  |                    no GPU held, no VM gets a GPU (a NIC still
  |                    goes to the net VM: never the display)
  | found
  v
each GPU takes one of two lanes:

DISPLAY GPU                       EVERY SECOND GPU
(the one found above)             (with its card's functions)
  |                                 |
  v                                 v
released to its own driver:       held: pci-stub keeps every
i915, xe, amdgpu, radeon,         driver off; the GPU powers
nvidia, nouveau; simpledrm        down where the board allows
if none                             |
  |                                 v
  v                               the gate passes: vfio-pci,
dom0's compositor shows the       one VM owns it
desktop on it; the screen VM        |
draws it there (i915 only)          v
  |                               the VM stops: the card reset,
  v                               held again, given to no other
vmm-gfx runs VMs' native          VM until the next power-off
context or Venus on it

A GPU never moves from one GPU driver to another while the machine runs (rule 1). We tried it: xe back to i915 wedged the GPU. pci-stub and vfio-pci are not GPU drivers, so a held card can move between them; it goes to one VM a boot (rule 5).

The display GPU in dom0

The compositor is one static binary (swm-wl). It draws with pixman alone, into plain CPU buffers the display shows (dumb buffers). It links no Mesa and no other GPU driver code: no OpenGL, no shader compiler, nothing loaded at run time. It makes no GPU context and runs no GPU job; its seccomp filter kills it on any GPU call off its list. At start it says so on the console:

"dom0: renderer pixman (the CPU's; the screen VM's is the GPU's)"

The screen VM composites the desktop on the GPU (doc/design-gfx-all-vm.md). The monitor starts it at boot, and again after it ends, while all of these hold:

  the display GPU is on i915, its row    --no-->  no screen VM this
  allows native context, it has a                 boot (#08030008)
  render node?
        | yes
        v
  the box passes the GPU sharing gate?   --no-->  no screen VM this
        | yes                                     boot (#08030007)
        v
  GPU hangs have not turned the shared   --no-->  no screen VM until
  paths off (rule 8)?                             reboot (#08020003)
        | yes
        v
  the screen VM draws                    "screen: it draws the desktop"

When no screen VM draws, dom0 draws the whole desktop with pixman, and says “screen: it draws no more: the sessions copy their frames”. dom0 offers sessions GPU buffers only while the screen VM draws. A session’s GPU buffer is shown only through the screen VM, but for one case: dom0 checks it and hands it to the screen’s vmm-gfx, and never reads it itself. The one case: a window that covers an output whole, in a GPU buffer dom0 made for its session, goes to the display with no compositing (doc/design-dom0-buffers.md).

Which path a VM gets

“Its row” is the GPU’s row in “The GPU table” below, the full form of the matrix above.

For each VM, at start:

  a second GPU ready for a VM, its
  row allows it, the gate passes?        --yes-->  the whole GPU
        | no
        v
  its row allows native context on the
  display GPU, and the guest has Mesa
  with native context?                   --yes-->  native context
        | no
        v
  its row allows the gfx VM on the
  display GPU, and a slot of the
  gfx VM is free?                        --yes-->  the gfx VM (Venus)
        | no
        v
  no GPU: the guest draws with its CPU

A VM whose row allows the gfx VM but finds no free slot of it gets no GPU, and an alert (F4) says so. A GPU given whole that fails the gate does not fail quietly. The VM falls through to the next path, and an alert (F4) names the GPU and the check it failed.

The gate is eight checks on a held GPU. At boot, before it holds anything, the monitor reads the facts that cannot change while the box runs: the config space of each PCIe bridge between the CPU and the card, the group’s reserved regions, the device’s removable attribute, whether interrupt remapping is live, which IOMMU the machine has, and the kernel command line. It reads them while every PCIe port is still powered on: a read later would wake a port that sleeps. It runs the checks when its loop starts, and again when it hands the GPU’s IOMMU group to vfio-pci for a VM (the attach).

Each check passes, fails, or is not proven yet. A check not proven is not a pass: the GPU goes to no VM until the attach proves it. A file a check needs that is absent or unreadable fails it, with two exceptions: check 5 takes a missing reset_method as no FLR, and check 8 takes an unreadable command line as no noats.

A network function goes through the same checks. Its card is its IOMMU group: every member of the group but a PCIe port, wherever it sits. A network function goes to the net VM alone, its IOMMU group whole. The row for any network function allows nothing; a card with a row of its own, or one measured on its box, is allowed.

# Check Why
1 Held: the GPU and each function of its card have driver_override (the sysfs file that names the only driver allowed to bind) set to pci-stub, and no other driver a dom0 driver on any function of the card shares the card with the guest
2 Translated: the group exists, and its IOMMU domain (the set of address translations the IOMMU applies to the group) is DMA: every access translated and checked an identity domain lets the card reach all memory as it is. DMA-FQ, the flush-queue mode that removes old mappings in batches, is not the kernel’s setting here; seeing it means someone changed the setting while the box runs
3 Interrupts fenced: interrupt remapping is live (the IOMMU checks each interrupt a device sends against a table; the kernel names such interrupt chips IR-... in /sys/kernel/irq/*/chip_name), and vfio_iommu_type1.allow_unsafe_interrupts reads N without remapping a card can send any interrupt to the host. The parameter can be set at run time, so it is read at each check; the monitor never writes it
4 No direct region: the group’s reserved_regions (the memory the firmware says the group must always reach) has no direct or direct-relaxable line a direct region is mapped one to one for the device, whatever the IOMMU domain, so the card reaches it outside the IOMMU. The kernel itself refuses VFIO for a direct region. It allows direct-relaxable for GPUs; this check refuses that too. An onboard GPU reaches its stolen memory (main memory the firmware sets aside for it) through such a region
5 Reset on its own: every function of the card lists flr or af_flr in reset_method (the sysfs file that lists the resets the kernel can do; FLR is Function Level Reset, af_flr the same through an older capability) the next VM must not see the last one’s state
6 Fixed in place: the device’s removable attribute does not read “removable”, and no bridge on its path (the chain of PCIe bridges from the CPU down to the card) has a hot-plug slot, the SHPC capability (Standard Hot-Plug Controller, an older hot-plug interface) or the Thunderbolt capability (a Vendor-Specific Extended Capability with id 0x1234) Thunderbolt and hot-plug are not supported (rule 11)
7 A clean group and slot: each member of the group is one of the card’s functions, held, or a PCIe port (a bridge on the path, bound to the kernel’s pcieport driver or to none); each function in the card’s slot is the card’s, held, or, on the root bus (the chipset’s slot, no card’s), another’s in an IOMMU group of its own VFIO hands over the whole group, so two cards in one group cannot go to two VMs. Functions in one slot can reach each other inside the card without the IOMMU, so a function left on a dom0 driver could be fed by the guest’s card; the kernel puts such functions in one group, and on the chipset’s root bus one in a group of its own is fenced by ACS (a CNVi Wi-Fi at 00:14.3 beside the xHCI at 00:14.0)
8 No ATS, decided at boot: the kernel command line has a pci= option that begins with noats, or no function of the card has the ATS capability, read from its config space (the card’s registers the kernel reads it through) before the hold ATS (Address Translation Service) lets a card cache the IOMMU’s translations and send addresses it has already translated, which the IOMMU lets through unchecked

Three checks can be not proven at boot:

A GPU that fails a check is given to no VM; a VM that would have got it gets the next path down instead. The log (MOD+F3, gpu: lines) and F9 say every failed and every not proven check in words. If the GPU table allows the GPU whole, the monitor raises an alert that names the GPU (#0801000N, N the first failed check): at boot for checks 1 to 7, and at attach for checks 3, 5 and 8 when the attach refuses them. A check not proven yet raises none.

F9 lists each GPU above the PCI devices. Under it are the name of its row in the GPU table, the paths a VM gets on it, the paths its row refuses and why, and for a held GPU every check’s result, as the gate ran when the monitor’s loop started. doc/tabs.md, “F9 iommu”, says how to read each line.

Handing a GPU to a VM

In short: a second GPU that passes the gate is checked, wiped and kept ready; the next VM that starts gets it whole; when that VM ends, the card is reset, checked and wiped again before another VM can get it.

The monitor (dom0’s root process, which holds the GPUs) does this for each such GPU in turn, starting at boot, while dom0 and the sessions come up. One cycle:

  1. The card moves from pci-stub, which holds it unused, to vfio-pci, the kernel driver through which a VMM drives a card it is given. The monitor then probes it: it attaches the card in an empty IOMMU domain, which proves check 3 (interrupt remapping) and check 5 (a reset of its own) on the card itself, and reads the card’s ROM (the firmware the card keeps) and compares it with the record the user approved in F9 (see “The GPU table”, below).
  2. The card is “ready”: the monitor keeps it open on vfio-pci, idle, so that no other process can open it.

The next VM that starts gets the ready GPU whole: the monitor picks it, and no setting in a VM’s config picks it (the first box of the chart in “Which path a VM gets”). One VM has it at a time. A VM that starts while it is in use, or not ready yet, gets the next path down the chart, and the log says why.

When that VM ends, whether it stopped, crashed or was killed, the monitor resets the card, clears its PCI Express error status, puts it back on pci-stub, and starts the cycle again. F9 shows where each GPU is in the cycle (doc/tabs.md, “F9 iommu”).

A GPU is kept from every VM, with an alert, when:

The last three keep it until the next boot. Every boot wipes the GPU before any VM gets it, so the memory the last VM wrote is gone even after dom0 crashed.

The GPU table

An allowlist: a row allows a path only when it was measured, and the “measured” column names the measurement. A GPU or a path not in the table gets nothing; the VM gets no GPU. The states:

GPU dom0 driver Path State Measured
Intel Gen12 Tiger Lake, display GPU i915 native context allowed one VM with dom0, 1080p and 4K; hang test
Intel Gen12 Tiger Lake, display GPU i915 gfx VM (Venus) allowed not measured
Intel Gen12 Rocket Lake, display GPU i915 native context allowed one VM with dom0; three VMs; two screens; hang test
Intel Gen12 Rocket Lake, display GPU i915 gfx VM (Venus) allowed one client and up to four, rendering only: frame rates meet the bar; Chromium’s canvas p99 misses it at three and four clients (below)
Intel Meteor Lake, display GPU i915 native context allowed one VM, rendering only, 30 min a browser (below)
Intel Meteor Lake, display GPU i915 gfx VM (Venus) allowed not measured
Any Intel, SR-IOV i915, xe SR-IOV impossible PCI_IOV is off in the kernel; on Tiger Lake it also failed (below)
Intel Xe2 and later (Lunar Lake, Battlemage), display GPU xe native context excluded not in Mesa or virglrenderer
Intel Xe2 and later (Lunar Lake, Battlemage), display GPU xe gfx VM (Venus) none not measured
Nvidia, display GPU nvidia, nouveau any shared excluded no native context; Venus refused (below)
AMD, display GPU amdgpu, radeon any deferred
Nvidia RTX 2000 Ada (AD107), discrete, PCIe, not the display GPU held VFIO allowed rendering only and with dom0, 1080p and 4K; hang test on the 5060 Ti only
Nvidia RTX 2000 Ada (AD107), discrete, PCIe, not the display GPU held gfx VM (Venus) none not measured
Other Nvidia Turing and later, discrete, PCIe held VFIO none not measured on PCIe; a row per measured card
Any GPU on Thunderbolt held VFIO deferred not supported (rule 11); the RTX 5060 Ti rows are evidence only
Intel NPU, onboard, an AI accelerator, not a GPU held VFIO none not measured; no VM is given one
Any onboard GPU, not the display GPU held VFIO none not measured; an Intel onboard GPU always fails the gate (relaxable reserved region)
Nvidia before Turing, discrete held VFIO excluded its firmware updates are not signed (below)
Any other discrete GPU (AMD, Intel Arc) held VFIO none not measured; firmware signing not checked
Realtek RTL8111/8168, PCIe (r8169) held VFIO allowed on a Rocket Lake desktop: held, gated, given whole, reset by its bridge, given again (check-handoff hostnic); the net VM’s lease not measured
Qualcomm Atheros QCA9377 Wi-Fi, PCIe (ath10k) held VFIO allowed on a Rocket Lake desktop: held, gated, given whole, reset by its bridge, given again (check-handoff hostnic); joined (verify-appliance-wifi.sh)
Intel BE200 Wi-Fi 7, PCIe (iwlwifi) held VFIO allowed on a Meteor Lake laptop: held, gated, given whole, given back after each run; joined, on the stick and in the net VM (verify-appliance-wifi.sh)
Any PCI network function held VFIO none not measured; the net VM’s, its IOMMU group whole
Network card measured on this box held VFIO allowed held, gated, given whole, reset, given again, on its box; approved there (design-nic-measure.md)

Only cards whose firmware updates are signed (Nvidia Turing and later) may get a VFIO row: a guest owning a card can try to rewrite its firmware, which keeps past a reset. Signed firmware is the premise: the reset (rule 4) trusts the card. The monitor reads a held GPU’s ROM through its ROM BAR before any VM gets it and compares it with the image recorded when the user first approved that GPU in F9 (trust on first use), sealed on swmdata; a GPU with no recorded image, or a mismatch, stays held, and F9 says why, until the user approves it there. This is a tripwire, not proof: the card serves its own ROM BAR, and firmware that hides itself passes; a card bad at install passes too. The kernel’s walk of the ROM image runs on bytes the card controls (bounded, a known surface).

The rules

  1. One GPU driver a GPU, chosen at boot, never changed while running. Moving a GPU from xe back to i915 wedged it (“Enabling uc failed”). Handing a held GPU between pci-stub and vfio-pci is not a GPU driver change.
  2. At boot, every display-class and accelerator-class device (classes 0x03 and 0x12) is held by pci-stub: one word in the signed command line, the same on every box, and pci/ links ahead of gpu/ in Linux’s drivers/Makefile, so pci-stub binds first; no kernel patch. Then PID 1, as soon as /sys and /dev are up and before anything looks for the display GPU (device_gpu_hold, lib/libsession/privsep.c, called from bin/swm-wl/main.c): it removes those ids from pci-stub; finds the display GPU, the device whose BAR holds the firmware framebuffer, else the boot VGA device; releases it to its own driver, and holds nothing in its slot; and holds every other GPU, and the functions of its card in its slot (its own vendor’s audio, USB-C and UCSI; an AMD APU’s slot also holds the CPU’s USB and PSP, another vendor’s, which keep their drivers): driver_override pci-stub, so no driver of dom0’s can bind them, and then unbound: pci-stub never drops the probe’s runtime PM reference, and an unbound function lets its port suspend, the device reaching D3cold with it where the platform allows; the VM’s hand-off binds vfio-pci. Never a bridge or a device of another slot: a group with any other member keeps it on its driver, and the gate refuses the group. Two identical GPUs, one the display, stay apart (by address). No display GPU found: every GPU is released, nothing is held. No pci-stub in the kernel: nothing is written. If the ids cannot be removed, nothing is released (it would go back to pci-stub); a hold whose override cannot be written leaves its device as it was; each hold is read back. The monitor hands a GPU on by driver_override first, then unbinds and binds. Which GPU displays is the firmware’s choice (its framebuffer, its boot VGA device): within the firmware’s trust. Proven in qemu on our kernel’s config (make check-gpu-hold); the hand-off pci-stub to vfio-pci, on Void with QEMU, on an RTX 5060 Ti with no Nvidia driver loaded, a new VM drawing on it.
  3. The display GPU is the BIOS’s primary display. To use a discrete GPU for the display, set it as primary in the BIOS; the onboard GPU is then held, and no VM gets it (not measured).
  4. A GPU given to a VM has its ROM BAR off (rombar=0): the 5060 Ti’s ROM hangs the guest firmware over Thunderbolt; the RTX 2000 Ada runs the same with it off. The card’s functions go together, after the gate. The VM’s memory is pinned; the monitor limits it to the VM’s RAM (RLIMIT_MEMLOCK). The card is reset before the VM starts, and by the monitor after it stops (swm-vmm may be dead or compromised by then). With FLR, the monitor first writes flr into each function’s reset_method, so no other method runs. With a bus reset, swm-vmm resets through VFIO’s hot reset with every function before start, and the monitor through the parent bridge’s reset_subordinate after stop. A GPU that cannot be reset stays held.
  5. A held GPU goes to one VM a boot. When that VM stops, the card is reset (rule 4) and held on pci-stub until the next power-off; F9 says “used this boot; power off to reassign”. The card’s memory (VRAM) still holds what that guest left: neither an FLR nor a bus reset clears it, and nothing here wipes it. A wipe of a held GPU’s memory, done by host code and not by a VM, is deferred (ROADMAP.md). A warm reboot does not clear VRAM either, and scrotwmos reboots by itself after a crash or a panic: until the wipe exists, the first VM after such a reboot can find what the last boot’s VM left in the card’s memory.
  6. The display GPU is protected, always (no setting):
    • every engine’s preempt timeout at 100 ms, in Kconfig, before any guest may use the GPU: a hang then stalls the other clients ~0.1 s, not 7.5 s. i915: DRM_I915_PREEMPT_TIMEOUT (copy and video engines, 640 ms by default) and DRM_I915_PREEMPT_TIMEOUT_COMPUTE (on Gen12 the render and compute engines, 7500 ms by default), both at 100; xe: DRM_XE_PREEMPT_TIMEOUT at 100000 (microseconds), every engine but its GSC engine (kernel only, a 600 ms floor). The cost: a GPU job that cannot be preempted is reset after 100 ms;
    • the screen VM’s context at high priority. dom0 makes no GPU context. The screen VM’s one context runs above normal: the screen’s vmm-gfx keeps one capability, CAP_SYS_NICE, the kernel’s own test for a raise, and its seccomp list refuses every other call that tests it (doc/design-gfx-all-vm.md, decision 11). The monitor opens card*, holds master and passes the file to the compositor alone, for the screen’s modes and planes: the seat socket serves only the compositor’s pid, the compositor is not dumpable, every fork of either sweeps its descriptors before it runs other code (regress/testforksites.sh), and swm-wl offers no DRM lease. vmm-gfx and containers never hold a card* file. Under load at 4K the clients get fewer frames (below);
    • i915 and xe only. An AMD display GPU gets neither (amdgpu allows high priority only with CAP_SYS_NICE or on the master file, and its lockup timeout is a module word); nouveau and nvidia neither.
  7. vmm-gfx as a dom0 process: one a VM, its own uid and mount namespace, the render node only (never card*), no capabilities, never DRM master, its own seccomp list, its own cgroup with the VM’s CPU limit and a memory limit for its buffers’ shmem pages (i915’s own allocations are in no cgroup: doc/design-vmm-gfx.md, “Bounds”). The monitor starts it with the one path the tree chose; swm-vmm offers the guest only that path. Its crash takes only its VM’s GPU.
  8. Hang blame: the kernel names the context’s process in its reset report (“… in []”). The monitor reads only the kernel’s own records (facility 0) carrying the display GPU’s driver and device, takes the pid from the last bracket, ignores the name (the hanging process sets it), and maps the pid through its cgroup at once (a pid can be reused) to the vmm-gfx it started. Three hangs in a minute and the VM loses its GPU for the rest of the session. A reset that names no vmm-gfx is logged; three such in a minute, or a wedged GPU, turn the shared paths off for every VM and end the screen VM, until reboot.
  9. dom0 checks every guest buffer before the screen VM gets it: the fd is a dma-buf from the display GPU’s driver, and its format, modifier, stride and size fit the scanout; anything else is refused and blamed on that VM. dom0 never waits on a guest’s fence: it checks the buffer is ready without blocking (poll the dma-buf) before the screen VM samples it; a frame not ready shows the last good one.
  10. A hidden workspace does not draw: no frame callbacks (containers), “hidden” by each window’s configure (VMs: a 3D path has no scanout to ack). Two screens are the worst case: both are visible.
  11. A Thunderbolt GPU is not supported: the kernel has USB4 and PCIe hotplug off, and the gate refuses a removable device or one behind a hot-plug or Thunderbolt bridge. The 5060 Ti results below ran on another kernel and are evidence only.

Excluded, and why

Combination Why
SR-IOV on Tiger Lake (xe) dom0 drawing while a VF draws gives an “Engine memory CAT error” in dom0’s context, a GT reset, a 1 s stall in dom0 and 10 s in the guest; a VF starting while dom0 draws comes up wedged
Native context on xe neither Mesa nor virglrenderer has it
Venus on an Nvidia host Mesa hides VK_EXT_physical_device_drm on Nvidia hosts on purpose (vn_wsi.c: Nvidia cannot render to LINEAR), so wlroots and zink in the guest find no device
Zero copy from an Nvidia VFIO GPU Nvidia’s Vulkan refuses to import the virtio-gpu buffer (guest RAM); the frame is copied
Native context for Nvidia does not exist (closed, version-locked RM ioctls)

The measurements

QEMU 11.1.1, virglrenderer 1.3.0, Linux 7.2.7 to 7.2.9 (Void), Mesa 26.2, Nvidia 595.104.02 open in the guest; each VM 8 vCPUs and 8 GiB. The test machines: the laptop (Meteor Lake onboard GPU, RTX 2000 Ada); the desktop (Rocket Lake, UHD 730); the NUC, an Intel NUC (Tiger Lake, Iris Xe; RTX 5060 Ti over Thunderbolt). Firefox and Chromium on a page of three phases. Each cell is fps for WebGL / canvas / scroll. With dom0, frames are paced at 60 Hz; the no-GPU path runs at virtio’s 75 Hz.

Containers on the display GPU (the laptop, Meteor Lake)

A container’s frames reach dom0 as dma-bufs (step 26): the session draws with GLES2 on the display GPU. In these runs dom0 composited on the GPU itself, as it did before the screen VM; the screen VM does that work (doc/design-gfx-all-vm.md, “The measure”). Two trees on the same box, 2026-10-22: the session’s own buffers, dom0 checking each (step 26, bus minor 6), and the buffers dom0 makes and gives (step 3, doc/design-dom0-buffers.md, minor 7). A headless dev swm-wl on the GPU’s render node, one output a session (four outputs side by side for four sessions: each session’s frame is the whole extent, 7680 or 15360 wide), a scrotwmd session with no isolation on each, and the browser spawned in it. Linux 7.2.10, Mesa 26.2.4, Firefox 157, Chromium 155. Each cell: fps WebGL / canvas / scroll, the mean over the sessions, and the worst p99 ms of a phase; the median of three runs, the two trees taking turns to go first. CPU: dom0’s swm-wl, and every session and browser together, as % of one core.

Browser, size, sessions Session’s buffers (step 26) dom0’s buffers (step 3) dom0 CPU Sessions and browsers CPU
Firefox, 1080p, 1 61.0/61.0/60.0, p99 17 61.1/61.0/60.1, p99 17 1% / 1% 51% / 51%
Firefox, 1080p, 4 61.3/61.0/60.3, p99 17 61.3/60.9/60.3, p99 17 4% / 4% 219% / 219%
Firefox, 4K, 1 61.1/61.1/60.1, p99 17 61.1/61.0/60.2, p99 17 2% / 2% 64% / 64%
Firefox, 4K, 4 61.6/51.9/60.2, p99 41 61.7/49.7/60.2, p99 45.5 4% / 3% 262% / 252%
Chromium, 1080p, 1 57.1/61.1/61.0, p99 19.1 57.0/61.1/61.0, p99 19.8 1% / 1% 24% / 24%
Chromium, 1080p, 4 58.4/59.3/61.2, p99 20.0 58.5/58.7/61.2, p99 19.9 3% / 3% 78% / 76%
Chromium, 4K, 1 61.1/61.0/61.0, p99 17.2 61.1/61.0/61.0, p99 17.2 2% / 2% 26% / 25%
Chromium, 4K, 4 57.7/60.4/60.6, p99 19.7 57.7/60.3/61.3, p99 19.7 4% / 3% 71% / 75%

Every cell is within step 3’s bar: 3 fps and 5 ms at p99 of step 26’s, and dom0’s CPU no higher. Firefox’s canvas with four sessions at 4K is the GPU at its limit in both trees, and it moves between runs as much as between the trees: its row is the median of eight runs each, its pairs from 9.6 fps under to 7.1 over, 0.75 under on average. Every frame of every row came from a dma-buf: none copied, none refused. Not measured here: each session’s memory cgroup (these sessions have no isolation).

The same on the desktop (Rocket Lake, UHD 730), 2026-11-05, the same two trees (e57e4fed’s parent and e1096489), the same harness, three runs a cell, the trees in turn; fps/p99 ms of WebGL, canvas, scroll:

Browser, size, sessions Session’s buffers (step 26) dom0’s buffers (step 3) Against the bar
Firefox, 1080p, 1 61.7/17, 61.7/17, 60.4/17 61.0/17, 61.6/17, 60.9/17 meets
Firefox, 1080p, 4 61.3/34, 41.8/52, 60.2/17 61.3/39, 41.7/57, 60.1/23 misses: scroll p99 6 ms above
Firefox, 4K, 1 61.6/17, 37.9/36, 60.3/17 61.0/17, 37.7/36, 60.2/17 meets
Firefox, 4K, 4 20.9/154, 12.1/145, 38.3/163 20.9/167, 12.3/155, 39.2/169 misses: p99s 5 to 12 ms above, the GPU at its limit
Chromium, 1080p, 1 55.3/20.1, 53.2/22.2, 56.5/19.4 55.2/20.2, 56.3/21.9, 54.6/20.4 meets
Chromium, 1080p, 4 56.9/20.1, 60.0/21.4, 58.7/19.7 57.3/20.0, 58.6/21.0, 58.9/20.1 meets
Chromium, 4K, 1 61.3/16.8, 61.3/16.8, 55.7/19.6 61.1/16.8, 61.2/16.8, 61.1/16.8 meets
Chromium, 4K, 4 36.2/400, 29.5/367, 53.8/33.4 35.9/383, 29.3/367, 54.0/33.3 meets

Every frame rate is within 3 fps. The misses are Firefox’s p99s with four sessions, where a frame takes 17 to 170 ms; dom0’s CPU is the same in both trees (1 to 5%). Three rows of the first batch died on the harness’s own CPU sum (a process gone between two reads of /proc) and were run again after its fix.

One VM

Path, host 1080p Firefox 1080p Chromium 4K Firefox 4K Chromium dom0 ms 1080p / 4K
Host native, Rocket Lake 59/61/59 59/60/60 60/41/59 60/61/60 -
VFIO Ada, rendering only 61.7/61.8/61.9 61.8/61.9/61.7 61.6/61.8/61.9 61.8 all -
VFIO Ada, with dom0 57/58/57 57/57/57 54/54/54 54/54/54 2.4 / 4.7
VFIO 5060 Ti (Thunderbolt, evidence only), with dom0 59/58/59 59/56/57 27/41/54 54/54/54 1.9 / 6.5
Native context Tiger Lake, with dom0 59/60/60 59/59/59 59/51/59 59/60/59 1.5 / 3.6
Native context Rocket Lake, with dom0 59/58/59 59/60/59 53/32/59 58/49/58 1.9 / 6.8
Venus Tiger Lake, with dom0 30/59/59 55/56/58 34/52/59 55/57/58 1.9 / 3.9
Venus Rocket Lake, with dom0 40/59/59 58/56/59 37/24/50 48/39/54 -
Venus Meteor Lake, with dom0 54/59/59 59/59/60 47/59/59 59/59/59 0.7 / 1.5
SR-IOV VF Tiger Lake, rendering only (excluded) 61.5 all 61.5 all 61.5 all 61.5 all -
No GPU Tiger Lake, with dom0 63/75/75 16/75/75 14/41/75 3/36/46 2.2 / 9.3

Firefox’s 4K WebGL on the 5060 Ti is CPU bound (97% of a core). The VFIO copy into dom0’s buffer costs 1.1 ms (1080p) and 2.3 ms (4K) on the Ada. No GPU costs the browser up to 3 cores and is not usable for WebGL.

Native context on Meteor Lake

Under QEMU, the VMM the other measurements ran on, the GPU hangs again and again: 14 hangs in 3 minutes, the same with virglrenderer and Mesa main (2026-10-10). Under swm-vmm it does not. The cause is how guest memory is cached: with KVM’s quirk (below) off there is no hang, with it on the GPU hangs in the first page load.

A CPU can map memory write-back (writes stay in the CPU’s cache until it evicts them) or write-combined (writes skip the cache and go to memory). Meteor Lake’s GPU shares no last-level cache (the CPU’s largest cache) with the CPU, so it does not see what sits in the CPU’s cache. On Meteor Lake, Mesa’s Intel OpenGL driver (iris) sets each buffer’s caching when it makes the buffer (the kernel’s PAT index, PAT being the x86 table of memory types): batches (the command buffers the GPU runs) and most buffers are write-combined. virglrenderer in dom0 maps such a buffer write-combined, and so does the guest. But KVM by default ignores the memory type the guest asks for and maps all guest memory write-back, through the cache (the quirk KVM_X86_QUIRK_IGNORE_GUEST_PAT). The guest’s writes to a batch then stay in the CPU’s cache, the GPU reads the stale bytes in memory as commands, and hangs. QEMU leaves the quirk on. swm-vmm turns it off when the VM has a GPU (KVM_CAP_DISABLE_QUIRKS2), so the guest’s write-combined mapping holds. Tiger Lake and Rocket Lake share the CPU’s cache, and iris sets no caching per buffer there (Mesa’s source does so only where the GPU shares no cache); they never hung.

KVM allows turning the quirk off only on a kernel that has it and a CPU with self-snoop (the CPU keeps its caches correct across memory types; the ss flag in /proc/cpuinfo); the laptop’s CPU has it. Where KVM refuses, swm-vmm says so in its log and the guest’s memory stays write-back.

The test: the laptop, Linux 7.2.10, swm-vmm with 8 vCPUs and 3 GiB, rendering only (no dom0), every engine’s preempt timeout at 100 ms as dom0 sets it, Mesa 26.2.3 in the guest. The browser loads the page of three phases (above) again and again for 30 minutes, at 1080p. fps is the lowest of any load and phase; p99 (the frame time 99% of frames beat) the highest; frames over 20 ms the total over all loads:

Browser Page loads fps WebGL / canvas / scroll Worst p99 Frames over 20 ms GPU hangs
Firefox 56 59.7/59.8/59.7 18 ms 55 0
Chromium 57 59.6/59.7/59.7 17.9 ms 18 0

The same run with the quirk left on hangs the GPU in the first page load. Not measured on this path: 4K, with dom0, several VMs, a guest that hangs the GPU on purpose, and the kernel config that ships.

The RTX 2000 Ada given whole to swm-vmm

On the Meteor Lake laptop, under Void Linux’s 7.2.10 kernel: swm-vmm started as root by regress/vfio_start.sh with the card passed whole, 3 GiB of RAM and 8 vCPUs. The VMM is given the VFIO container (the kernel object that holds the VM’s IOMMU mappings), the card’s IOMMU group and its functions’ addresses (-C, -V and -A). This measures the start and the isolation facts only, not the frame rate, a hang, the state a reset clears or the interrupt path.

The RTX 2000 Ada’s frames copied out of its VM

Same box and setup as above, with Nvidia’s open driver 595.104.02 in the guest kernel and Nvidia’s libraries in the guest’s root; Firefox 158.0.1 and Chromium 155.0.8059.39 in the guest. The guest’s compositor draws each frame on the Ada. dom0 cannot read a GPU that belongs to a VM, so the guest copies each finished frame out of the GPU into the pixel window: memory the VM and dom0 share, which dom0 then shows. The guest asks the GPU to transfer the frame’s changed rows into a buffer in guest RAM (a pixel buffer object), and copies those rows from that buffer into the pixel window once the GPU signals that the transfer is done (a fence: a marker the GPU signals when the work queued before it has finished). Issuing the read queues the GPU’s transfer and should return at once; “the copy” below means only the CPU’s copy into the pixel window.

The other end is not swm-wl but a test program (regress/vm_d0.c) that stands in for it: at each of its own 60 Hz frames it uploads the whole pixel window into a texture on the Meteor Lake GPU, as swm-wl does on a GPU that cannot read the pixel window in place, and draws it. It never tells the guest a frame was shown, so the guest never waits for it. The test page draws a frame counter in a strip at its top and one at its bottom; the stand-in reads both at each upload. A frame “shown” is a counter the stand-in uploaded; a “torn” frame is one whose top and bottom counters differ, because the guest wrote the pixel window while dom0 read it. p50 is the median; p99 is the value 99 of 100 samples stay under. Each cell is the median of three runs. These runs differ from the One VM table above, which ran under QEMU with a compositor of the bench’s own.

Frames shown a second, WebGL / canvas / scroll:

Size Firefox Chromium stand-in ms a frame
1080p 59.6 / 57.2 / 56.8 55.2 / 59.6 / 56.2 2.0
4K 58.5 / 45.2 / 57.9 58.1 / 58.4 / 58.2 4.3 to 4.8

The same browsers with a test build of the guest’s compositor that copies nothing: 1080p Firefox 60.0 / 58.6 / 57.5, Chromium 52.0 / 59.7 / 55.2; 4K Firefox 60.7 / 59.4 / 49.3, Chromium 57.9 / 58.6 / 53.4. These are the page’s own rates, and they vary from run to run: Chromium’s 1080p WebGL showed 55.2 frames with the copy and drew 52.0 without it, so its lower 1080p rates are the browser’s. Firefox’s 4K canvas varied most: one run of three lost almost no frames on the way to dom0, the others drew 56 and 46 frames a second and dom0 showed 45 and 29.

The same read in a container’s compositor on the Meteor Lake GPU, the one dom0 draws with (Firefox WebGL): 1080p 59.6 frames shown a second with a read that blocks until the GPU finishes, 59.7 with the read described here; issuing takes 0.21 to 0.27 ms at p99 and the copy 0.97 ms on average. At 4K, 58.4 frames shown with the blocking read and 50.7 with this one: the frame waits on its fence 8 ms at p99 there, probably because the stand-in and the browser share that GPU.

Several VMs on one GPU (4K, rendering only)

VMs Rocket Lake native context, Chromium Rocket Lake native context, Firefox Meteor Lake Venus, both browsers
1 59/60/59 59/40/58 ~53 all
2 60/33/60 each 47/16-22/59 each 49-54 each
3 40/21/60 each 29-31/9-15/61 each 45-54 each

Two screens, both visible (the Rocket Lake desktop, native context)

A container on one screen, a VM on the other. At 1080p both stay near native (59 to 61 fps; dom0 2.3 ms a frame on average). At 4K the GPU is the limit. With dom0 at normal priority, dom0 composited only 669 of 1911 frames, p99 597 ms; at high priority all frames, p99 24 ms, while the VM fell from 48/28/45 to 43/17/37 (Chromium) and 40/20/38 to 34/13/31 (Firefox). The GPU’s time is not split fairly between a container and a VM: that needs a DRM scheduling cgroup (drm.weight), not in Linux.

A guest that hangs its GPU while dom0 draws

This tests availability only. Not tested: what one VM can read of another’s GPU memory, and whether a guest can open a path the tree did not choose.

Path The guest dom0 A new VM after
VFIO (5060 Ti) its GPU reset after 15 s; the app told “guilty” no stall (worst frame 2 ms) works, after the reset
Native context (Tiger Lake, Rocket Lake) only its context reset; the app told “guilty” stalls for the render engine’s preempt timeout: 7.8 to 8 s at 7500 ms (Gen12’s default), 0.11 s at 100 ms works
Venus (Meteor Lake) only its context reset; the app not told, and hung at exit; other VMs fine 7.5 s at 7500 ms, 0.1 s at 100 ms works
SR-IOV (Tiger Lake) wedged, or a 10 s stall GT reset, 1 s stall -

On the host alone (the Rocket Lake desktop, i915): one client hangs an engine (a batch that branches to itself, arbitration off), and another submits empty batches to the same engine. The tables give the stall the second client sees; the kernel told the first client “guilty” every time. “Stock” is the stall with the engine’s preempt timeout at its default, shown in parentheses; “100 ms” is the stall with the timeout at 100 ms, the setting rule 6 requires:

Engine Stock 100 ms
render (rcs0) 7743 ms (7500) 110 ms
copy (bcs0) 670 ms (640) 108 ms
video (vcs0) 694 ms (640) 106 ms
video enhance (vecs0) 653 ms (640) 105 ms

A GLES client hung by a looping shader: 7636 ms and 110 ms.

The same on the Meteor Lake laptop (i915 scheduling through the GuC, Void Linux’s 7.2.10 kernel), the timeout set in sysfs. It adds the compute engine (ccs0), which a job reaches only through its context’s list of engines, not through the older fixed engine numbers:

Engine Stock 100 ms
render (rcs0) 7502 ms (7500) 102 ms
compute (ccs0) 7502 ms (7500) 101, 102, 102 ms
copy (bcs0) 642 ms (640) 102 ms
video (vcs0) 641 ms (640) 101 ms
video enhance (vecs0) 641 ms (640) 101 ms

vCPUs and ioeventfd, without a GPU

QEMU on the desktop (Rocket Lake), the bench guest, no GPU, 4K, 2026-10-12, fps:

vCPUs Firefox WebGL Chromium WebGL canvas, scroll
1 6.1 1.3 ~48
2 10.5 2.6 ~48
4 16.3 4.9 ~48
8 20.3 7.4 ~48

ioeventfd on or off: the same at every count (within 0.1 fps). So swm-vmm has vCPUs and no ioeventfd; the default is 8, capped by the machine and the quota.

swm-vmm against QEMU -M microvm, the same guest-std 7.2.9 kernel, initramfs and disk (the desktop’s root and the bench), no quota, the desktop, 4K, medians of 3 (2026-10-12), WebGL fps / p99 ms, canvas, scroll:

vCPUs Firefox swm-vmm Firefox QEMU Chromium swm-vmm Chromium QEMU
8 21.7 / 78, 49.7, 42.4 22.2 / 77, 48.7, 43.1 7.4 / 140, 48.2, 49.2 7.4 / 142, 48.1, 49.4
4 16.8 / 90 17.0 / 90 4.9 / 219 4.9 / 218
2 10.8 / 121 11.0 / 107 2.6 / 396 2.6 / 396
1 6.2 / 216 6.3 / 188 1.3 / 1000 1.3 / 748

At 8, within 0.5 fps and 2 ms. At 1 and 2 vCPUs swm-vmm’s p99 is worse (a single vcpu serves every exit, a disk request among them, in its own thread); below the default, and noted.

vmm-gfx against QEMU, one VM, rendering only

vmm-gfx is the dom0 process that runs one VM’s GPU commands on the display GPU (doc/design-vmm-gfx.md); swm-vmm sends them to it. Here swm-vmm with vmm-gfx runs against QEMU 11.1.1 with virglrenderer 1.3.0 in its own process: the same guest-std 7.2.9 kernel, disk and page, 8 vCPUs, 3 GiB of guest RAM, each side’s cgroup (the kernel’s group of processes that it charges and limits) at cpu.max 8 CPUs, the same hours. Rendering only: nothing is shown in dom0. Each cell is fps / p99 ms of WebGL, canvas, scroll (p99: 99 frames in 100 took no longer), the median of three runs. The bar is step 12’s: each phase within 3 fps of QEMU, p99 within 5 ms. vmm-gfx’s memory.max, its cgroup’s memory limit, is the guest’s RAM and 8 GiB (the design’s decision 6); the first three runs had it at the guest’s RAM alone. Four rows (native context’s Chromium 4K; Venus’s Firefox 4K and Chromium 1080p and 4K) are from three runs each at the new bound with vmm-gfx’s timer slack at 1 ns (below), QEMU again in the same hour. The other rows are from the first three runs; one run of each at the new bound, with the vmm-gfx of the change that set it, was within 0.5 fps of them.

Rocket Lake (the desktop, UHD 730), 2026-10-17:

Path, browser, size swm-vmm and vmm-gfx QEMU Against the bar
Native context, Firefox, 1080p 57.5/18, 59.5/17, 57.6/18 59.2/17, 60.7/17, 59.4/17 within
Native context, Firefox, 4K 57.9/18, 40.1/34, 57.7/18 59.4/17, 40.3/34, 59.3/17 within
Native context, Chromium, 1080p 57.3/18.6, 59.8/17.1, 57.4/18.5 58.2/18.2, 60.4/17, 58.4/18.1 within
Native context, Chromium, 4K 57.8/18.6, 23.0/97.1, 57.6/18.4 59.2/17.7, 23.3/92.8, 59.1/18.2 on the bar: canvas p99 4.3 ms over by the medians, over 5 ms in two of five pairs (below)
Venus, Firefox, 1080p 53.6/20, 54/20, 49.7/22 54.4/19, 54.3/19, 51.4/22 within
Venus, Firefox, 4K 42.2/26, 26.7/40, 38.1/29 42.4/25, 26.7/39, 39.6/29 within (scroll 1.5 fps under)
Venus, Chromium, 1080p 54.3/20.1, 54.3/20.9, 53.0/21 52.9/21.1, 54.4/22.4, 52.5/21 within
Venus, Chromium, 4K 42.0/40.5, 41.1/40, 39.7/41.6 43.0/39.8, 42.1/39.6, 40.2/41.6 within

Native context’s Chromium 4K canvas, with vmm-gfx’s memory.max the guest’s RAM: 9.4 fps, p99 676 ms; vmm-gfx sat at its limit and its pages were taken back again and again. At the guest’s RAM and 8 GiB: 22.9 fps in each of three runs, p99 96.8, 116.9 and 114.8 ms, against QEMU’s 93.1 to 93.7. A guest of 1 GiB, the same run: 22.9 fps, p99 96.3, against QEMU’s 23.4 and 91.9. The canvas holds about 7 GiB of GPU buffers on both sides: vmm-gfx’s peak was 7.3 to 7.6 GiB, of it 7.0 to 7.4 GiB the buffers’ shmem (the memory-backed file pages i915 keeps a GPU buffer in on these GPUs); QEMU’s whole process held 7.0 to 7.3 GiB of shmem at its peak, beside the guest’s RAM. In one run each, memory.stat at the highest memory.current sampled every 0.5 s: QEMU’s cgroup 8.00 GiB, 0.94 GiB of it anonymous memory (the guest RAM the guest touched) and 7.05 GiB shmem; vmm-gfx’s 7.31 GiB shmem. The kernel’s own peaks of the same cgroups (memory.peak, not sampled) were 8.27 and 7.33 GiB. Nothing is counted twice, and there is no gap between the two.

In the same hour, before the change, two Venus cells missed the bar, and so did native context’s Chromium 4K canvas p99 by its median (its three runs 97.5, 111.8 and 116.6 ms against QEMU’s 92.8). The medians of three (fps/p99 ms; before, 1 ns, QEMU): Venus Chromium 4K canvas 38.1/45.6, 41.1/40.0, 42.1/39.6; Venus Chromium 1080p canvas 52.5/35.1, 54.3/20.9, 54.4/22.4; native context Chromium 4K canvas 22.8/111.8, 23.0/97.1, 23.3/92.8.

The cause of the two Venus misses was the timer slack: how late Linux may wake a thread from a timed sleep, 50 us by default. QEMU sets its own to 1 ns, and its render server’s threads inherit it; vmm-gfx kept 50 us. Venus’s ring thread waits for the guest’s next command with sleeps of 10 us and up, so each sleep was late, and vkr’s ring threads slept less than a third as often (8,627 sleeps in 4 s against QEMU’s 30,909). Between the wakeups the CPU package went into its deeper idle states (C2 and C3, which take longer to leave), which it never entered under QEMU, and the GPU ran slower. With the slack at 1 ns the package stayed out of them; whether the GPU’s clock came back is not clear from the one run measured. The design’s measure gives the runs and counters.

Venus Firefox’s 4K scroll, which missed by 3.2 fps in the first three runs, was within the bar in the same hour before the change: 37.4 against QEMU’s 39.6 (the first runs’ QEMU gave 40.5), so that miss was run-to-run spread. The slack moved it a little and in each run: 37.3, 37.4 and 37.5 before, 37.8, 38.1 and 38.2 at 1 ns.

Native context’s Chromium 4K canvas p99 is on the bar, not settled. The vmm-gfx before the change gave 111.8, 116.6 and 97.5 ms in the same hour and 123.1 and 96.7 ms in two later runs, so two of its five runs already sat where the 1 ns runs sit (96.9, 97.1, 97.1); QEMU’s own runs spread from 86.3 to 94.5. Run against the QEMU run of its own round, the 1 ns vmm-gfx was 10.6, 2.6 and 4.3 ms over, and in two later pairs 3.8 and 7.7: two of five over the 5 ms bar. Native context has no ring thread, and in the windows traced vmm-gfx made no nanosleep there and polled with no timeout, so the slack has no known way to move this p99, and the medians do not show that it did.

The cost is power, measured in one run. In the Venus Chromium 4K canvas’s 6 s window the CPU package drew 217.8 J (RAPL, the CPU’s own energy counter) with the slack at 1 ns, against 152.0 to 183.5 J in four runs before and 206.2 to 247.0 J in four under QEMU: about 6 to 11 W more than before. The runs of the table did not measure power; native context, the other rows and an idle VM are not measured.

Also measured there:

Owed: the same rows on Tiger Lake (native context and Venus) and on Meteor Lake (Venus); a Vulkan game’s largest command stream; and the crash legs this bench cannot run, because they need dom0 and its monitor: the alert the user sees, dom0’s frame time, a vmm-gfx that crashes on a fault, and GPU work queued when vmm-gfx is killed.

The gfx VM against Venus in dom0

The gfx VM (above, “What a VM gets”) against Venus with vmm-gfx in dom0, on the desktop (Rocket Lake, UHD 730), the same hours. Each client is the guest of “vmm-gfx against QEMU” above, with its disk and page but guest-std 7.3 (the tree’s signed guest kernel), 8 vCPUs, 3 GiB of RAM, its VMM’s cgroup at cpu.max 8 CPUs. On the gfx VM path the gfx VM runs as dom0’s monitor starts it: 3 GiB of RAM, 4 vCPUs, its cgroup at cpu.max 4 CPUs. Rendering only: nothing is shown in dom0. Each cell is fps / p99 ms of WebGL, canvas, scroll (p99: 99 frames in 100 took no longer), the median of three runs where a table says no other. The bar: each phase within 3 fps of Venus in dom0, p99 within 5 ms, the path’s CPU-seconds a frame at most 1.5 times Venus in dom0’s, and its joules a frame at most 1.25 times (doc/design-gfx-vm.md, decision 12; the CPU bar is 1.5 for the floor measured at the end of this section). Measured 2026-10-25 with the tree at 1975198b, where swm-vmm turns KVM’s halt-poll off for each VM (below); the runs alternate, gfx VM then dom0, cell by cell.

One client:

Browser, size gfx VM Venus in dom0 CPU-s over 30 s; a frame, against dom0 Joules over 30 s; a frame, against dom0 Against the bar
Firefox, 1080p 53.0/19, 53.2/20, 49.5/23 54.0/19, 54.1/19, 51.3/22 21.4 against 16.1; 1.36 901 against 787; 1.17 meets
Firefox, 4K 41.9/25, 26.2/42, 36.6/31 42.4/25, 27.1/39, 38.1/29 20.3 against 15.6; 1.34 797 against 762; 1.07 meets
Chromium, 1080p 53.1/21.5, 52.9/23.0, 51.7/21.5 54.3/20.2, 54.4/21.6, 52.6/21.1 16.5 against 12.5; 1.35 790 against 726; 1.12 meets
Chromium, 4K 41.3/41.3, 41.0/40.6, 39.0/41.6 42.7/40.3, 41.7/40.7, 39.5/41.6 15.1 against 11.6; 1.32 840 against 744; 1.15 meets

CPU-s: the CPU-seconds over the same 30 s of the page, summed over every process of the path (the client’s VMM; on the gfx VM path also the gfx VM’s VMM with its vCPUs and the slots’ vmm-gfx in dom0; in dom0 the client’s vmm-gfx; the slots’ vmm-gfx are dom0’s processes, one a client of the gfx VM), the median of three runs. Joules: the CPU package’s energy over the same 30 s (RAPL, the CPU’s own energy counter). A frame: each run’s CPU-s or joules divided by the sum of its three phases’ fps, the median of the three runs’ ratios against dom0’s; so a ratio is not the 30 s numbers’ quotient.

Two to four clients at 4K, each cell the median of the clients’ own: two clients from one run, three and four from three runs each, gfx VM and dom0 runs alternating:

Clients, browser gfx VM Venus in dom0 CPU-s and joules a frame, against dom0 Against the bar
2, Firefox 29.6/56.5, 14.3/76.5, 41.1/31 29.0/55, 14.9/72.5, 41.5/30 1.34, 1.15 meets
2, Chromium 36.1/46.7, 26.9/61.1, 43.3/23.9 34.6/45.9, 25.6/56.7, 43.8/28.6 1.28, 1.16 meets
3, Firefox 19.0/96, 10.4/132, 31.9/40 18.6/89, 10.8/140, 32.9/38 (eight clients) 1.36, 1.15 misses: WebGL p99 7 ms above dom0’s
3, Chromium 24.8/61.2, 18.6/106.4, 35.1/41 24.4/86.2, 17.7/84.8, 36.7/45.8 1.22, 1.20 misses: canvas p99 21.6 ms above dom0’s
4, Firefox 14.2/119, 8.4/226, 21.7/54 14.1/119.6, 8.3/241, 23.4/54.5 1.31, 1.04 meets
4, Chromium 18.6/100.2, 14.4/147.9, 28.5/55.2 18.1/110.3, 13.4/139.5, 26.4/61.2 1.09, 1.2515 misses: canvas p99 8.4 ms above dom0’s; joules 0.0015 over the bar

CPU-s and joules over a run, all the clients’ processes summed, divided by all the clients’ frames, the median of the runs. From three clients on, every cell’s frame rates meet the bar; the misses are p99s, where a frame takes 40 to 240 ms and the GPU is the limit on both paths, and four Chromium clients’ joules by 0.0015. The p99s spread both ways: at three Chromium clients the canvas p99 is 106.4 against 84.8, the scroll p99 41 against 45.8. Of the three runs of three Firefox clients in dom0, one client’s result is missing (its browser wrote no page result), so that cell is the median of eight.

The three cells that missed, run again until each had nine runs on each path, all from one build (the desktop, 2026-10-27), each value the median of the nine runs’ client medians, the gfx VM’s p99 less dom0’s:

Clients, browser WebGL p99 Canvas p99 Scroll p99
3, Firefox +2 ms -4 ms +2 ms
3, Chromium -22 ms +23.4 ms -4.6 ms
4, Chromium -12.6 ms +9.5 ms -5.5 ms

Three Firefox clients meet the bar. Chromium’s canvas misses it, and its WebGL is faster than dom0’s by about as much. Its frame rates and p50s are the same or better through the gfx VM (canvas at three clients: 18.5 fps and p50 54.9 ms, against 17.5 and 57.1). The clients start within 10 ms of each other on both paths, and the gfx VM with two vCPUs gives the same split. The five longest frames of each phase are spread over the phase on both paths, with no single stall: through the gfx VM, canvas has many frames of 104 to 113 ms and WebGL of about 60 ms; through dom0, canvas 75 to 80 ms with one or two spikes, WebGL 80 to 85 ms. Why the GPU’s time is split this way is not known (ROADMAP.md, “Measure the GPU path on hardware”).

Also measured there:

Where the CPU time went: KVM’s halt-poll. KVM spins a halted vCPU up to 200 us (the desktop’s halt_poll_ns, the kernel’s default) before it sleeps, on the VMM’s thread and inside its cgroup’s cpu.max; the gfx VM halts at each of vkr’s ring sleeps, thousands of times a second. swm-vmm turns the poll off for each VM (KVM_CAP_HALT_POLL 0, vmm/kvm.c). Chromium at 1080p, one run each, the same 30 s:

swm-vmm gfx VM path Venus in dom0
with the poll: CPU-s (client; gfx VM with its slots) 37.7 (21.8; 16.0) 13.6 (11.9; vmm-gfx 1.7)
with the poll: fps/p99 ms 49.1/21.9, 46.5/38.6, 47.9/23.2 54.3/19.7, 54.2/35, 52.5/21
without: CPU-s 16.6 (10.1; 6.5) 11.9 (10.2; 1.7)
without: fps/p99 ms 53.5/19.4, 52.9/24, 52/21.5 54.3/19.8, 54.4/21.8, 52.8/21.1

Without the poll the gfx VM path’s frames meet the bar, and its CPU time is 1.40 times over the 30 s; what is left is the gfx VM’s own, its vCPUs woken 11,500 to 12,300 times a second (measured below). The tables at the start of this section are without the poll.

What wakes the gfx VM. vkr, virglrenderer’s Venus renderer, runs in the gfx VM. Each guest context has a ring: shared memory the guest’s Mesa writes Vulkan commands into. vkr’s thread for the ring waits for the next commands by yielding 16 times, then sleeping: 10 us sixteen times, then 20 us thirty-two times, and so on, until the ring’s idle timeout (1 ms, which the guest’s Mesa sets), about 50 sleeps in a quiet millisecond. Then the thread idles and waits for a notify: the guest’s write to the ring’s doorbell, a VM exit (the vCPU stops and the VMM serves it). While the thread is awake Mesa sends no notify; once it idles, Mesa notifies at each submit. In the gfx VM each sleep is a vCPU’s timer and its halt, so each is a wakeup of a vCPU.

Ways to wake the gfx VM less, each against the gfx VM as it is (A) and Venus in dom0, on the desktop, 1080p, one client, three runs a cell, the cells in turn, 2026-10-25. KVM’s halt-poll (above) spins a halted vCPU a while before it sleeps; here it is set on the gfx VM’s VMM alone, the clients’ kept at 0. CPU-s: the CPU-seconds of the same 30 s, summed over the client’s VMM, the gfx VM’s VMM with its vCPUs and the slots’ vmm-gfx in dom0 (in dom0: the client’s VMM and its vmm-gfx), the median of three; where a cell has two values, A and dom0 were measured in two sets of three, one with each of the next rows. Wakeups: the voluntary context switches of the gfx VM’s threads, a second. Joules: the CPU package’s energy over the 30 s (RAPL, its own counter), the median:

Chromium, 1080p CPU-s Against dom0 Wakeups a second Joules Canvas fps/p99 ms
A 17.0, 17.2 1.35, 1.38 11,500 to 11,700 827, 806 52.9/23.7, 53.2/21.7
vkr idles at its 16th wait, then waits for a notify or the timeout (*) 29.6 2.43 524 47.3/38.6
vkr sleeps 100 us each time 24.1 1.91 5,300 645 50.3/37.2
vkr sleeps 50 us, doubling, at most 200 us 26.6 2.11 4,800 603 49.3/38.4
halt-poll 10 us, the gfx VM alone 18.2 1.46 9,000 829 52.8/22.6
halt-poll 20 us, the gfx VM alone 34.6 2.77 4,100 531 48.1/37.7
Venus in dom0 12.6, 12.5 1 711, 720 54.2/23.4, 54.3/21.5

(*) Measured in a set of its own, against A at 17.8 and dom0 at 12.2 CPU-s, the ratio against that dom0.

Firefox, CPU-s against dom0’s 16.0 and 15.9: A 21.2 and 21.6 (1.33 and 1.36 times; 12,200 to 12,300 wakeups a second; 934 and 950 J against 828 and 814); idle at the 16th wait 24.6 against 16.1 (1.53); 100 us 23.1 (1.44); 50 to 200 us 23.6 (1.48); halt-poll 10 us 22.1 (1.39); 20 us 28.4 (1.79). None cost less CPU than A. Once vkr idles, Mesa notifies at each submit, each an exit; a longer sleep picks commands up later, and the client’s side spends the wait; a poll spends the time a wakeup saved. The rows that wake the gfx VM least use the least energy, for reasons not measured.

The gfx VM as it is costs about 14 us of CPU a wakeup: Chromium’s A takes 4.7 CPU-s over 30 s more than Venus in dom0 (17.2 less 12.5) at 11,500 wakeups a second; Firefox’s 5.7 (21.6 less 15.9) at 12,200 is about 15 us. At 1080p its joules a frame are 1.12 to 1.16 times Venus in dom0’s for Chromium and 1.13 to 1.17 times for Firefox; the frame rates differ by less than 2 fps, so joules a frame and joules over the 30 s give ratios within 0.05 of each other. That floor is why the CPU bar is 1.5 times (doc/design-gfx-vm.md, decision 12). vkr in the gfx VM holds the guest’s idle timeout to 200 us to 2 ms (bin/swm-wl/virglrenderer.patch).

Owed: the same rows with frames shown in dom0 (dom0’s time a frame, and a map’s round trip through the gfx VM); the alert the user sees when a slot or the gfx VM dies, and the restart, which need dom0’s monitor.

Again on the desktop, 2026-11-05, against the reference build (doc/design-gfx-vm.md, decision 56: dom0’s vmm-gfx of the tree before PR 12, Venus on i915, digest fb5d0c0251bbfbf1), one client, guest-std 7.3 with the compositor’s zink line, the gfx VM as the monitor starts it (regress/vfio_start.sh gfxvm and ref, regress/Makefile’s measure-gfxvm): the median fps / p99 ms of nine page runs (three runs of three). Every browser on zink over Venus (“ANGLE (Mesa, zink Vulkan 1.4(Virtio-GPU Venus (Intel® Graphics (RKL GT1))”):

Browser, phase 1080p gfx VM 1080p reference 4K gfx VM 4K reference Against the bar
Firefox WebGL 56.4/19.0 57.3/19.0 39.4/44 39.4/43 meets
Firefox canvas 58.2/21.0 58.7/21.0 25.0/67 25.8/59 misses at 4K: p99 8 ms above
Firefox scroll 53.3/21.0 54.3/20.0 51.5/35 52.2/35 meets
Chromium WebGL 56.2/19.2 57.3/19.1 41.9/45.4 42.5/41.8 meets
Chromium canvas 51.3/35.5 55.1/34.6 33.7/46.8 34.4/44.5 misses at 1080p: 3.8 fps under
Chromium scroll 53.4/21.1 54.5/20.6 45.8/41.7 46.3/44.1 meets

The canvas phase is the gap again, now at one client: Chromium’s frame rate at 1080p, Firefox’s p99 at 4K. CPU and joules not measured in this run.

Chromium’s 1080p canvas, traced (the desktop, 2026-11-06): its canvas phase alone for 20 s, three runs a path in turn, each client’s GPU time from i915’s fdinfo (drm-engine-render) read each second, and i915’s request adds. The two paths do the same work in the same GPU time:

Run gfx VM fps/p99 GPU, Venus contexts Reference fps/p99 GPU, Venus contexts
1 50.6/35.8 47.2%, 8.2% 55.6/34.6 48.7%, 8.4%
2 56.4/20.5 53.0%, 8.6% 50.9/50.8 48.7%, 8.8%
3 50.6/36.2 47.8%, 8.4% 57.2/21.0 49.9%, 8.3%

vm_d0’s copy-out took 4.5 to 4.7% in each. Requests per context were the same (about 10,500 and 5,300 a run on both). Each run falls in one of two modes on either path, about 51 fps with 217 to 276 frames over 20 ms or about 56 fps with 15 to 88, so the 3.8 fps of the table is where the medians fell, not a cost of the gfx VM. What picks the mode is not known; it is the same on both paths.

swm-vmm’s interrupt path, without a GPU

What a device’s interrupt costs a swm-vmm guest, on its PCI bus (doc/design-vm-pci.md, “What the measure found”), the desktop and the laptop, guest-std 7.2.9, 8 vCPUs, 2026-10-18. An exit is the guest stopping for swm-vmm to serve an access, and going on. Counted by a build of swm-vmm that counts its exits by address, made for the measure and kept outside the tree with its logs (~/tmp/vm-bench/pci-measure/ on the laptop):

Interrupt Exits to swm-vmm
virtio-mmio, the disk on an IO-APIC line 2: InterruptStatus read, InterruptACK written (2,001 interrupts, 4,002 exits)
MSI-X, the entropy device on virtio-pci 0 (65,537 interrupts, no exit)

Each request also costs its notify, one exit, on either transport. Timed from the guest, the median of 10 runs, each the mean of 200,000: the disk’s InterruptStatus read and InterruptACK write, in turn as the guest’s handler makes them, cost 4.24 µs on the desktop and 4.52 µs on the laptop (one port read 1.56 and 1.69 µs; one store to an MSI-X table 2.00 and 2.09 µs). That is a lower bound of a virtio-mmio interrupt’s cost to a vCPU: it leaves out swm-vmm’s KVM_IRQ_LINE that raises the line, and the guest’s EOI, which exits to KVM for a level line and is served in the kernel, unseen by the counting build. An MSI-X interrupt has neither under APICv. So 1% of one vCPU, the bar at which virtio-gpu would move to virtio-pci, is at most 2,400 virtio-mmio interrupts a second on the desktop. Owed: virtio-gpu’s interrupts and notify exits a second on native context’s Chromium 4K canvas (the row on the bar, above), which says on which side of it virtio-gpu is.

swm-vmm’s guest console

The tree’s guest kernels’ console is hvc0, a port of swm-vmm’s virtio console, since step 18’s decision 14; a config’s own kernel keeps the serial console, ttyS0. Measured on the desktop, guest-std 7.2.9, 8 vCPUs, 2026-10-18, with the VMM at 4c8558a, step 18’s first console commit, before the console’s notify was bounded and its write moved out from under the device’s lock (doc/design-vm-pci.md, “The console on hvc0, measured”). The serial console it replaced cost two exits a byte; a boot wrote about 22.9 KB before “Run /init”, 47,165 exits, as a measure-only counting build of the VMM counted them. hvc0 sends 16 bytes a notify: 1,593 notifies for the same bytes.

The shipped VMM before the change (ttyS0) and after it (hvc0, at 4c8558a), boot to “Run /init”, median of 20 with its IQR, three interleaved sets:

ttyS0 (before) hvc0
No bus, ms 236.0 (235.2-236.9), 235.9 (235.3-237.2), 236.2 (235.3-237.2) 177.8 (176.7-179.9), 180.0 (177.4-182.7), 180.1 (178.2-181.4)
A session’s shape, with a bus, ms 237.4 (236.3-238.7), 238.2 (237.0-239.1), 238.2 (236.5-238.6) 179.6 (177.8-182.2), 178.5 (177.6-179.3), 178.8 (177.7-180.3)
One 66-byte console line, a measure-only VMM build, median of 50 216.4 µs 16.3 µs

The line’s cost measured again on the desktop, 2026-10-19, with the console’s notify bounded, kernel/patches/0006 and the tree rebased onto step 19 PR 1, the same build and guest program: 216.0 µs on ttyS0, 16.5 µs on hvc0, median of 50 (doc/design-vm-pci.md, the cost of one console record). The VMM’s time inside one console notify, 1.17 µs, is 4c8558a’s, and was not measured again.

A config’s own kernel on ttyS0 pays the PCI bus’s log on the UART: its boot to “Run /init” is 4.2 to 6.5 ms longer under the shipped VMM than under the VMM before step 18 (difference of medians, six sets of 20 on the desktop), over M2’s 5 ms bar, which is for the tree’s kernels.

A panic before the console port is up prints nothing; the VM still ends by panic=-1, with its exit code. The port is up before /init runs (kernel/patches/0006). A panic after it prints, and ends the VM even while another vCPU is in the console driver’s send (kernel/patches/0004).

What a VMM must do

The measurements ran on QEMU. swm-vmm is virtio-mmio with up to 64 vCPUs (the default 8, or fewer CPUs or quota), its guest RAM a memfd another process can map. It runs as the session’s own uid in an empty root and namespaces of its own (doc/arch.html), and whatever it uses arrives as a descriptor the monitor opened – /dev/kvm among them; a VFIO path’s /dev/vfio/vfio and its group come the same way, never by name. What each path needs, besides the guest’s and dom0’s sides:

Path swm-vmm needs
Native context, Venus a virtio-gpu device whose 3D commands the VMM checks and copies to vmm-gfx; host blobs only, so guest RAM stays in the VMM and vmm-gfx never gets it (doc/design-vm-gpu.md, decision 5)
VFIO a PCI bus (config space, BARs, MSI-X), the VFIO group from the monitor and KVM’s VFIO device, DMA mapping, the ROM off, the card reset before start (VFIO’s hot reset or FLR); the monitor resets it after the VM stops

A VFIO GPU needs no virtio-gpu: the guest renders on it and copies each frame, one frame late and without waiting, into the window memfd dom0 already reads.

The GPU path

The work that gave containers and VMs the GPU, as numbered steps, one PR or a few each. The design documents name steps by these numbers. Its goal: all of graphics in a VM, no Mesa in dom0 (step 25). The order, so it is not argued again; a step starts when the steps it needs are merged:

Row Steps Gives
1 6, 7, 10, 11, 12 GPUs held at boot; a hang stalls ~0.1 s; swm-vmm in its own namespace, memfd RAM, several vCPUs
2 1 dom0 composites on the GPU
3 9, then 24a the GPU table and the gate as code; F9 shows it
3a 26 containers draw on the GPU end to end
4 13, then 14 virtio-gpu; vmm-gfx in dom0
5 15, 16 the guest’s side; dom0 shows guest frames
6 8, 17 dom0 at high priority; hang blame. Milestone: VMs on the onboard GPU
7 3, then 2 dom0 allocates the buffers; a full-screen window scanned out
8 18, 19 a PCI bus; VFIO
9 20, 21 a GPU memory wipe (deferred); the guest’s copy-out
10 22, 24b the monitor gives a GPU to a VM; the user approves a GPU, its ROM recorded. Milestone: a whole discrete GPU in a VM
11 23 vmm-gfx as a VM (the gfx VM)
12 4, then 5 NVIDIA as the display GPU
13 25 all of graphics in a VM, no Mesa in dom0. Milestone: gfx out of dom0

The steps, and where each stands:

  1. dom0 composites on the GPU (GLES2, iris). Built (doc/design-dom0-gpu.md); since step 25 dom0 draws with pixman.
  2. A full-screen window on a KMS plane, no copy. Built (doc/design-dom0-scanout.md); since step 25 dom0 commits a given buffer that covers an output itself (doc/design-gfx-all-vm.md, decision 17).
  3. Buffers dom0 allocates for each window. Built (doc/design-dom0-buffers.md).
  4. NVIDIA’s open driver as the display GPU’s. Open (ROADMAP.md).
  5. NVIDIA device nodes for container sessions. Open (ROADMAP.md).
  6. GPUs held at boot by pci-stub, the display GPU released by PID 1. Built.
  7. The display GPU’s preempt timeouts at 100 ms. Built for i915 and xe; measured on i915 only.
  8. dom0’s GPU contexts at high priority (doc/design-dom0-priority.md). Overtaken by step 25: the screen VM’s vmm-gfx keeps CAP_SYS_NICE.
  9. The GPU table, the decision tree and the VFIO gate, as code. Built.
  10. swm-vmm in its own uid and mount namespace. Built.
  11. swm-vmm’s guest RAM in a memfd. Built.
  12. More than one vCPU. Built.
  13. swm-vmm’s virtio-gpu, its commands sent to vmm-gfx. Built.
  14. vmm-gfx, one process a VM (doc/design-vmm-gfx.md, doc/design-vm-gpu.md). Built.
  15. The guest’s side: scrotwmd on virtio-gpu (doc/design-vm-guest-gpu.md). Built.
  16. dom0 shows guest frames (doc/design-vm-frames.md). Built.
  17. GPU hang blame (doc/design-gpu-blame.md). Built; the hardware legs are owed.
  18. swm-vmm’s PCI bus with MSI-X (doc/design-vm-pci.md). Built.
  19. swm-vmm’s VFIO (doc/design-vm-vfio.md). Built.
  20. A wipe of a held GPU’s memory between VMs. Deferred: a GPU a VM had stays held until power-off (ROADMAP.md).
  21. The guest’s copy-out from a VFIO GPU (doc/design-vfio-copyout.md). Built.
  22. The monitor gives a GPU to a VM and takes it back (doc/design-gpu-handoff.md). Built.
  23. vmm-gfx as a VM, the gfx VM (doc/design-gfx-vm.md). Built.
  24. F9’s GPU part (24a, doc/design-gpu-table.md) and the user’s approval of a held GPU’s ROM (24b, doc/design-gpu-approval.md). Built; the approval ledger is deferred.
  25. All of graphics in a VM: the screen VM composites, dom0 links no Mesa (doc/design-gfx-all-vm.md). Built.
  26. Containers draw on the GPU end to end (doc/design-containers-gpu.md). Built.

What is left of the path (measurements on hardware, the wipe, NVIDIA, Thunderbolt) is in ROADMAP.md.