Commit Graph
140 Commits
Author SHA1 Message Date
Anees Iqbal c34215f558 🐛 Leave an NVIDIA test's platform to the exit, as its crate keeps it
The NVIDIA crate keeps the first runtime it is opened with in a static for
the process's life (nvidia::wait's RUNTIME), and with it the rt platform the
test handed it: that platform is never dropped, so no last drop races the
exit there. rt_test_end::drop_last at the NVDEC and NVENC tests waited for a
hold that never ends, and 6 of 6 failed its 30 s bound on an RTX 3090. Drop it
from them; the VA-API tests, whose video threads do end, keep it. The module
docs and docs/lessons.md now say so.
2026-11-20 10:52:29 -08:00
Anees Iqbal 9a859bdf89 🐛 Drop a video test's rt platform last, before the test returns
A test that hands its platform to the video crate leaves the threads of
what it made there (a VA display's call thread, an NVDEC or NVENC
session's) holding the platform after the test returned. Where the last of
them ends as the process exits, its drop destroys rt's instance and closes
the Vulkan loader beside the exit's handlers, and with NVIDIA's driver
installed beside another the exit then runs code of libEGL_nvidia.so.0,
unmapped by then: on the Iris Xe, graphics::vaapi's tests of writes into
dma-buf caches printed ok and died of SIGSEGV in 3 of 9 processes
(measured with LD_DEBUG=files and their cores).

rt_test_end::drop_last waits until the test's own hold is the platform's
last and drops it on the test's thread; each video test of the rt
platform ends with it. Nothing the guest or the host sees changes.
2026-11-20 10:52:29 -08:00
Anees Iqbal 7e58e014ce ✅ Sweep heap texture alignments against the guest's pin
rt binds a heap texture at its absolute place in the block's memory, so a
Private heap the guest pins must start at a multiple of every alignment the
GPU answers for a heap texture. The guest pins at 256 KiB from its block's
first byte; the test checked three shapes on the GPU it held.

The test now sizes each SDK pixel format with four usages as 1D, 2D, 2D
array, multisample, multisample array, cube, cube array and 3D textures, of
one level and of every level, and fails where the GPU asks more than the
guest's kHeapAddressAlign, or more than a heap of its own starts at. It
places a texture of each alignment answered at offset 0 and at the alignment
in a heap pinned in a known block at the guest's alignment and in a heap of
its own, and in a heap pinned on the old 32 KiB granule checks that rt's
refusal is counted apart, as rt-refused-heap-texture-place. A GPU whose
images ask more than 256 KiB then fails the checks before a boot meets it.

Measured largest on 2026-11-20 at rt d83fb05: 256 KiB on the RX 7900 XTX and
the RX 550, 64 KiB on the Radeon 780M and the Iris Xe, 16 KiB on the M3 Max
(KosmicKrisp), 1 KiB on the RTX 2080 and the RTX 3090. None is above the
guest's pin, so neither the device's answers nor the guest change; the
module doc records the numbers.
2026-11-20 10:06:10 -08:00
Anees Iqbal 11055c78d5 ⬆️ Build on metal2vulkan development 82e7c39216
Moves both metal2vulkan revs from d83fb05624 to 82e7c39216, 65 commits on its
development branch, named green by its checks (m3-max-59311). The runtime's
crate takes its published name there (9a1c8fe6dc): metal2vulkan-rt 0.0.0 is
now metal2vulkan-runtime 0.2.0, its library metal2vulkan_runtime. The
dependency key, the crate's paths (each still `as rt`), the lock's entry and
the docs, comments, log lines and scripts that named the crate follow it. The
rename changes no API.

On rt:
- A command buffer waiting for a shared event's value whose signal is
  submitted is Scheduled as it is submitted (4730af16e7): its scheduled
  handlers run on the submit thread then, and its queue's later command
  buffers are no longer held behind it. A wait for a value that neither the
  host set nor a submitted signal promises stays held, Committed, as before
  (counted in Metrics::event_holds, fb4b77048c). GPU order and completion are
  unchanged. The docs that said rt's completion thread runs a held command
  buffer's scheduled handlers now say its submit thread does.
- Copies over buffers are tracked by the memory a buffer lies in, never its
  id (7e38a29b69): a texture over one buffer sees a draw through a texture
  over another buffer over the same bytes, in one command buffer and across
  a held group.
- A kernel that reads buffers through an argument buffer's pointer members,
  or through a gpuAddress the CPU wrote into a constant buffer, now makes
  (3cdca62567, c0403a1c98); the translator refused it (IdentityDomains).
- A refused kernel input names its kind (98895eb6d2, 1c26e1dc54):
  Gap::KernelInput { kind }, so the refusal's text, in the log and in the
  NSError's description, carries the kind. It is still counted as
  KernelInput.
- Memory goes back sooner. The release of a texture or block that an unsent
  upload holds sends the upload at once (0277c68696). A texture longer than
  a 16 MiB block has its block to itself and gives it back at its release
  (61949e8ba4). Every free of device memory on a normal path is made by the
  block-maker thread, and counted against the submits it meets (4c808ffa6d,
  09735ad792). New gauges tell texture blocks apart from the consumer's
  Private takes (b3f6c859dd).
- ComputePipelineState::dispatch_variant, the key of the VkPipeline a dispatch
  runs (82e7c39216), which this tree does not call yet.
- The translator's old path is deleted (0b94d919d9 to 16c831165d): its
  profile comes from Vulkan queries alone, with no policy switches and no
  driver-fact tables. SEMANTICS_VERSION goes from 2201 to 2203 and
  RUNTIME_VERSION from 2540 to 2541, so rt's shader and pipeline caches miss
  once: the first run on each host translates its pipelines again.

The rest is metal2vulkan's own: its conformance declarations and ledger, its
generated documents and the tests of each change. The NSError texts the guest
receives, and the comments of the wire header and the guest's sources that the
prebuilt kext sets and the option ROM record, keep the old name here; commits
of their own change them.
2026-11-20 09:41:45 -08:00
Anees Iqbal 8c40add9ac 📝 Say what the tree runs on now the old platform is gone [ci skip]
The cutdel branch deletes VulkanPlatform, metal2vulkan-runtime and the rt
feature, so RtPlatform over metal2vulkan-rt is the only platform. These
docs still described the old one: its answer policies, its exact
switches, MoltenVK on the Mac, its in-place guest memory, its records
cache, its device recovery and its Metal-answer tests.

- conventions.md: the guest-memory-in-place rule is replaced by the rt
  rule (rt allocates GPU memory, the device maps its blocks into the
  guest, textures sync at the guest's events, and there is one VkDevice
  per process). The degradation codes are now rt-unbuilt and rt-refused,
  and the deleted codes are dropped.
- accuracy-ledger.md: restated for rt, which has no switches. It keeps
  the device's own arithmetic notes (tagged as measured before rt), the
  19 unbuilt pieces and rt's refusal kinds, and device loss.
- api.md, README.md: REIMS_VGPU_EXACT, _CENSUS_DIR and _TRACE_DEGRADE
  are gone, and STRICT now covers running out of memory only. The let-go
  and the quiesce describe one platform.
- architecture.md, development.md, testing.md, qemu.md: KosmicKrisp in
  place of MoltenVK; RtPlatform, rt_window and RtBlocks in place of
  VulkanPlatform, the old window sink and HostBlocks; no Metal-answer
  comparisons and no opt-in GPU-fault tests.
- lessons.md: the four lessons about deleted code only (the Metal
  comparison after MoltenVK, the runtime's shadows, device recovery and
  the in-place check) are dropped. The lessons that still bind mark
  their deleted names.
- video/vaapi.md, graphics-kext/design.md: the GPU plane copy and the
  compositor mirror are marked as gone.
- AGENTS.md: only the Vulkan platform's "Where things are" row changes.
2026-11-20 07:08:46 -08:00
Anees Iqbal 324af6a3e1 📝 Note that a runtime refusal change reaches tests the Mac skips [ci skip]
metal2vulkan's development b676eda182 refused a colour render target made with
no texture index. The blit seam's tests made theirs directly with the runtime and
failed on every rt device, but they are ignored on macOS, so only the Linux and
Windows legs of the pin's batch could see it. The lesson says how to find such
tests before a pin's batch.
2026-11-19 23:41:12 -08:00
Anees Iqbal a2477fe177 ✅ Run the many-passes tests alone on Windows
Each many-passes test submits 706 passes, each after a 1x1 encoder, as
one vkQueueSubmit of 1413 command buffers. Beside the rest of the Windows
tests on the UHD Graphics 630 that submit lost the device in 7 of 90 tests
over five runs, and the suite's longest test lost its own device in 4 of
the 5, once with no loss of theirs. Neither a 28 GiB commit limit nor
anything in the System log changed or explained it, and the new runtime's
path for the same passes lost nothing in 117 tests beside the same tests.
Alone the tests passed 18 of 18, so on Windows they now run with nothing
else in flight, as the Mac's GPU-faulting test did. The lesson records how
to tell such a loss from paging.
2026-11-19 19:02:15 -08:00
Anees Iqbal d417f37c78 ✅ Let go of a test's rt devices as its thread ends
The process's rt platform keeps its device until a host releases its last
graphics device, which no unit test does, so every rt test process reached
the C library's exit with the device live, which rt does not support. On an
RTX 3090 two tiled-texture tests printed ok and then died of SIGSEGV, rt's
memory thread in vkDestroyBuffer while the main thread ran the driver's EGL
exit handler (2 of 2067 tests of one run).

In a test process run as nextest runs it (--exact), the test's thread now
keeps the process's platform and each platform a test makes of its own
(rt_test_end::platform) in a thread-local whose destructor, run after the
test's function and before libtest's join, lets go of each device as a
host's release does, on a thread of its own. A device still held after 30 s
fails the test with _exit(101), running no exit handler. Unix only: Windows
runs thread destructors under the loader lock.

on_vulkan_a_test_s_rt_device_goes_before_its_process_exits runs a child that
takes the device, runs a blit and returns, and checks from the child's exit
handler that rt tore the device down; it fails on the tree before this on
any GPU.

Test infrastructure only: nothing the guest or the host observes changes.
2026-11-19 18:51:50 -08:00
Anees Iqbal 6192b60208 📝 Record a release filter that matched branchless records [ci skip]
A lane's release loop removed 30 potluck workspaces that were not its own on
2026-11-19: its lookup filter compared None with None for every record with no
branch. The lesson says how a release is checked so the next one cannot.
2026-11-19 12:31:48 -08:00
Anees Iqbal 59e376bd05 🐛 Answer false to the quiesce once the platform made a GPU device
On the Vulkan platform (metal2vulkan's old runtime) rvg_quiesce_for_exit
answered true once the release's let-go took the GPU devices, so QEMU called
exit(). The let-go does not end the runtime's work: a pipeline making of the
warm pass can stay in the driver past the device's last drop, and the
runtime's exit hook, registered as the device was made, then waits for it and
on Linux ends the process at once with _exit. QEMU's exit notifiers never ran:
on an RTX 2080 (620.70.06) a quit 24 s into a boot, its let-go 315 ms after
the quit, ended 9.6 s after it with QEMU's pidfile left (job m3-max-53092).

Now the quiesce answers false once the platform asked the runtime for a device
in the process, kept or let go of since: each of the platform's makes (the
default device, a window's device, MTLCopyAllDevices's, the device choice's
timed devices) and each adoption mark it (let_go::asked_the_runtime_for_devices).
What changes for the host: on the Vulkan platform, a quit after the release
that let go of the device now gets false, and QEMU runs its own exit work (its
exit notifiers, the terminal's restore, the streams' flush) and ends with
_exit and the cleanup's status, as it did with a device kept. The runtime's
exit hook and the driver's exit handlers no longer run then, and the library
writes its degradation counts in the quiesce. A process that never opened a
GPU device still answers true. The platform over metal2vulkan-rt is unchanged.

The let-go's child-process test now expects false after the let-go, then
_exit with status 0; a new one holds true and exit() for a process that asked
for no device. The C harness ends as QEMU does on the answer, and its test
expects false on the Vulkan platform and true over metal2vulkan-rt. The API
docs, the header, docs/api.md and docs/lessons.md say the same.
2026-11-19 11:15:34 -08:00
Anees Iqbal b4a4957b07 📝 Record a walk read against a newer tree than its own as a lesson [ci skip]
The rt allocation-stall walks ran trees branched from b266 and were read
against development's surface_cache.rs, where b267 had already removed the
zero they measured. The lesson says how to spot the next one: a walk's record
names its base, and a finding is checked at development's tip first.
2026-11-19 10:12:58 -08:00
Anees Iqbal 8f70e3f141 📝 Record the import comparison of different mappings [ci skip]
A comparison of the old platform's boot with rt's read the old platform as
importing the same udmabuf-mapped view rt failed on. It had imported a view
mapped from its files: the old platform probes each device and, on one that
refuses a dma-buf-mapped view, maps views from their files from then on, a
probe rt never runs. The entry says how to tell the mappings apart before
calling two imports the same.
2026-11-19 10:12:58 -08:00
Anees Iqbal 96dbe24887 🐛 Answer false to the quiesce while a Vulkan GPU device lives
The Vulkan platform's quiesce ahead of the exit (rvg_quiesce_for_exit) did
nothing and answered true, so a quit with a GPU device kept to the exit went
on through exit(). On Linux metal2vulkan's exit hook, which runs before QEMU's
exit notifiers, waits 2 s for the runtime's work in progress and then ends the
process with _exit itself: with a device kept to a paused VM's quit, 5 of 9
quits on an RTX 3090 and 5 of 9 on an RTX 2080 left QEMU's pidfile behind,
and usb-host's return of host devices to their drivers is skipped the same
way.

Now it closes the exit gate ahead of the exit, waits for the library's steps
in progress within its bound, and answers false while the platform keeps a GPU
device (let_go::gpus_kept), as the platform over metal2vulkan-rt does. What
changes for the host, where QEMU's quit finds a device kept (a paused VM, a
shutdown action that pauses, a display read that kept it): QEMU's exit work
runs (its exit notifiers, the terminal's restore, the streams' flush), then
_exit with the cleanup's status. metal2vulkan's exit hook and the driver's
exit handlers no longer run then, and the degradation counts are written in
the quiesce rather than by the exit gate's handler. A quit whose release let
go of the device answers true and exits as before.

New tests hold both answers in a child process: false with a device kept,
true once the let-go took it, then exit() with status 0. The C tests that
quiesce with nothing on a GPU still answer true. The API docs, the header
and docs/api.md say the same for both platforms; docs/lessons.md has the trap.
2026-11-19 09:52:07 -08:00
Anees Iqbal e85d5858d8 📝 Record rt's absolute heap texture place as a lesson [ci skip]
rt checks a heap texture's place in the device's memory (block base, heap
offset and texture offset together) against the driver's image alignment,
where Metal checks it against the heap's start. The guest's heaps on the
32 KiB granule therefore had every texture refused on GPUs aligning images
at 64 KiB or more, while the 3090's tests passed. The lesson says how it
showed, what fixed it, and how to spot the next one: the count
rt-refused-heap-texture-place.
2026-11-19 08:06:08 -08:00
Anees Iqbal 88716bcd53 📝 Record the reply type the kext's list lacked [ci skip]
Private blocks added a message whose waiter names PRIVATE_BLOCK without adding
it to rgfxLifecycleAnswer, so every take failed in the kext with only an IOLog
line, and the Vulkan platform, which keeps any pin, hid it. The lesson says how
the next one shows: a feature whose host side never sees a single message.
2026-11-19 05:59:50 -08:00
Anees Iqbal 2f67f20468 📝 Record the dropped POOL_BLOCK answer in the lessons [ci skip]
A boot found it: the kext's event handler routed answers from a list of its
own, POOL_BLOCK was not in it, and POOL_TAKE's waiter, asleep uninterruptibly
with no deadline, hung WindowServer for good with no fatal line on the host.
Say how to spot the next one.
2026-11-19 00:00:12 -08:00
Anees Iqbal 02c8dcdf49 📝 Record WHPX first touch and the memory-priority trap [ci skip]
Measured on the UHD 630 Windows host, a guest page under WHPX costs about
20 us the first time the guest touches it, guest RAM and the device's
region alike, and a page the host already backs about 1.5 us. qemu.md now
holds those costs, the region's use at the desktop, and the largest
first-touch burst between two presents, so later sizing reads them there.

The same runs found that potluck's Windows jobs start at memory priority 4,
and that Windows trims a priority-4 QEMU's working set with tens of GB free:
703,604 RAM and 9,637 region pages in one walk, each costing 19 to 32 us to
fault back, and none at priority 5, which a user's shell gives. lessons.md
records the trap and how to spot it, since a timing taken in such a job pays
faults a user's VM does not.
2026-11-18 21:59:53 -08:00
Anees Iqbal 9fbd2c1390 📝 Record the 2 GiB maxBufferLength and the trap it closes [ci skip]
The oracle table's row for our device now reads 2147483648 (c795bf3d5), and
its relaxation names the cap and why. A lessons entry records the trap: a
size the device answered (12821200896 on the RTX 5080) passed what the
platform's shaders address, and only an access past 4 GiB in a buffer shows
it.
2026-11-17 16:10:29 -08:00
Anees Iqbal 5cfbd942cb 📝 Record that a KVM call in the device file breaks non-KVM QEMUs [ci skip]
reims-graphics-pci.c is built once into every QEMU target, so the pool's
KVM quirk call broke qemu-system-aarch64's link on x86-64 Linux hosts,
and only an aarch64 build saw it. Say how to spot the next one.
2026-11-17 12:36:09 -08:00
Anees Iqbal ba4f1a31ee 🐎 Set the guest PAT's entry 2 to write-back on every CPU
xnu's x86-64 pmap maps every page it does not manage through PAT entry 2
for any ask but write-combined, and xnu's PAT holds UC- there. So the
device's region, which QEMU backs with host RAM, was uncached wherever the
kext asked for write-back: its rings, the cursor, the device info and every
block the bundle maps write-back. AMD's nested paging and WHP apply the
guest's memory type: through entry 2 the region ran at 78-202 MB/s on AMD
KVM and on WHP, against 43-46 GB/s and 16.5/8.8 GB/s write-back. KVM on an
Intel host ignores it for RAM-backed pages and ran at write-back speed
either way.

ReimsGraphics' start now sets entry 2 to write-back on every online CPU,
before the region's first mapping, in an mp_rendezvous_no_intrs action
with the SDM's sequence for a PAT change, and leaves entry 6 write-combining
as xnu sets it. A priority sleep/wake interest runs it again at each wake,
for a wake from S3, which resets every CPU's PAT; reims-ctl keeps S3 off, and
through its dark wake and a CPU's offline and online the measured guests
kept the rewrite and xnu wrote no PAT, so no CPU-start hook is needed. What
the guest observes: the region's write-back mappings are write-back on AMD
and Windows hosts. Every other user of entry 2 is device registers the host
traps, or RAM a driver asks uncached, which QEMU reads write-back.

The calls are com.apple.kpi.unsupported's (mp_rendezvous_no_intrs) and
IOKit's, which the kext links already. The comments and design.md that
called the region uncached now say under which PAT it is.
2026-11-17 08:56:29 -08:00
Anees Iqbal b8aa508721 📝 Note the system mapper wait of a kext before the platform expert [ci skip]
A probe kext that allocated an IOBufferMemoryDescriptor at its kmod start hung a
macOS 26.7.2 boot in IOMapper::checkForSystemMapper, which only the platform
expert's start releases. Record the trap and how to spot it, for any kext work
that moves a start earlier.
2026-11-17 06:28:21 -08:00
Anees Iqbal cef35d7975 🐛 Hold Windows VA teardowns while another context lives
On the UHD Graphics 630 host, QEMU ended in an access violation inside
Intel's Direct3D 12 video driver as a guest's 4K H.264 session ended beside
its next: a decoder let go while another lived on the display broke the
other's next vaEndPicture. A test of two threads' decoders, each let go
round after round while the other decodes, ends the same way under vaon12,
and keeps ending so with every call made alone, with no teardown inside
another context's picture, and with the other contexts' pictures done
first. Kept until no context lived, every teardown passed.

So on Windows a context's, a config's or a pool's destroy asked for while
another context lives on the display is held, and made in the order asked
once the last live context's teardown is asked for; the log says so once a
process. What changes for the host: the process no longer ends there, and an
ended session's surfaces stay allocated while another session lives. Linux
is unchanged: the same test passes on radeonsi with every teardown made at
once.
2026-11-17 02:25:05 -08:00
Anees Iqbal e06e9c5ef7 📝 Record NVDEC's failures beside the device's own copies [ci skip]
The decode-back's failures were NVDEC's answers to decodes starved by the
device's own copies of caches into the guest's RAM, a case like U21's: say so
in U21 with the measured runs (the causal switch, the no-VM replay beside CUDA
copies, the paced boot), and keep the trap in lessons.md: failures clustered
at a workload's end or in bursts are lined up against the device's own GPU
work before the stream or the driver is suspected.
2026-11-17 00:10:17 -08:00
Anees Iqbal 90e5187b7c 📝 Note that a path normalized on read misses its recorded bytes [ci skip]
reims-ctl's registry now reads a Windows VM's directory with `\` alone, and
the pid file match against QEMU's command line, which still named the old
form, missed a running VM until it took `/` and `\` as one. Only one test on
Windows, mixed by accident, showed it: the lesson says where to look next time.
2026-11-16 23:30:08 -08:00
Anees Iqbal 449b122a6e 🐎 Cut no part where no encoder follows
The bundle puts a buffer's ask for its submission (SUBMITTED) last, after its
last encoder, on every buffer of a queue that presents, WindowServer's among
them. The walk cut a part at any encoder's end with an op after it, and
deal() cut chunks at an encoder's end before the stream's last op, so a cut
at the last encoder's end left a last part of framing ops alone: no GPU work,
a vkQueueSubmit of its own, and a paced walk waited to commit it. On
perfdiff's walks at 196c253bc that was 3,736 of the 31,222 parts of an Iris
Xe desk walk (1,558 of 4,680, a third, in its Safari video step) and 1,676 of
55,784 on a Radeon 780M, every one a split buffer's last part; f37e9a586,
before the walk was paced, had as many.

A part is now cut only at an encoder's end that another encoder follows
(encoder_follows), by a cut and by a deal: the ops after the last encoder go
with it into the last part, as in a buffer committed whole, so what they
signal still follows its work and nothing the guest sees changes its order.

Measured on a Radeon 780M (um790, a macOS 26.7.2 guest, walkreg's desktop
walk, two walks before and two after, interleaved: m3-max-38862 and 38864
against 38863 and 38865), in the window drag: empty parts 873 and 901 to 0,
parts 11,251 and 11,243 to 10,339 and 10,333, submissions 891 and 876/s to
805 and 813/s; presents 25.8 and 25.9/s to 25.8 and 25.7/s, and the GPU time
a present 14.9 and 15.4 ms to 14.9 and 15.7 ms at the median.
2026-11-16 21:00:30 -08:00
Anees Iqbal f37e9a586a 📝 Read a Windows host's event log in record order [ci skip]
The Mac mini's 11-15 outage during a recovery boot read as a hard hang
followed by a planned upgrade, from records filtered by time stamp. Those
records were the install night's, stamped from the firmware clock 8 hours
ahead before Windows first synced its time. In record order the log shows a
sleep, a wake and a power-button shutdown, and two recovery boots on today's
tree ran clean.
2026-11-16 18:25:39 -08:00
Anees Iqbal 2af666bd33 🐛 Build a Windows install outside paths with spaces
A Windows user's folder can hold a space (C:\Users\First Last), and QEMU's
configure refuses a source or build directory with one ("main directory
cannot contain spaces nor colons"). With the library fixed, a user's install
would stop there next: install-ctl.sh builds QEMU in ~/.cache/reims-ctl, in
that folder. With the checkout in the folder too, as install.ps1 clones by
default, sdl3-sys stops first: it finds no SDL3, as a space splits the -L
path of the pkg-config file it reads. Both measured on the mini with a profile
named "Test User". No alias keeps the space out: meson takes realpath of its
directories, which turns an 8.3 short name back into the long one, and a volume
can have no short names (the mini's P: has none).

install.ps1 now clones into C:\reims-vgpu where the user's folder has a space,
saying so, and stops on a -Checkout with one. install-ctl.sh on Windows builds
and stages QEMU in the target directory where the cache directory has a space,
and stops before any download or build on a checkout or CARGO_TARGET_DIR with
one, naming the folder to use.
2026-11-16 16:36:48 -08:00
Anees Iqbal bd239b6ddf 🐛 Build every C and C++ part of a Windows install with clang
A user's install of development on Windows stopped in sdl3-sys's CMake build:
their environment's CC named Visual Studio's cl.exe, cc-rs gave the build
MSVC's C flags (and clang's C++ flags, CXX being unset), and CMake, which
reads CC itself where the cmake crate names no compiler, took cl.exe. Its test
compile failed once MSYS2 had turned /nologo into C:/msys64/nologo. Visual
Studio's install alone does not do it: cc-rs takes cl.exe from it for MSVC
targets only, and our hosts set no CC, so no run of ours met it.

install-ctl.sh on Windows now sets CC, CXX and AR, their per-target forms that
cc-rs takes first, and CMake's generator, to CLANG64's clang, clang++, llvm-ar
and MSYS Makefiles, for cargo's build scripts, CMake, QEMU's configure and
meson alike. The generator is the one the cmake crate chose with none set, and
CLANG64's ar is llvm-ar, so a host without those variables builds as before.
2026-11-16 16:36:48 -08:00
Anees Iqbal 8807df2aa4 🐛 Write CRLF text files out again in Windows checkouts made before
A checkout Git for Windows made before .gitattributes holds every text file
with CRLF line ends (its installer sets core.autocrlf=true), and git does not
write a file again where a later checkout leaves it unchanged: .gitattributes
has it compare the file as LF, so it finds nothing to do. A clone at
core.autocrlf=true moved to the commit that added .gitattributes kept all 1730
text files CRLF, and the build would have failed on the .metal sources' hashes
as before.

install-ctl.sh on Windows now writes each text file whose working copy differs
from its commit only in its line ends out again from the commit, after the
update and before any build, and keeps a file with changes of its own.
2026-11-16 16:36:48 -08:00
Anees Iqbal 5c6beb0131 🐛 Destroy the retired swapchains before a create with none to hand over
A refused vkCreateSwapchainKHR, or a refused wrap of the new swapchain's
images, retires the old swapchain all the same, and the remake keeps it among
the retired until its last present is known complete. Vulkan keeps a retired
swapchain associated with its surface until it is destroyed, and refuses a
create with no oldSwapchain while the window has a swapchain
(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; read from the specification of
vkCreateSwapchainKHR and VkSwapchainCreateInfoKHR, not seen on a host). So
the next remake, with no current swapchain to hand over, was refused for as
long as the retired one lived; on a device without present fences, with
nothing new presented, nothing ever made its presents known complete, and
the window kept its last frame for good, as 245a1ebb6's refusal before the
create did. This is the other half of that class, found in review.

A remake with no current swapchain to hand over now destroys the retired
ones first, waiting for their presents as the swapchain's end does
(end_retired, which Drop now calls too). It runs only after a refused create,
since every other remake hands a current swapchain over.
a_make_after_a_refused_create_ends_the_retired_swapchains_first runs it in
the model window system. docs/lessons.md's entry for 245a1ebb6 says so.
2026-11-16 16:30:23 -08:00
NailecMC 245a1ebb66 🐛 Keep the window's swapchain when its remake refuses before the create
The remake retired the old swapchain whether or not the new one was made,
and the make can refuse before vkCreateSwapchainKHR, where the window's
surface has no pixels for now. Vulkan was never handed the old one, so it
stayed the window's, and each later remake, with no current swapchain to
pass as oldSwapchain, made one beside it, which Windows refuses while the
old one lives (VK_ERROR_NATIVE_WINDOW_IN_USE_KHR). On a Ryzen 5 5600G host
with an RTX 3060 the window kept the macOS installer's last frame from the
guest's reboot on, while QMP's screendumps followed the guest, and drew
nothing on a minimize and restore; the log held the one refusal a refusing
swapchain logs.

A make refused before the create now leaves the old swapchain the current
one, stale, so the next remake hands it over; one refused by the create or
the wrap of its images retires it, as before. No unit test reaches the
swapchain without a window system, and the fix is not yet checked on a
VM boot; docs/lessons.md records the trap.
2026-11-16 22:46:46 +01:00
Anees Iqbal d406890f6c 📝 Record that a guest's block numbers are its release's [ci skip]
The arm64 display was built from 27.0.1's captures of WindowServer's ICC
blocks, and 26.6.2's boot showed every block refused: 26.6.2 numbers each
block one below, 14.6.1 and 15.6.1 send curve blocks of other sizes, and
14.6.1's stages sit one lower. The replays of 27.0.1's captures passed
throughout. The lesson says how to spot the next value that is a release's own.
2026-11-16 09:18:38 -08:00
Anees Iqbal 26822914e9 📝 Record that a setting sent in pieces is judged by its pairs [ci skip]
The arm64 display's ICC chain arrives a block at a time. Judged whole after each
block it is off the identity inside each half, and its curves paired by form
fail for Generic RGB, though each half is the identity. docs/lessons.md says how
to spot the next one.
2026-11-16 09:18:38 -08:00
Anees Iqbal e8552ccf68 📝 Say which toolchain a Windows install builds with [ci skip]
docs/qemu.md said a Windows host whose rustup has another default host builds
with it, untested; install-ctl.sh now pins the gnullvm toolchain there, and a
scratch install with an MSVC default (m3-max-36662) built with it and left
the user's default as it was. README says the same for users. docs/lessons.md
records the handle-inheritance trap behind reims-ctl's detached QEMU on
Windows, which nextest's LEAK found.
2026-11-16 07:56:51 -08:00
Anees Iqbal e52260d08d 📝 Record that a rename below the VFS keeps the vnode's old name [ci skip]
RgfxGate's VNOP_RENAME left the bundle's vnodes on their staging name, which
macOS 14's WindowServer in arm64's BaseSystem would not load from; how to spot
the next one.
2026-11-16 05:18:52 -08:00
Anees Iqbal 32d66f1440 🐛 Install the bundle in arm64's BaseSystem for FileVault's unlock
An arm64 guest's kernel pivots onto the paired Recovery volume's BaseSystem
on every boot, and stays there for FileVault's unlock (every cold start of a
FileVault guest, every restart but an authrestart's) and for Recovery. That
BaseSystem's WindowServer composites with Metal only: with no Metal device
it aborts 30 s after it starts and launchd starts another, so the unlock
screen was never drawn. RgfxGate skipped the BaseSystem as it skips x86-64's
Recovery, where /System/Installation exists, and the accelerator stayed
unregistered there.

What changes for the guest: on arm64 RgfxGate now installs the bundle into
the BaseSystem's temporary Data volume (a tmpfs, checked writable first),
its hooks admit it at that volume's path, and the accelerator registers, so
FileVault's unlock screen and Recovery draw through our GPU. RgfxGate then
watches the Data volume and passes again on the one the boot moves to: the
full system's, once the password unlocks it. The accelerator stays
registered across that userspace reboot, and the full system's Data volume
may hold another build's bundle, which the hooks do not admit; so each pass
of the watch publishes the root it ended under (RgfxGatePassRoot), and the
accelerator holds a process's read of MetalPluginName, which Metal makes
before it loads the bundle, on any other root until that root's pass has
ended. Boots that start in their full system, and x86-64, are unchanged.
2026-11-16 04:41:36 -08:00
Anees Iqbal dc64dac461 📝 Record that the newest SDK imports what old releases lack [ci skip]
The trap behind the IOHIDDevice imports: a class inheriting a method imports
it by name, the SDK's headers are the newest release's, and boots of only the
newest releases miss it. kc-check against each set's oldest release is how to
spot the next one.
2026-11-16 02:44:27 -08:00
Anees Iqbal 7590a54120 ✅ Check that every path the tree tracks checks out on Windows
aux.rs (ad3b37b8e) kept every Windows checkout of development out from
25ff40427 on, through every check, as none checks the tree out on Windows.
`cargo xtask paths`, now the first step of `cargo xtask check`, reads every
path `git ls-files` lists, reims-ctl's and reims-restore's workspaces among
them, and fails on what git for Windows refuses or Windows' file systems
merge: a device name Windows keeps (CON, PRN, AUX, NUL, COM1 to COM9, LPT1
to LPT9, CONIN$, CONOUT$) with or without an extension, a character Windows
refuses (<>:"|?*, a backslash, a control character), a name ending in a dot
or a space, and two paths or directories that differ only by case. Its tests
hold bad names of each kind, aux.rs among them, and names that only start
like a device's.

docs/lessons.md records the trap, and the one beside it: reims-ctl's new
dependency, built for Windows only on Windows.
2026-11-16 02:38:30 -08:00
Anees Iqbal 49c0417199 📝 Record the padded ticket name that kept 1 in 16 VMs from booting
A name the guest builds from a number takes the guest's width: the restore
padded the ECID in the personalized tickets' names, and VMs whose ECID began
with a zero digit finished EACS, then never booted. Three releases had passed
on ECIDs that happened to have 16 digits. [ci skip]
2026-11-16 02:03:40 -08:00
Anees Iqbal ad3b37b8e8 🆕 Restore macOS from an IPSW onto an arm64 VM's disk, offline
reims-restore installs macOS 14 to 27 from a UniversalMac IPSW onto an arm64
VM's disk the way a Virtualization.framework restore does, but writes the disk
itself. It reads the IPSW where it is, asks Apple's TSS for the VM's tickets,
and lays out the GPT, the three APFS containers, NVRAM and the auxiliary
storage as a fresh VZ restore leaves them. No VM runs and no Apple code runs:
no AVPBooter, iBoot, restore OS or ASR. That is the owner's rule for the
install (11-11), and it is what lets the same restore run on arm64 Linux and
on a Mac. A guest boots the result under QEMU's vmapple on Ambrosia.

It is its own Cargo workspace (like reims-ctl), with reims-apfs, its APFS
reader and writer, as a member:
- the IPSW's members, BuildManifest identities, UDIF, AEA (with Apple's key
  service) and the deflated images 14's IPSWs keep (ipsw, manifest, udif,
  aea, image);
- TSS requests and their checked answers, and Image4's DER (tss, img4);
- the install plan, which equals VZ's disks record for record (plan,
  xml_plist, mtree), and the three containers it writes, with the system
  volume sealed by our own seal and root hash (containers, reims-apfs);
- NVRAM, both banks, and the ean storage with the SFR manifest (aux);
- the LocalPolicies, signed by the project's chain, with the guest's trust
  anchors swapped for that chain by Ambrosia Kernel>Patch entries found in
  the IPSW's own kernel collection (policy, anchors, kernelcache);
- macOS 14's Data volume, which its first boot makes by EACS, and
  finish-eacs after it (pipeline);
- the current IPSW from Apple's catalog, downloaded and continued in place,
  never truncating a file (catalog, download, http).
docs/design.md says what each step writes and how each fact was found
(VZ's guests, the IPSWs, or measured). Nothing from an IPSW or a guest is
committed; the tests use inputs written from scratch.

docs/lessons.md records why a live download check must never hard-link the
owner's files: an earlier downloader truncated a hard-linked IPSW in place.

This is the lane's WIP history squashed. Its restore-OS route (route (a),
closed by Apple's per-VM activation attestation) is left out.
2026-11-16 02:03:39 -08:00
Anees Iqbal ba4be7000a 📝 Record KWin's confinement and the popups over the walks [ci skip]
Two traps from the drag walks. KWin keeps a confined pointer where it was
when a move would leave the region, so a crossing that waited for the pointer
to come within a point of the edge happened in one direction only. And
plasmashell's notification popups, stacked above the walk's keep-above
windows, took the pointer where they lay and made crossings land short.
2026-11-15 22:04:45 -08:00
Anees Iqbal 85953c70fd 📝 Record how a stalling trace made the gaps it timed [ci skip]
A boot on um870 with REIMS_VGPU_TRACE on a disk whose writes stalled showed
present-answer gaps that were the trace's own: its writer flushed under the
lock every traced thread takes. The same loop with the trace on tmpfs had none.
The lesson also covers log lines stamped on arrival, which reach the file in
bursts, and says to time answers by their refresh numbers.
2026-11-15 20:47:53 -08:00
Anees Iqbal cfd0ffd7c9 📝 Record the locked session that hid the walks' pointer [ci skip]
Two windowed walks of the pointer across displays on um790 saw no input from
either window while KWin's cursor moved over both: the node's session had
locked itself while idle, and the lock screen took every pointer event. The
lesson says how a walk gets past it and how to spot the next one.
2026-11-15 20:18:21 -08:00
Anees Iqbal 5affa58b2c 📝 Say why Recovery and the installer composite in software [ci skip]
RgfxGate skips its install where /System/Installation exists, and that skip
looked like a gap left open. Measured on x86-64 macOS 15.4 and 26.6.2, it is
not: Recovery's base system ships no IOGPU.framework, which our Metal device
subclasses. A probe that installed the bundle in 26.6.2's Recovery, and in
the base system the installer's second stage roots from, got it registered
and mapped, then WindowServer aborted at every launch. 15.4's Recovery also
keeps /Library/GPUBundles on its read-only root, with no kernel mount KPI to
put a writable volume there. design.md now says so under "Registration
waits for the bundle".

The same probe found that RgfxGate's VNOP_* writers pass the VFS's read-only
check on HFS, which lessons.md records for any path that lifts the skip.
2026-11-15 17:47:02 -08:00
Anees Iqbal 5f750c17e7 📝 Record the cursor guard that a test sink kept green [ci skip]
features.md's Cursor entry kept passing its window-crate guards while no
display fed the window the guest's cursor moves. One of those guards handed the
window the position through a test FrameSink, whose method only the deleted
apple-gfx display answered. The lesson says how to spot such a guard, and that
the end-to-end test from the device is what catches it.
2026-11-15 15:15:42 -08:00
Anees Iqbal de8b8e8d1e 📝 Record the transport that was the clocks drifting [ci skip]
The XTX scout row sized a queue-thread wake of 128 us p50 from the guest_times
transport; it was the device clock drifting from the guest clock at the
host NTP correction between offset readings. The entry says how the probe
told the two apart and how to spot the next span mapped across two clocks.
2026-11-15 13:25:08 -08:00
Anees Iqbal 5cdc9a8410 📝 Record that a batch window is waited out by what follows it [ci skip]
A desktop walk's groups of pages blocks' views held one view each while a
Geekbench walk grouped most of its views: a window over requests with no
answer is waited out by the messages behind them, and a batch judged on one
workload says nothing of another's. The lesson says how the window was
first misread, why it stays, and how to spot the next such window.
2026-11-15 13:14:26 -08:00
Anees Iqbal 753f4deb90 📝 Record where WindowServer's wait behind a GL app sat [ci skip]
Its hold counters pointed at the runtime, but split by signaller the wait was
the host's walk of the app's frame, and the frame's commits went at the end of its
slowest walk, the GL renderer's preprocessing buffer, not the render buffer
the first model looked at.
2026-11-15 08:36:10 -08:00
Anees Iqbal 00c9346cc4 🐛 Build QEMU of another commit in an empty directory
An update to f378a38f8 stopped in QEMU's build on the owner's laptop:
"qemu-version.h: No such file or directory". QEMU of 2026-11-13 writes
that header at configure (configure_file) wherever `git describe --match
'v*'` fails, as it does in every shallow vendor/qemu; the QEMU before made
it with a build step. meson, configuring in place, runs `ninja -t
cleandead` after writing build.ninja, which deletes each file .ninja_log
records as built that build.ninja does not name: the header it had just
written. Every later configure in that directory deletes it again.

install-ctl.sh and `make qemu` now record the vendor/qemu commit a build
directory was configured from (qemu-source) and start the directory empty
when the commit differs; a directory without the record is started empty
once. The same commit keeps its directory, so edits not yet committed in
vendor/qemu rebuild as before.

Reproduced on ms01 (job m3-max-31803): the old QEMU's directory
configured in place for the new loses the header and the compile fails as
on the laptop, twice over; an empty directory keeps it and compiles, and
keeps it when configured again at the same commit.
2026-11-15 03:12:15 -08:00
Anees Iqbal a3365073fd 📝 Record what the mirror cost a GPU-bound guest [ci skip]
Decided 14 gains the 2026-11-14 walk on um870's RTX 3090: the window drawn
from the mirror cost the guest 11% of its frames against the window
presenting from the 3090, because the tile kernel's writes into host memory
held the graphics engine for the link's time. It also describes the copies
on a copy engine. lessons.md says how to spot the next such cost.
2026-11-14 23:33:29 -08:00