With /sys/kernel/mm/lru_gen/min_ttl_ms above 0, the kernel kills a process
where it can't keep the pages used in the last that many milliseconds in
memory, even while RAM is free (the kernel's multigen_lru.rst, "Thrashing
prevention"), and a VM's QEMU can be the one killed. CachyOS's kernel sets it
to 100. Measured on hosts here at 100: kswapd invoked the global OOM killer
with most RAM free, killing a compiler with 19 GiB free on um870, and making 19
of a day's 22 OOM kills on ms01. An hour of builds beside a VM on um870 killed
no QEMU.
The installer and reims-ctl doctor now read the file, and above 0 they say
what it does in one line. On a terminal they offer to write 0 with sudo, and
they show the systemd-tmpfiles line that keeps it at 0 after a restart.
Without a terminal they only tell. VMs run either way, so doctor doesn't count
it as a failure.
Tested in mount namespaces on um790, where the file was a root-owned copy
holding 100 or 0: the installer without a terminal, and on one answering y and
n; then doctor the same ways. Each wrote 0 only on a y, said nothing at 0, and
left the host's own file at 100.
QEMU's configure turns SPICE on only where it finds the SPICE server's
development files, and leaves it out without a word where it does not, so a
Linux user had -spice only if those files happened to be installed when the
installer built QEMU. People reach their VMs with SPICE clients, the user who
reported the cursor bug among them, so the installer now installs the SPICE
server with the build's other dependencies (spice on Arch and CachyOS, which
brings spice-protocol; libspice-server-dev on Debian and Ubuntu, which brings
libspice-protocol-dev) and configures QEMU with --enable-spice, as it does
libusb, so that a build without it stops rather than leave it out.
With --skip-qemu and no QEMU installed, the installer warned, installed
reims-ctl, and stopped at __record-install, whose --qemu refuses the empty
path it was given: no install record, no reims-util, and an error that did
not say what to do. Every VM runs on QEMU, so --skip-qemu now ends at once
where none is installed, before it builds anything, saying to run the
installer without it.
A QEMU kept from an older checkout runs on a QEMU source and a library this
checkout may have changed since. Its build's directory names its commit, so
the installer now compares that commit's QEMU source and library inputs
with HEAD's, and warns, saying what to run, where they differ, where the
checkout lacks that commit, or where GPU_ARM picks the other arm. A change
to reims-ctl alone, which --skip-qemu is for, warns of nothing.
reims-ctl had no way to give a guest a USB device of the host's: a user wrote
usb-host into extra_args by hand. Now `reims-ctl usb NAME --add DEVICE` and
the interface's USB devices view (p on a VM: a checkbox per device, Space to
give or take back) choose them, as virt-manager, VirtualBox, GNOME Boxes and
UTM offer: a flat list of the devices plugged in, not a tree of hubs.
- A device is kept in vm.toml as a [[usb]] table by its vendor and product
IDs, which follow it to any port; one chosen beside a device with the same
IDs is kept by its port too, which tells the two apart. QEMU's usb-host
matches the same way, on the VM's xHCI controller.
- A device not plugged in when the VM starts joins the guest when it is, and
one unplugged comes back when plugged in again: QEMU looks for each
usb-host device's match every 2 s. The view and `start` say so.
- While the VM runs, a change attaches or detaches the device at once, with
QMP's device_add and device_del, and is kept for the next start.
- A VM takes four at most, what the controller's seven ports leave room for.
- QEMU opens the device's file in /dev/bus/usb, which only root may write by
default: install-ctl.sh now asks to add a udev rule giving USB devices
other than hubs to the kvm group and to the user at the screen (uaccess).
reims-ctl says what lets it open a device it can't, and doctor checks it.
- macOS hosts get none, and the interface says why: macOS gives a USB device
one of its drivers holds only to a process running as root or holding an
entitlement Apple grants VM apps, which QEMU here can't hold.
The docs are usb --help and the interface's help.
reims-ctl and the installer checked /dev/udmabuf only for AMD GPUs, and told
every host to raise vm.max_map_count by a rule of 64 mappings per MiB. But
the library's own views of the guest's memory need udmabuf on every GPU:
without it a view of an x86-64 guest's pages takes a mapping per 4 KiB page,
and an idle 3840x2160 desktop's surfaces alone (193-199 MiB, about 50k
mappings) pass the stock 65,530's budget; Safari at 4K passes even
1,048,576. On Debian 12 and Ubuntu 22.04/24.04 a user outside kvm cannot open
it, and on systemd 257+ a desktop session's access does not reach ssh.
So reims-ctl warns on every Linux host where /dev/udmabuf does not open,
naming the group that owns the node (or what to do where root alone may open
it, or the node or its module is missing), and says the group is needed over
ssh; doctor checks it too. The installer offers to add the user to that group
with sudo usermod, as it offers packages. vm.max_map_count is now only a
speed-up on NVIDIA, where udmabuf opens: a mapping per 4 KiB page past the
library's 16,384 and 8,192, past which buffers are copied. Doctor and the
installer name the value as information, by one rule, and the start no
longer warns of it. The README says the same.
Landed on development at the owner's word with no checks: reims-ctl's tests,
rustfmt and clippy, and the install and VM boot on each Linux host that
AGENTS.md asks of install-ctl.sh, were not run.
vmapple's AES engine runs the guest's commands on QEMU's ciphers, and QEMU
gets those from a crypto library: gnutls, nettle or libgcrypt. Neither
install-ctl.sh nor `make qemu` asked for one, so whether QEMU had AES depended
on what else the host's Homebrew held. Built without one, QEMU falls back to a
stub that refuses every cipher. A macOS guest then hangs for good as it mounts
its root volume: its first AES DATA command fails and stays at the head of the
engine's FIFO, with every command after it. Serial output ends at "End of
iBootStage2", and the display never gets a mode. That was the hang on the
Scaleway M2 Pro Macs on macOS 27.2, whose Homebrew had none of the three; the
M3 Max's QEMU links gnutls.
- vendor/qemu moves to c7a4f070 on steelbrain/reims-vgpu. The AES engine
checks at realize that AES-128, -192 and -256 work in ECB and CBC mode. A
QEMU without them exits at start, saying what the build lacks, instead of
hanging the guest.
- install-ctl.sh installs Homebrew's gnutls with the other formulas on macOS.
Both it and `make qemu` configure QEMU with --enable-gnutls, so configure
stops where gnutls is missing. An install's next update reconfigures QEMU,
since its configure options changed.
- docs/qemu.md says how the hang was found and told apart from macOS 27.2,
and README.md lists gnutls among QEMU's dependencies.
This is development-performance's 9d4f0a635, f8ef804f4 and 79225f10f
squashed. The QEMU change is its f1c10385 alone, picked onto development's
QEMU, without the dirty-source commits under it there.
reims-ctl update runs install-ctl.sh --update, which pulls the checkout and
builds. bash reads a script from the file it opened as it goes, and the pull
replaces that file, so the update ran the old script to its end: a change to
the script's dependencies or QEMU options reached a host only on the update
after the one that brought it, such as libusb for usb-host.
When the pull changes the script, it now runs the new one with the same
options; that one's pull finds nothing new and goes on.
QEMU's configure leaves libusb out, saying nothing, when its headers are
missing, and install-ctl.sh did not list them: a Linux install's QEMU had no
usb-host device, so passing a host's USB device to a guest failed with
"'usb-host' is not a valid device model name" (issue #134). Installing the
headers afterwards changed nothing either, since the script configures again
only when its options change.
The script now installs libusb's headers (libusb-1.0-0-dev; libusb on
pacman) and configures QEMU with --enable-libusb, so a build without it stops
at configure. The new option also makes every existing build configure again
once, picking libusb up.
--help named GPU_ARM only inside its Environment paragraph, so how to install
QEMU on Vulkan or Metal on a Mac was easy to miss. The help now gives both
commands under the usage line, with how switching and updates treat the arm.
reims-ctl __record-install installed reims-util on Linux alone, so on a Mac a
reims-util beside reims-ctl, such as one installed from its own checkout,
stayed at whatever it was through every install and update. It now installs
reims-util wherever one is beside reims-ctl too.
The install no longer passes --force: without it cargo 1.98.1 replaces a
reims-util from another commit or from a path, and leaves one already at the
pin as it is, building nothing (measured: 12 s to move a path install to
381f913, 0.07 s the second time). The target directory is still emptied first,
against cargo installing an earlier commit's build as a later one's.
On a Mac the installer built QEMU on the Metal platform alone, and running a
VM on the Vulkan platform (on MoltenVK) took a QEMU configured by hand.
GPU_ARM=vulkan now builds the library with --platform vulkan and QEMU on it,
in a build directory of its own, and installs it as qemu/<build>-vulkan;
GPU_ARM=metal goes back. Unset, it keeps the installed QEMU's arm, read from
that suffix, so reims-ctl update does not switch it. The Vulkan arm also
checks for Homebrew's vulkan-loader and molten-vk, which metal2vulkan opens.
Linux builds as before: vulkan is its only arm.
reims-ctl could lose or clobber a VM's files and settings, run a VM twice on
its disks, or fail on long names and paths:
- QEMU writes the pid file itself, so a VM never runs twice; a start
refuses a disk another running VM uses, and a delete finds a running VM
by its pid file and keeps other VMs' files;
- settings stay saved while an installer or OpenCore image is made, and
the logs toggle and the edit form's GPU follow the settings as saved;
- deletes take only the VM's own installer copy and old OpenCore image,
and the installer's prune spares the QEMU builds running VMs execute;
- a QMP socket path fits a long VM name or TMPDIR, in a directory of the
user's, and a view removes the frame directories killed viewers left;
- an update follows a force-pushed branch, a stop timeout of 0 waits for
the guest, and create takes an SSH port of 0 as no forward, a MAC only in
QEMU's form, and refuses an environment name the printed script breaks on.
Source: a8d5f7360 6e068ce7f 312574d62 eff723328 1a782184d 15a911eb5 a74547d99
742e84995 c1692789c 72f4aef4a 49b7a366f 10a39d613 7e8a207b1 1bd4a5fad
189bfe60b 00dc3769d 56bf0e527 8bb6451a0 3f48a7893 1675dce1f 15bc7d5cf
A user's build rewrites Cargo.lock: cargo adds the metal2vulkan git sources
the committed lock leaves out. A changed lock then stops both ways an update
moves the checkout: reims-ctl's channel switch (git switch) and the script's
git pull --ff-only, as soon as the target changes the lock too. The update
failed with "commit or set aside its local changes".
The lock is the build's to write, so nothing is lost: reims-ctl's switch and
install-ctl.sh --update check the committed one out before they move, and
the next build writes it again. The switch test now has branches whose locks
differ and a clone whose lock the build rewrote.
meson writes the system libraries QEMU links into build.ninja by their paths,
some by their versioned file (/usr/lib/libsnappy.so.1.2.2; Homebrew's carry
the version in the Cellar path). Removing or upgrading one left the cached
build naming a file ninja cannot make, and since the installer configured
again only when its options or reims-vgpu.pc changed, every later
install-ctl.sh and reims-ctl update stopped there until the user removed the
build directory.
The installer now configures again when ninja's dry run fails, which recovers
in the same run. When build.ninja is itself out of date (a QEMU update that
touches meson files, or a newer /bin/chmod), the dry run passes without
checking, and meson's regeneration reuses the dependencies it found before, a
removed one too; so a build that fails also makes the next run configure
again. configure starts meson afresh and keeps the objects already built.
An x86-64 VM's edit form (e) and reims-ctl set --graphics now choose between
reims-vgpu and QEMU's VMware SVGA II, for when a guest should come up without
the library: the firmware's framebuffer, one display, no GPU acceleration.
With VMware SVGA the library takes no part: vmware-svga takes apple-gfx's slot
and its id, gfx, which the terminal viewer's screendumps and input name, the
library's window and GPU variables and warnings are left out, and QEMU's own
GTK window shows the display. install-ctl.sh builds Linux QEMU with GTK for
it; on a QEMU without it, start refuses and names reims-ctl update. With no
Wayland compositor or X server in QEMU's environment (reims-ctl's, under the
VM's extra environment), GTK would end QEMU at its start, so the VM runs
headless under -display none there, as the library's window does. The edit
form hides the display and GPU fields on VMware SVGA and keeps their values
for a switch back; a test pins that a field following one the form lacks (an
arm64 VM's, with no graphics choice) still shows.
Booted on msi-laptop (docs/qemu.md): macOS 26.6.1 reaches its desktop at
1280x720 in QEMU's window, the viewer's screendump and input work, and stop
shuts it down.
A new x86-64 VM needed an OpenCore image and an installer made by hand with
OSX-KVM or ULTMOS. reims-ctl now runs reims-util for both: pick a macOS
version (n in the interface, create --macos on the command line) and it
downloads the installer from Apple, makes the VM's OpenCore image with OVMF
and a Mac identity of its own, and makes the disk.
- create --macos VERSION downloads Apple's recovery image (about 1 GB), or
with --offline an installer of one release (13 to 20 GB). Installers are
kept in the data directory's installers for the next VM, one reims-util at
a time writes there, and a stopped download continues. The download comes
before the VM's directory, so stopping it leaves no VM half made, and
reims-util ends with reims-ctl on Linux. What create is given (a disk, an
installer, an OpenCore image and the OVMF beside it, reims-util itself) is
checked before the download and the disk's copy, and the VM list is read
again before the VM joins it, so VMs made or deleted during a download
stay as they are.
- --opencore is optional: without it reims-util makes the image, with the
VM's MAC as its ROM, and an iMacPro1,1 for macOS 10.13 and 10.14. An image
of the user's brings OVMF_CODE.fd and OVMF_VARS.fd beside it, as
reims-util writes them.
- The interface's form asks where macOS comes from, the version first; with
no name, the VM takes the version's, skipping names a VM or a leftover
directory has. A VM with an installer says in its details, and create
prints, how to install macOS from it; one made from a disk is reminded to
set Metal's error mode.
- A new disk needs an installer or a download: a VM of an empty disk and no
installer is refused.
- Every installer attaches as a read-only disk (snapshot=on), a DMG
converted to a raw image in the VM's directory, so the CD drive is gone: a
change of installer applies at the next start. vm.toml's installer_kind
is no longer written, and is ignored where an older vm.toml has it. A
missing installer says how to eject it.
- reims-ctl __record-install, which scripts/install-ctl.sh runs last,
installs reims-util at the commit reims_util.rs pins, so the update that
brings this reims-ctl installs it too, though it runs the script it
started with. doctor checks for it in place of the system's OVMF, and the
install no longer adds the ovmf or edk2-ovmf package.
- vm.max_map_count: a new VM's default of up to 16 GiB needs about 1.13
million mappings, more than the 1048576 suggested (CachyOS's stock
value). The README, the install script, doctor and the start warning
suggest 2097152, which covers 30 GiB, and check against what the VM, the
largest VM or a new one's default needs.
- Updating from the interface while a create runs says the restart stops
it, as quitting does.
Dropped, as reims-util's images leave nothing for them to cover:
- create --from-script and the interface's launch-script import, which read
OSX-KVM's and ULTMOS's QEMU scripts. A VM made from one keeps working; its
vm.toml names its own copies.
- The search for OVMF beside a user's OpenCore image in those projects'
layouts, QEMU's edk2 build and the distributions' packages, and
--firmware-code and --firmware-vars.
- create --disk-mode overlay: copy, a reflink where the file system can, or
in-place covers an existing disk. A VM made with an overlay keeps working.
- --cpu-model and --cpu-flags on create and set, and the edit form's CPU
fields: new VMs take Skylake-Client-noTSX-IBRS. vm.toml keeps cpu_model
and cpu_flags, so an older VM keeps its model; docs/qemu.md says how to
change it there.
- --installer's --iso and --cdrom aliases.
README, the help and the docs no longer point at OSX-KVM or ULTMOS. README
step 3 describes reims-util's OpenCore picker (5 seconds, which an arrow key
stops, measured on homelab-ms01), and architecture.md 11.4 counts its image
among those that keep AvoidRuntimeDefrag on.
RADV imports host memory as an amdgpu userptr, which Mesa asks for with
AMDGPU_GEM_USERPTR_ANONONLY, so the kernel refuses every page with a file
behind it. The guest's RAM and every view the library makes are memfd pages,
so on an AMD GPU a macOS guest died at its first no-copy buffer.
The runtime (metal2vulkan 11715e2a3f) now asks the caller for dma-bufs of
the pages wherever the pointer import is refused, on any driver. The library
answers with /dev/udmabuf: it resolves the range through the backing table,
gives the shared block of zeros' pieces a file of the import's own, cuts the
runs into chunks within udmabuf's limits as the host has them (1024 pieces
and 64 MiB by default, which no one is asked to raise) at the runtime's bind
granule, and pads several chunks to the granule. The runtime binds them
behind one sparse buffer, and asks again for a texture's own pages. Its own
memfds are sealed against shrinking, which udmabuf requires. A refusal names
its cause in the death line.
reims-ctl and the installer warn when a VM that would run on an AMD GPU
cannot open /dev/udmabuf (the kvm group's on Ubuntu), and reims-ctl's logs
show the device and its limits.
On the Radeon 780M (RADV of Mesa 26.0.8, udmabuf at its defaults) the guest
now cold-boots to its desktop, and Safari loads a page and quits: 5,119
dma-buf requests, none refused. NVIDIA, which imports the pointer, and macOS
are unchanged.
This repository now holds libreims_vgpu, a Rust library that is the host
side of the paravirtualized GPU macOS guests drive, in place of Apple's
ParavirtualizedGraphics.framework: the library and its C API
(reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API
(vendor/qemu), the behaviour-lock suite that drives the C API as QEMU
does, and reims-ctl, the VM manager users run. README.md says what it is
and how it is laid out, and AGENTS.md how to change it.
Every file of the earlier tree is replaced. vendor/qemu moves to the
steelbrain/reims-vgpu branch of the same public repository.