Skip to content

qemu, boot: a test for each carried QEMU and qboot patch - #481

Merged
aledbf merged 1 commit into
mainfrom
guard/qemu-patches
Nov 22, 2026
Merged

aledbf merged 1 commit into
mainfrom
guard/qemu-patches

Conversation

@aledbf

@aledbf aledbf commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Why

The machine meets its restore goal and is much faster cold, so the work now is keeping it that way. Every patch the tree carries should be held by a test that fails when the patch is lost or stops doing its job. Before this change, a QEMU or qboot patch dropped at a bump, or rebased so that it applies and does nothing, still built and booted, and nothing said so. patch --fuzz=0 refuses only a patch that no longer applies. #472 asked for this for 0005.

What

  • verify args asks the TCG QEMU what 0001-0004 do, with no guest (TestEachQEMUPatchDoesItsJob, machine/qemu_patches_test.go). It runs on every push against the published QEMU (ci.yml) and on every QEMU parts.yml builds.
      1. The flat views built from QEMU's start to its first answer at spin's shape: 163 with the patch, 429 without. The bound is 300.
      1. A disk at a target past max_target is refused.
      1. A save's stop over a written disk submits one io_uring flush (traced) without x-defer-disk-flush and none with it. The first case proves the trace sees the flush.
      1. query-blockstats has no parent or backing under x-flat, and has them without it.
  • boot:patches asks a guest of spin's shape what only a guest sees (boot/patches_test.go). compat.yml runs it beside boot:record, and lab.yml offers check:patches.
      1. The guest's SCSI host refuses a scan of target 16.
    • qboot's mtrr.patch. /proc/mtrr has the PCI hole uncachable.
    • 0005 (A check that a restored guest's TSC continues from its checkpoint #472). The checkpoint's machine is started ahead and let go when its vCPU is 650 ms younger than the checkpoint's TSC, inside KVM's one-second window, wherever the host's timing put the save. The restored guest, which prints its uptime every 10 ms, may go no more than 200 ms without a line.
  • Docs and bump notes. qemu/README.md gets "The patches", a table of what each patch does, what it earns and what holds it. qemu/qboot/README.md gets "What holds each patch". docs/boot-time.md splits QEMU 0001 from pam.patch and gains a paragraph on what holds each patch. docs/log.md gets the entry. The qemu and qboot notes in versions.yaml name the checks a bump runs.

Proof

Guard With the patch Without it
0001, 0003, 0004 (verify args) pass, ci run 44994248634 0001 removed and 0003/0004 hollowed: each of the three fails, 0002 passes (parts run 44994258922, #482)
0002 (verify args) pass refusal hollowed: fails alone (parts run 44994262948, #483)
0002 and mtrr (boot:patches) pass, compat on this PR 0002's config hollowed and qboot without mtrr: both fail, "15taken" and "/proc/mtrr: Input/output error" (compat run 44994262935)
0005 (boot:patches) v20261122.02: longest gap 12 ms (lab 44993011448) v20261122.01: 625 ms (lab 44993011539)

Measured alone

These are bench runs in spin's shape with prestart, against main's QEMU from parts run 44989641652.

  • Taking 0001 back: restored +11.7 [+0.9, +19.3], cold +0.2 [−8.7, +7.1], 20 a side (lab 44993254745). It earns on the restore.
  • Taking pam.patch back: cold +3.9 [−3.4, +8.0]. Taking no-pci-walk.patch back: cold +5.2 [−1.7, +9.2]. Both at 40 a side (lab 44993790452). Both are inside the noise, but the upper bounds are over +5 ms, so rule 5 of docs/measuring.md keeps them.

Gates: go tool task lint test mutate pass locally (coverage 80.5%, 0 survived).

Closes #472. The kernel's half is #478.

🤖 Generated with Claude Code

A patch dropped at a QEMU or qboot bump, or rebased so that it applies
and does nothing, still built and booted, and nothing said so.

verify args now asks the TCG QEMU what 0001-0004 do, with no guest
(TestEachQEMUPatchDoesItsJob): the flat views built from QEMU's start
to its first answer (163 with 0001, 429 without), a disk beyond
max_target refused, a save's stop submitting no io_uring flush under
x-defer-disk-flush and one without it, and query-blockstats without
parent and backing under x-flat. It runs on every push against the
published QEMU (ci.yml) and on every QEMU parts.yml builds.

boot:patches asks a guest of spin's shape what only it sees: its SCSI
host refuses a scan past max_target (0002), qboot enabled the MTRRs
(mtrr.patch), and a guest restored 650 ms ahead of its new vCPU's TSC
goes no more than 200 ms without a line (0005, #472): 625 ms on
v20261122.01, 12 ms on v20261122.02 (labs 44993011539, 44993011448).
compat runs it beside boot:record.

Each guard failed on a QEMU without its patch (parts runs 44994258922,
44994262948, compat 44994262935). Taken back alone, 0001 read restored
+11.7 [+0.9, +19.3] (lab 44993254745); pam.patch and no-pci-walk.patch
read cold +3.9 [-3.4, +8.0] and +5.2 [-1.7, +9.2] at 40 boots (lab
44993790452), kept by rule 5. qemu/README.md, qemu/qboot/README.md,
docs/boot-time.md and the qemu and qboot bump notes say what holds each.

Closes #472.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf force-pushed the guard/qemu-patches branch from 23b5332 to c7610f8 Compare November 22, 2026 06:47
@aledbf
aledbf marked this pull request as ready for review November 22, 2026 06:48
@aledbf
aledbf merged commit 140ebbb into main Nov 22, 2026
9 checks passed
@aledbf
aledbf deleted the guard/qemu-patches branch November 22, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A check that a restored guest's TSC continues from its checkpoint

1 participant