Commit Graph
173 Commits
Author SHA1 Message Date
Anees Iqbal fc5b3cfd07 📝 State the 0 Hz rule without where it was read [ci skip]
The rule for a mode's rate in an x86-64 guest stands on the boots it names
(m3-max-78416, m3-max-78544). Its two notes on where the rule was read are
dropped, so the docs describe the rule and its measurements only.
2026-12-02 07:41:30 -08:00
Anees Iqbal d26cf49d22 📝 Say why x86-64 guests list their modes at 0 Hz [ci skip]
An x86-64 26.7.2 guest lists every mode at 0 Hz (CGDisplayModeGetRefreshRate,
System Information) though the framebuffer answers the device's rate in each
mode's information and detailed timing. The 0 is x86-64 macOS's own:
CoreDisplay's mode building gives every mode the rate 0, and records IOFB0Hz
in the framebuffer's IOFBConfig, where all the display's valid modes are
progressive and between 57.5 and 62.5 Hz, as for an Intel Mac's 60 Hz-only
panel. A scratch framebuffer giving every mode 120 Hz listed all seven at
120 Hz with no IOFB0Hz; dropping the Apple timing ID changed nothing.

The framebuffer lists no mode at a rate the host screen does not run, so a
guest on a 60 Hz screen keeps reading 0 Hz, and one on a screen of another
rate reads it. Nothing changes for the guest; design.md says what the rule
is and lessons.md how to tell it from a wrong answer of ours.
2026-12-02 07:41:21 -08:00
Anees Iqbal aa9cf71a7f 📝 Record the wire record that grew without the version [ci skip]
A guest of a wire version reads and lays out each record at its own size, so a
record that grows at the same version is misread rather than refused, as the
11-28 report's old bundle was. The lesson says why only a version the kext reads
before it registers its accelerator ends in a picture, and how to spot the next
one in a host's log.
2026-12-02 07:29:40 -08:00
Anees Iqbal 51be62538b 🐛 Wait out a fold in flight before an import looks at its pages
A fold of the views reads the imports' holds once, as it takes the views'
lock, then maps the runs no hold covers through dma-bufs. An import's hold
went into its table under no lock a fold holds, so a hold made while a fold
ran was missed: the import looked at where its pages lie before the fold
mapped them, found them mapped from their files, and handed rt their pointer,
which the fold then remapped as a VM_PFNMAP mapping. A driver that takes a
pointer's pages again once their mapping changed, as Intel's do (the fold
probe in docs/lessons.md), finds no pages there at the import's next use.

A hold now waits for a fold in flight once it is recorded, so the import's
look sees what that fold mapped and takes the dma-buf path, and a later fold
reads the hold. Folds run only at the views' budget, near vm.max_map_count,
or where the kernel refuses a map at its limit of mappings.

The test holds a fold in flight across an import's hold; with the wait taken
out it fails ("the import's look after its hold missed what the fold
mapped"), on homelab-um870-1 with udmabuf.
2026-12-02 06:10:00 -08:00
Anees Iqbal fef583a53d 📝 Say that KWin maps no X11 window while every screen is off [ci skip]
The X11 route's proof on ms01 (m3-max-78242) showed no frame on the 3090 or
the Iris. The session was unlocked, but both screens were off (DPMS), and
KWin then keeps every new X11 window unmapped (_NET_WM_STATE_HIDDEN, no
WM_STATE): the library's, xmessage's and a bare SDL 3 window's alike.
SDL's X11_ShowWindow waits for MapNotify with no time limit, so the UI
thread stopped there before a swapchain was made. With the screens on, the
window showed a frame through X11 on both cards, at development and at
3731afd9b1 (m3-max-78332, m3-max-78336; um790's XTX and 780M, m3-max-78312).

The lesson that blamed the lock alone now names the screens, and the
desktop test's doc says its harness unlocks the session and turns the
screens on first. Nothing changes for the host.
2026-12-02 06:07:46 -08:00
Anees Iqbal 539e3630f2 📝 Record two traps of a window that never shows [ci skip]
A GPU's Vulkan driver can present to a session's X server and not to its
Wayland compositor, and a Wayland window never presented to never appears:
a user's NVIDIA laptop GPU under KWin showed only a task bar entry while the
start said its window was open. The lab's RTX 3090 presents to both, so the
lab could not make that state.

A window proof through X11 on a locked Plasma session cannot pass: KWin
holds every X11 window there unmapped, and SDL's X11 window waits for its
MapNotify inside SDL_ShowWindow, so the window's thread stops until the
desktop is unlocked. The next lane reading such a run should look at the
lock before the code.
2026-12-02 02:33:01 -08:00
Anees Iqbal 6ed6547738 🐛 Read Linux hosts' memory below 4 GiB, down to 64 KiB
PR 191 gave Windows its own zero region end, and left Linux with macOS's:
4 GiB, arm64 macOS's __PAGEZERO. On a Linux host a mapping may lie
anywhere above vm.mmap_min_addr, 64 KiB on stock x86-64 distributions, so
an upload or a buffer's bytes at a host address below 4 GiB died there as
a near-NULL read, as Windows' did.

For the host: on Linux, a texture upload or a buffer made with bytes reads
host memory from 64 KiB up, where it died below 4 GiB. macOS keeps 4 GiB,
Windows 64 KiB. The constant's docs now say each host's fact, and Linux
gets copies_bytes_from_below_four_gib too: a page the test maps below
4 GiB, at 64 KiB where the host lets it, is read.
2026-12-02 02:32:48 -08:00
Anees Iqbal 526bdf6633 ✅ Run reims-ctl's checks with one make target
Does what PR 130 asked for: one command for the checks of reims-ctl, whose
workspace cargo xtask check does not reach. PR 130 routed it through the
library's xtask, which builds in the library's workspace and so fetches
metal2vulkan, that reims-ctl's workspace is kept apart from, and it ran
neither reims-restore's workspace nor the Windows clippy, the one check on
the Mac or Linux that sees a break of their Windows build (docs/lessons.md).

`make check-ctl` runs, by each workspace's own manifest, in crates/reims-ctl
and in crates/reims-restore (a workspace of its own, with reims-apfs):
rustfmt, clippy, clippy for x86_64-pc-windows-gnullvm with MinGW's gcc and ar
for ring's C, and the tests, clippy with -D warnings and each with
--workspace; the cheapest first, stopping at the first failure. Where
x86_64-w64-mingw32-gcc or -ar is not on the PATH it says so and fails before
any step, never skipping the Windows clippy; on Windows itself the host's
clippy is that check, and it says so. The Makefile's header,
docs/development.md and AGENTS.md's reims-ctl row (now naming reims-restore
too) name the target, and the lesson on reims-ctl's Windows build says what
it catches.
2026-12-02 02:16:38 -08:00
vintoware d0547561a0 🐛 Make the Shared pool host memory where KVM maps no cached GPU memory
On an M1 Pro under Fedora Asahi Remix 45, once Honeykrisp met the runtime's
floor, QEMU exited as the guest's driver took the Shared pool: Linux's KVM on
arm64 takes a cacheable VM_PFNMAP mapping as a memory slot only where the CPU
has stage-2 forced write-back and CACHE_DIC, every host mapping of a
Honeykrisp allocation is VM_PFNMAP, and KVM_SET_USER_MEMORY_REGION2 refused
the pool's first piece with EINVAL (#174).

For the host: RvgGraphicsDeviceConfig's sixth version adds pool_host_memory,
0 or 1, any other value refused. A host built before it reads as 0 and keeps
the pool of the GPU's own memory. QEMU sets it under KVM on an arm64 host
whose VM does not answer KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED (vendor/qemu
c9f8890b). Each of the pool's blocks is then a memfd of the library's
(RegionMemory, as the device's region is), which rt imports as a dma-buf
(rt_platform::import_host_block, the no-copy buffers' dma-buf path) and the
device knows as it knows rt's blocks (pool::HostMemoryBlocks, the platform's
host_memory_block_source); pool_add hands QEMU the memfd's mapping, which KVM
maps cached, as it maps the guest's RAM. Host, guest and GPU then reach one
cached memory. A platform that makes no such blocks (macOS, Windows) refuses
the 1, where its pool's blocks would be the GPU's; the guest's Private blocks
keep the GPU's memory everywhere.

An uncached memory type of the GPU's would also pass KVM's check, and needs no
import, but the guest would reach the pages cached while the host zeroes each
take through an uncached mapping, a pair of views the architecture does not
keep coherent. The imports' cost on this kernel was measured first: a program
that imported 16 and 32 udmabufs of 16 MiB into Honeykrisp, a GPU fill into
each, then freed them and the device left Shmem as it was (7.3.4-401.asahi,
Mesa 26.2.7), where kernel 6.19 had been reported keeping such imports.

Tests: the C API's field (0 and a size before the field the GPU's memory, 2
refused, 1 taken on Linux and refused elsewhere); HostMemoryBlocks on the M1
Pro (Honeykrisp): a Shared block is imported host memory, zeros, at a GPU
address, known from take to release, Private refused. The C harness gives the
field 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit a8ad00aca33fb895bb4dd5f11cabef677851b32b; vendor/qemu is kept at the
fork's tip here, and moves to the fork's integrated commit, which carries
the fork's PR 19, in a later commit.)
2026-12-02 01:48:00 -08:00
Gnug ac03e90262 🐛 Ready another first boot when EACS leaves its request
An arm64 VM's first boot runs EACS from the request the restore leaves on
Preboot (<G>/var/db/.com.apple.eacs). On a 27.2.1 (26B131) VM under TCG on an
x86-64 Linux host, mobile_obliterator failed to delete Preboot/<G>/PreLoginData
("Operation not permitted"), stopped clearing that directory and left the
request, yet still made the Data volume and reset. finish-eacs then put the
LocalPolicy back and removed its copies, the next boot ran EACS again and
deleted that LocalPolicy, and the VM stopped at Ambrosia's "can't read the
boot objects" with nothing left to finish it from.

finish_eacs now reads the main container's Preboot for the request. Where a
boot left it, it puts the iBoot system container and the policy nonces back
as before, keeps the copies, counts the boot in eacs-again and asks for one
more first boot; the next finish completes once a boot removes the request,
and after 3 boots that leave it, it asks for a new restore. For the host this
changes what finish-eacs answers after such a boot: an error naming the next
step, where it answered success.

The EACS tests' main container is now a real one, a System volume and a
Preboot holding the request, which the restore's fixture leaves and the EACS
boot's removes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 283139bb83)
2026-12-02 01:46:11 -08:00
Fourgetu 98c50384e3 vulkan: accept valid low host addresses on Windows
(cherry picked from commit 0b6e89333e)
2026-12-02 01:46:11 -08:00
Anees Iqbal 498cc5f328 📝 Record the trap of locking an object the app can reach [ci skip]
The bundle took @synchronized on objects it hands the app, and an app's own
@synchronized on its command buffer then held the buffer's completion. The
lesson says why (Metal takes no such lock, measured by oracle_locks) and how
to spot the next one: bundle_sync_check.sh, and any wait in the bundle on a
lock or queue the app controls.
2026-11-26 17:41:52 -08:00
Anees Iqbal 8e6e84b53e 📝 Word the NT-handle open's charge by what moved with it [ci skip]
Say the measure, not the absolute: the charge an open of a texture's NT
handle on its own device adds to the GPU Process Memory counters never
comes down, even past the device's last release, and available physical
memory, the commit charge and DXGI's usage did not move with it (over 1440
MiB of charge, the lab's UHD 630 and WARP, potluck job m3-max-75692). The
lesson turns over: such a figure is not a leak until one of those moves
with it, which the first job reads. d3d11_surface.rs keeps its own figures
for rt's import, and gains only what was measured on the open.
2026-11-26 16:15:47 -08:00
Anees Iqbal 5a8ed0eb05 🐛 Hand pool textures to vaon12 and the draws as resources
On Windows an open of a texture's NT handle on the device that made it
stays charged to the process's GPU memory once the open, the texture and
the handle are all released. vaon12's import by NT handle is such an open,
and so was the plane draws' OpenSharedHandle: each pool stayed charged
twice, 72 MiB each time for six 3840x2160 NV12 textures, in the GPU Process
Memory counters (what Task Manager shows), which DXGI's usage does not
count. Measured on the lab's Intel UHD 630 under Windows (driver
31.0.101.2145, Mesa 26.2.7) with a program on Direct3D 12 and libva alone;
the opens alone did the same on WARP.

The pools now hand each texture to vaon12 as its ID3D12Resource
(VA_SURFACE_ATTRIB_MEM_TYPE_D3D12_RESOURCE), and the draws wrap the same
resource on D3D11On12: Direct3D 12 makes one device a process and adapter,
so the three are one. Nothing opens a pool texture by a handle any more, so
the textures are made in no shared heap and get no handle. A display whose
driver lists no resource memory type for its H.264 or HEVC decode surfaces
is refused at its open, as one is where libva does not load.

For the host: a decode session's pool no longer stays charged to the
process after it ends, which removes the same two opens the VM makes.
Verified on the lab's Intel card under Windows; expected on NVIDIA under
Windows. pools_let_go_give_back_their_memory is new and reads the process's
charge, and pool_textures_let_go_give_back_their_memory now reads it too.
2026-11-26 16:00:53 -08:00
Anees Iqbal 699d299e3c 🐛 Refuse a Linux host below 7.2 for a VM on our GPU
A VM on reims-vgpu's GPU now needs Linux 7.2 or later on a Linux host, under
any accelerator, where KVM's VMs needed 6.13: reims-ctl's start check refuses an
older kernel, naming the running one and "Linux 7.2 or later", and so does the
reims-graphics device's realize in QEMU (vendor/qemu 458f4b7b). Before 7.2 a
udmabuf over large pages is malformed, and an AMD GPU's import binds the wrong
pages of guest RAM (issue 185); 7.2 builds the table from the pages themselves
(upstream 5bf888673e0d, read from v7.2's drivers/dma-buf/udmabuf.c). The floor
holds KVM's 6.13 reason too. MIN_KVM_KERNEL is MIN_LINUX, and doctor's kernel
line shows on every Linux host.

The floor takes the place of the below-7.2 form: QEMU no longer advises guest
RAM, the device's region or its pool pieces MADV_NOHUGEPAGE, nor logs the 4 KiB
line, and the library's views of guest RAM take no advice (off_huge_pages,
huge_pages_take and linux_release_at_least go, with their tests). On 7.2 and
later nothing changes: QEMU's advice and its collapse with its share line stay.

What hosts see: below 7.2 a start is refused, where it ran with guest RAM on
4 KiB pages; on 7.2 and later the VM starts as before. README, docs/qemu.md,
docs/graphics-kext/design.md and docs/lessons.md say so.
2026-11-25 20:12:04 -08:00
Anees Iqbal 009856dcca 🐎 Put guest RAM on huge pages in QEMU on Linux 7.2 and later
vendor/qemu 695ad62c: one fact decides the guest RAM's pages, whether the
running kernel is Linux 7.2 or later (uname's release by its leading
MAJOR.MINOR, read once; one that does not parse counts as older), and the
backend logs one line saying which it took. 7.2 is the first release whose
udmabuf builds its scatterlist from the pages themselves (upstream
5bf888673e0d); 6.11 to 7.1 bind a large folio's pages wrong in amdgpu's
import, issue 185.

What users see:
- Linux 7.2 and later: as before the revert, the guest's RAM, and the
  device's region and Shared pool, advised MADV_HUGEPAGE, and the RAM
  collapsed into huge pages after its prealloc, with the collapse's line
  saying how much of it went on them (what a host gets depends on its free
  memory as the VM starts);
- below 7.2: all of it on 4 KiB pages at every shmem_enabled, no collapse,
  and a line naming the kernel's release and "before 7.2".

docs/qemu.md's section and table say so, and docs/lessons.md's entry.
reims-ctl's note on prealloc is back as it was, true again on 7.2.
2026-11-25 19:12:47 -08:00
Anees Iqbal 1fafe2b00f 🐛 Keep guest RAM off transparent huge pages in QEMU
vendor/qemu 51382c20: QEMU advises a shared file-backed RAM block of base
pages, the memfd reims-ctl gives every x86-64 VM on Linux, MADV_NOHUGEPAGE in
place of MADV_HUGEPAGE, before its prealloc. The host sees the guest's RAM on
4 KiB pages at every shmem_enabled, where before it was on 2 MiB pages at
advise (CachyOS's default), always or within_size.

The guest's pages reach host GPUs as udmabuf dma-bufs of that memfd, and Linux
6.11 to 7.1 build a udmabuf's scatterlist with an entry per page that names a
large folio's head page and an offset past the page. amdgpu's import walks
that table by DMA page and binds the buffer's pages after the first to other
pages, so the GPU's writes land in other guest memory: issue 185's guest
kernel memory overwritten on a Radeon 890M with Linux 6.18.59. Upstream fixed
udmabuf in 7.2 (5bf888673e0d); hosts on the LTS lines still run the old code.

docs/qemu.md's section says so, as do docs/lessons.md's entry, which now
names the cause, and reims-ctl's note on prealloc.
2026-11-25 19:12:47 -08:00
Anees Iqbal f7787940ae ⏪ Take MADV_COLLAPSE of guest RAM out of QEMU on every host
Move vendor/qemu to de738a41, which reverts 53e76630, the commit cbdac3b3e
moved it to: once the prealloc of reims-ctl's memfd has run, QEMU no longer
collapses the guest's RAM into huge pages, on any host, and its stderr no
longer has the "after MADV_COLLAPSE" line. Nothing turns it back on.

With the collapse, a user's x86-64 macOS 26.7.2 guest on the reims-graphics
device panicked 80 to 154 s into each of 5 boots, its kernel's memory
overwritten (issue 185; a Radeon 890M on RADV, Mesa 26.1.8, Linux 6.18.59).
The reporter's bisect put it on cbdac3b3e: the device with the collapse
panicked; the prealloc with the collapse skipped ran clean for 20 minutes;
the collapse with plain VGA in place of the device ran clean.

For users: guest RAM is preallocated as before, and is on huge pages only
where the host's transparent huge page settings give them at a fault,
shmem_enabled at advise, always or within_size. At never, most
distributions' default, the guest runs on 4 KiB pages, as before cbdac3b3e.

docs/qemu.md drops the collapse's row and section and says again what was
true before it. docs/lessons.md records the trap: the collapse was proven by
one boot to the desktop at each setting, which a fault minutes into use does
not show.
2026-11-25 17:42:31 -08:00
Anees Iqbal 78cf5cb240 📝 Say what dsound's 60 ms reserve and the kick do, and what is left [ci skip]
docs/qemu.md's "Windows hosts: sound" now says what vendor/qemu 207be587
and 4d205af8 do: virtio-snd has the backend write each period as it comes,
and dsound holds 60 ms past DirectSound's write cursor. It says what the
old 92.88 ms held, why its sizing counted the timer twice, and the runs on
the mini: each replayed from every start phase, with the smallest reserve
any start needed (up to 58.0 ms busy at 60 ms), the clicks, and the fill at
a period's write (97.3 to 104.0 ms at the median, against 134.2). It also
gives the Linux host's run with the kick, and what the guest's players are
told of the latency: a constant 100-frame safety offset and no latency.

docs/known-issues.md says, for users, that sound comes about 0.1 s after
video on a Windows host, and why it isn't fixed yet. docs/lessons.md has
the trap: a margin sized as a spread plus one of its parts, and a run's own
start phase hiding its worst one.
2026-11-25 11:30:06 -08:00
Anees Iqbal b60140eb00 🐛 Time a cut writer's handler from its last part's own GPU end
Diagnostics only: nothing the guest or the host observes changes. The
CB_COMPLETE of a buffer the walk cut into parts keeps its merged times.

A present's late-show line gave its last writer's CB_COMPLETE times as the
writer's GPU run. For a cut buffer those start at its first part's start and
end its parts' GPU time summed after that, before its last part's own end by
the GPU's gaps between parts, so "its handler entered N us after its GPU end"
counted those gaps as rt's wake, and a reading of the 5080 walk took 1,582 us
p50 for the host's share where the card's records gave 382 us.

The merge now lets the handler it runs read the last part's own GPU end
(split::last_part_end), and the completion's post carries it to the line
with the handler's entry (present::Handled). The line now says:
- for a buffer not cut, "on the GPU whole from ... to ...", and the handler's
  entry after its GPU end;
- for a cut buffer, its first part's start and its last part's own end, its
  parts' GPU time summed and the gaps between its parts, and the handler's
  entry after its last part's GPU end; where the platform gave the last part
  no GPU times, the entry against the present's take;
- where the handler did not say whether the buffer was cut, that the times
  are its CB_COMPLETE's, which for a cut buffer end the summed time after the
  first part's start.
Its clock tail adds the last part's GPU end and names the CB_COMPLETE's GPU
start and end as such. docs/lessons.md gets the reading trap.
2026-11-23 22:05:56 -08:00
vintowareandClaude Opus 5.5 0b2f6a3110 📝 Record the arm64 USB passthrough boot on Asahi Linux [ci skip]
A macOS 27.2.1 guest under KVM on an M1 Pro, given an iPhone through
reims-ctl, lists the controller's 14 ports and the iPhone at 480 Mb/s on
port 3, and lets go of it when it is taken back. The iPhone stays unusable
there, since usbmuxd's claim makes each SET_CONFIGURATION fail with BUSY,
and QEMU in a rootless container never sees a device that re-enumerates,
which the lessons now say how to spot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 21:08:26 -08:00
Anees Iqbal e023e877b3 ✅ Ban the file calls the test's sandbox cannot kill at
The files test runs the bundle's file calls under a sandbox that asks the
kernel to kill the process at each of the 97 file system calls some
WebContent list leaves out. Its utimes control ran to its end. Each of the 97
calls, made under that sandbox on macOS 27.0.1 (arm64, and x86_64 under
Rosetta), shows the kernel kills at 67 of them. It lets through the 30 that
write: links, owners, flags, times, positioned writes, extended attributes,
fsctl, ACL modes and snapshots. So the sandbox proves nothing about those 30.

bundle_files_check.sh now bans the bundle's imports of the library calls
that make those 30. The test's controls are the calls the kernel does kill:
setattrlist and open_dprotected_np. The test's, RgfxFiles.hpp's and the
lesson's text say what the sandbox covers, and the lesson adds how to spot
a sandbox that lets a call through.
2026-11-22 22:39:31 -08:00
Anees Iqbal 542ee78277 📝 Note that Foundation's file calls can trip an app's sandbox [ci skip]
The lesson of the 11.x WebGL kill: the bundle's earlier rule against
open(2)'s family sent its writes through Foundation, whose system calls
nothing checked, and WebKit's WebContent profile on 11 and 12 kills its
process at any system call its list leaves out. It says where the
profiles were read, what the bundle does now, and how to spot the next
one. The fopen lesson now says the bundle may import open itself.
2026-11-22 22:39:31 -08:00
Anees Iqbal b35bda90d1 🔥 Delete the pages views' grouping, which no platform turns on
The pages blocks' views were grouped into shared udmabuf files only where the
platform's VM answered HostVm::view_groups, and regrouped only where it
answered HostVm::regroup_limits. Since the old Vulkan platform went, no
platform answers either: rt's view imports are made at SURFACE_PAGES with the
import's own address, each view one import, and the planner ruled that
grouping does not come back in any part. The code only the testkit drove is
deleted:
- SurfaceViews::join_group, group_closed, seal, group_jobs and their types
  (Joined, Sealing, the forming groups, HandedOver, WaitsForViews),
  GROUP_WINDOW and GROUP_MEMBER_MAX, and the decoder's wrappers;
- decode/surface_pages/regroup.rs, the decoder's regroup_moves, and
  GraphicsControl's regroup_step, seal_group, group_key and REGROUP_KEY;
- HostVm::view_groups, group_views and regroup_limits with GroupLimits,
  GroupHold and ViewGroups, and the testkit FakeVm's answers to them;
- Buffer::rebind_no_copy, which only regroups called, its testkit impl and
  the two tests of its refusal;
- the grouping and regroup tests in graphics/tests.rs.

start_over_pages hands the over-pages job to the surface worker as before
grouping, and a context's close no longer drops groups first.

Nothing the guest or the host observes changes: no platform grouped a view,
so every view was already an import of its own. No degradation counts-line
code is dropped; grouping wrote none. The diagnostics that go with it are the
views log line's "imported as pieces of group dma-bufs" clause, the regroups
info line, the trace events regroups, regroup, regpass and regcand, and the
seal's and regroups' debug lines.

The surface_pages module doc and docs/graphics-kext/design.md now say each
pages block's view is one import, keeping the measured cost of an import a
submission; docs/lessons.md keeps both grouping lessons as traps, in the past
tense.
2026-11-22 12:53:21 -08:00
Anees Iqbal c31ac47ad0 🐛 Answer nil for a no-copy buffer past maxBufferLength
newBufferWithBytesNoCopy: made a buffer of any length, and the host then
refused its BUFFER_OVER_PAGES past the device's maxBufferLength, so the app
held a buffer whose uses in its command buffers the host dropped. Metal's
answer, measured with oracle_errors bounds under macOS 26.7.1: the Intel 630
makes one at its maxBufferLength and answers nil one byte and one page past
it, its process going on; the AMD 5300M makes both. Nil is inside what the two
answer and is the one that keeps the app's view true, so the bundle now
answers nil past the device's maxBufferLength, posting nothing, with its
noteNil line, wherever the bytes lie. The tiled no-copy texture goes through
the same factory and follows.

For the guest: a no-copy buffer or tiled texture past maxBufferLength is nil
where it was an object the host refused. The factory takes the limit
(maxLength, 0 for none), so the tests that made no-copy buffers pass 0 and
hold what they held; a new test holds the bound. The host's comments that said
the bundle made such buffers at any length now say what it does.
2026-11-22 01:29:34 -08:00
Anees Iqbal 839d1f0527 ✅ Run the seam's and the pool's rt tests on a Mac
Twelve tests were ignored on macOS because rt's floor refuses MoltenVK: the
seam's blit and sampler-ID tests (9) and the pool's rt-block tests (3). A Mac
now runs the rt platform over Mesa's KosmicKrisp, and cargo xtask check links
it in ../lib of each test binary's directory, so they can run there.

The pool's three tests take the platform's device and passed on the M3 Max as
they were. The seam's nine failed: seam::test_device made rt's own instance,
whose loader search found no Vulkan loader on the Mac ("rt's instance: no
Vulkan loader: dlopen(libvulkan.dylib ...)"), and would have found only
MoltenVK where it did. test_device now makes the platform's instance
(os::rt_instance), which is rt's own instance off the Mac, as before, and over
KosmicKrisp on it.

Tests only: nothing the guest or the host sees changes.
2026-11-22 01:18:25 -08:00
Anees Iqbal 0b3bb668b7 🐛 Give back slabs let go while a buffer's create waited
A Shared or Managed newBuffer in the guest could answer nil while the process's
own memory was on its way back to the region. A create that found no room let
the process's empty, cached and doomed slabs go, waited for the slabs other
threads were giving back at that moment, and asked once more. Under CPU load the
slabs' background thread, at utility QoS, falls behind on its drops: the slabs
other threads let go while the wait lasted stayed doomed, their memory out of
the source, and the second ask was refused while 26 to 52 of them held it.

A create now goes round again for as long as a round gave memory back, so its
answer is nil only where the region, or the pool, is full. A round after the
first asks again only where it gave something back, so a create in a quiet
process does what it did.

test_slab_take_gives_back_slabs_let_go_while_it_waited holds the slabs' releases
at the test source's gate while a create waits, so the slabs let go meanwhile
stay doomed: it failed in 20 of 20 runs on the old code and passes in 20 of 20.
test_slab_thread, which saw it once under Rosetta beside a 16-job cargo build,
refused a 3 MiB take in 6 of 3,828 runs beside 48 busy loops and 8 dd copies on
the M3 Max's 16 CPUs before, and in none of 3,144 after.

Both prebuilt sets are rebuilt from the change.
2026-11-21 16:59:23 -08:00
Anees Iqbal 81967c598b 📝 Document AVX-512 state for guests on Zen 4 hosts [ci skip]
qemu.md's CPU model section now says why a Zen 4 host runs a macOS guest's
code without its op cache, what QEMU's x-avx512-xstate property and
RgfxGate's xstate route do about it, the four conditions under which
reims-ctl adds the property, how a VM's cpu_flags turn it off for a KDK
kernel, and what was measured: op-cache shares, the route on six releases,
and the timed pairs on the 8745H.

lessons.md records the trap the route had to fix: XNU copies a thread's
AVX-512 state at Intel's XSAVE offsets, which on a Zen 4 core are not
where XSAVE put it, and nothing logs the loss.

known-issues.md tells users that a DEVELOPMENT or DEBUG kernel stops on
such a host, and how to start one.
2026-11-21 08:52:15 -08:00
Anees Iqbal 9c211e49a3 ✅ Run the held-create race tests on fair-share mutexes
The two race tests of 21e637db25 passed against the two-hold code they guard:
on libpthread's default mutex policy the committing thread took the held
messages' mutex again before the thread waiting on it, so the window between
the holds was never met. Each now runs in a child of its binary on the
fair-share policy (PTHREAD_MUTEX_DEFAULT_POLICY=1, rgfxRunFairShare), where an
unlocked mutex goes to its waiter, and checks that the child has it. The
protocol test's kext now refuses a held destroy, as a post that took every
held message leaves the old check a lock-free answer that waits for nothing.

Against the sources before the fix both fail, the serializer's at
postHeldCreates and the protocol's at the buffer missing from its ring; on
the fixed tree `make -C guest test` passes. The trap is in docs/lessons.md.
The bundle's tests are not among the sets' sources, so the sets stay as built.
2026-11-21 02:31:50 -08:00
Anees Iqbal cc36995975 🐛 Keep a VA decoder's pool and config with its kept context
On Windows the kept-context change held only a context's teardown and
destroyed a pool's surfaces and its config at once, beside the display's
live contexts. That passed the two-thread test, but rounds of 2 and 4
decoders each decoding the stream at once, each picture waited for and not
read back, had a decoder's vaEndPicture fail in every run of 6 on vaon12 on
the UHD Graphics 630 (potluck jobs m3-max-61922, 61930, 61939), where
development, which holds every teardown, passed 4 of 4, and holding the
surfaces' teardown too passed 2 of 2 (m3-max-61948).

So every teardown is held again while a context lives, and a decoder's
context is kept with its config and its pool: Context::new_decoder makes
the three, or takes the three back for a decoder of the same shape (now
with the surface format and count), so beside a live context nothing is
made or destroyed for a shape kept. A kept pool lets go of its
video-processing context first, which as a live context would keep the
held teardowns from ever being made, and a stalled pool is neither kept
nor taken back. The release_teardown doc's measured claim that destroying
a pool's surfaces at once passed is corrected with these runs, and the
full-pace test runs their shape.
2026-11-20 23:49:26 -08:00
Anees Iqbal 4dde74e729 🐛 Keep a VA decoder's context for its shape, not its whole teardown
On Windows every teardown asked for while another VA context lived was
held until none did, which stopped Intel's Direct3D 12 video driver
faulting, and kept each short 4K decoder's memory (about 211 MB of DXGI's
local count) until the long decoder beside it ended.

Measured on the UHD Graphics 630 (job m3-max-61642): holding the
context's destroy alone passes the two-thread test, with the pool's
surfaces, or the surfaces and the config, destroyed at once. Held
contexts still grew DXGI's local count by 34,905,201 bytes each. So a
config's and a pool's surfaces' teardowns are now made at once, and a
decoder's context let go while another lives is kept with its config
and taken back by the next decoder of the same config, size, render
targets and DPB, instead of one made beside it. Kept contexts are
destroyed with the held teardowns once no context lives. Linux is
unchanged, and so is what the guest sees.

The churn test makes ten short decoders beside a long one, compares their
pictures with the long one's, and on Windows asserts DXGI's local count
grows by less than one held context over the last nine.
2026-11-20 23:49:26 -08:00
Anees Iqbal 868dd01c16 📝 Record that kache drops a Windows cdylib's import library [ci skip]
The b357 merge's Windows leg failed the C harness's link: the build hit a
kache entry for reims-vgpu-c's cdylib that holds the DLL but not
libreims_vgpu_c.dll.a, which a test-only change leaves unrelinked. The
merge harness now relinks the crate past kache where the archive lacks it.
2026-11-20 11:52:58 -08:00
Anees Iqbal 04544a4e78 🐛 Hold a test's rt platform to its end's let-go, not weakly
A test's end kept a weak hold of each rt platform the test used and let go
of the device of each one it could still upgrade. An Arc's last drop takes
the strong count to zero before the value's drop runs, so a platform whose
last hold was another thread's (a decoder's event-wait watch, a VA call
thread) failed the upgrade while its drop, and its let-go of the device,
still ran on that thread beside the process's exit. On an RTX 3090 a
cmdbuf test printed ok and died of SIGSEGV, the event-waits thread inside
vkDestroyDevice while the main thread ran libEGL_nvidia's exit handler
(measured from its core, 1 of 2440 tests under the suite's load); the 780M
saw the same test die after ok.

The end now holds each platform strongly to the let-go, which waits for
the device's other handles, tears the device and its instance down on the
end's thread, and leaves the platform no device for a later drop to tear
down. drop_last, the VA tests' wait for the platform's other holds, is no
longer needed and goes. A new test leaves a platform's last hold to a
thread nothing joins and checks from an exit handler that the device was
torn down before the exit; the weak end fails it.

Nothing the guest or the host sees changes: this is test code.
2026-11-20 11:35:51 -08:00
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