Skip to content

[DO NOT REVIEW] microVM: name repeated and unordered entries of a snapshot's CPUID record - #4818

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
feature/microvm/devfrom
copilot/microvm-cpuid-record-differences
Oct 30, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
feature/microvm/devfrom
copilot/microvm-cpuid-record-differences

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Follows up #4804 from its review, for microsoft/nvx#568. When the effective CPUID that a restore recomputes differs from the snapshot's record, the E_CPU_SURFACE error now names every difference of the record, also those that only a record that no OpenVMM writes, but that the decoder admits, can have: each entry that the record lists more than once, each of its listings that differs, and a record out of order, together with the entries that differ. The tests of the error now check each register, value, and mask.

Based on feature/microvm/dev. This branch is two commits directly on e4c741e18, the head of feature/microvm/dev since #4804 merged, which microsoft/nvx's dev pins. microsoft/nvx#1039 pins this branch's head.

Why

A review of #4804 found two gaps in the comparison of a restore's effective CPUID with the snapshot's record. recorded_cpuid_differences collected the record's entries in a BTreeMap by leaf and subleaf, which keeps only the last listing of a key, and named a record out of order only when nothing else differed. decode_effective_cpuid checks the record's size and the encoding of its subleaves, but neither repeated keys nor order, so the error did not name every difference of such a record:

  • A changed listing of an entry, followed by its own listing, was reported as "the snapshot lists the same entries in another order".
  • A record out of order, with a changed entry, named the changed entry alone, and a restore with that entry fixed then reported the order.

The tests of the comparison also checked a flipped bit of EAX alone, and matched the differences of the topology leaves by prefix: no change of a mask alone, no EBX, ECX, or EDX, no entry with several registers, and no order of the entries that only one side has.

Each register, value, and mask (e51ab72d3)

Tests only. recorded_cpuid_names_each_register_in_which_an_entry_differs checks the whole error for a change of the value, and of the mask, of each register of an entry of a subleaf alone; for three registers of one entry, which are named in order on one line; and for an entry that differs among two entries that the snapshot lacks, followed by two entries that only the snapshot has, which are named and counted in that order.

Repeated and unordered entries (bcfc47cff)

recorded_cpuid_differences maps each leaf and subleaf to every listing of the record, in order, and compares each listing with the partition's entry, naming each that differs with the registers in which it differs. After the entries that only one side has, as before, it names each entry that the record lists more than once, with the number of its listings, and then, whatever else differs, a record that does not list its entries in order of leaf and subleaf, as EffectiveCpuid::results, whose encoding the record is, does. For a changed listing of CPUID 0x0 followed by its own:

[E_CPU_SURFACE] the effective CPUID of CPU profile intel.icelake-sp.v1 differs from the snapshot's in 2 entries: CPUID 0x0 EAX is 0x0000001b under mask 0xffffffff, and 0x0000001a under mask 0xffffffff in the snapshot; CPUID 0x0 is in the snapshot 2 times

The error keeps its code, and names the differences of a record that OpenVMM writes, which lists each entry once and in order, as before. Its count counts each item that it names, the order included, as it counted the order before. The list is never empty: the partition's entries are unique and sorted, so a record that decodes and differs from their encoding differs in an entry, in the listings of an entry, or in its order. recorded_cpuid_names_repeated_and_unordered_entries checks the whole error for an entry listed twice, changed before or after its own listing, or unchanged; for entries out of order, alone and with an entry that differs; and for an entry listed again out of order. The Guide's snapshot page says what the error names.

Validation

  • On Windows, at each commit, for openvmm_core: cargo clippy --all-targets -p openvmm_core -- -D warnings, cargo doc --no-deps -p openvmm_core, cargo nextest run --profile agent -p openvmm_core (122 and 123 tests passed), and cargo xtask fmt --fix, all clean.
  • With recorded_cpuid_differences of e51ab72d3 in place of bcfc47cff's, recorded_cpuid_names_repeated_and_unordered_entries fails on the review's first case: the error names "the snapshot lists the same entries in another order" instead of the changed listing and the repeated entry. The tests of e51ab72d3 pass with either.
  • Every commit is signed.

The comparison of a restore's effective CPUID with the one that the
snapshot recorded names, for each entry that both have, every register
in which they differ, with its value and mask on each side, then the
entries that only one side has. Its tests checked a flipped bit of EAX
alone, and matched the differences of the topology leaves by prefix.

Check the whole message for a change of the value, and of the mask, of
each register alone; for several registers of one entry, which are
named in order on one line; and for an entry that differs among entries
that the snapshot lacks, followed by entries that only the snapshot has,
which are named and counted in that order.

Follow-up to microsoft/nvx#568, from the review of
#4804.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When the effective CPUID that a restore recomputes differs from the one
that the snapshot recorded, the E_CPU_SURFACE error names every entry
that differs. It mapped the snapshot's entries by leaf and subleaf, so
an entry listed twice kept only its last listing, and it named a
snapshot whose entries were out of order only when nothing else
differed. The record's decoder admits both, although no OpenVMM writes
them, so the error did not name every difference: a changed listing
followed by the entry's own was reported as the same entries in another
order, and a record both out of order and with a changed entry named
the changed entry alone, which a second restore then followed with the
order.

Compare every listing of an entry with the partition's, and name each
that differs, with the registers in which it differs; name each entry
that the snapshot lists more than once, with the number of its
listings; and name a snapshot that does not list its entries in order
of leaf and subleaf, as the partition's effective CPUID does, whatever
else differs. The error keeps its code, and names the differences of a
record that OpenVMM writes as before.

Tests check the whole error for an entry listed twice, changed before
or after its own listing, or unchanged; for entries out of order, alone
and with an entry that differs; and for an entry listed again out of
order. The snapshot guide says what the error names.

Follow-up to microsoft/nvx#568, from the review of
#4804.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

@ppenna
Pedro Henrique Penna (ppenna) merged commit bcfc47c into feature/microvm/dev Oct 30, 2026
72 of 74 checks passed
Pedro Henrique Penna (ppenna) added a commit to microsoft/nvx that referenced this pull request Oct 30, 2026
Record the two commits that the previous commit pins as positions 368
and 369 of the microVM chain, and move the NVX pin to 5e0ab772e.

Positions 368 and 369 make OpenVMM's VM time keeper map a timeout
beyond what the host clock can represent to the host clock's latest
time: one more than about 584 years after the last start no longer
panics the task that arms it, and one nearly half the ring after now,
which VM time's circular order puts before the start, no longer arms the
host timer in the past. They change only vmcore's vmtime.rs, which
upstream main and the fork base have alike, and apply to upstream main
as they are; say so in the table's remarks. The pin is now 212 commits
past the mapped tip.

Position 367, bcfc47cff, is the head of feature/microvm/dev since
microsoft/openvmm#4818 merged positions 366 and 367. Say so in the
scope, and name microsoft/openvmm#4820 as the proposal of positions 368
and 369.

Refs #1038

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit to microsoft/nvx that referenced this pull request Oct 30, 2026
Pin microsoft/openvmm#4816 at 6b409bd1035678a32faac3761c36e2219f7f8000,
two commits on bcfc47cff, the previous pin and the head of
feature/microvm/dev since microsoft/openvmm#4818 merged.

OpenVMM's KVP IC test booted Windows Server 2022, whose COM activation
race can lose WMI's server-registration notification, so that the
guest answers the test's IP information request with 0x80080005 after
120 s. The race failed the test in the WHP run of dev at c938ab2. The
first commit ports microsoft/openvmm#4803 unchanged and moves the test
to Windows Server 2025, which has the fix. The second stages the Server
2025 image for the check-in gates' x64 Linux KVM job. It excludes the
test from the MSHV job, where Server 2025's required initial reset
consistently fails with HvCallSetVpRegisters returning Invalid parameter.

The test's name holds its image, so it is now
multiarch::ic::openvmm_uefi_x64_windows_datacenter_core_2025_x64_kvp_ic.
Rename it in OPENVMM_WHP_TESTS, and plan the WHP shards again with an
estimate of 57.4 s for it until CI's reports measure it: NVX's median
of 34.0 s on Server 2022 times 1.69, the mean ratio of the test's
durations on Server 2025 and 2022 on upstream's x64-windows-intel and
x64-windows-amd runners. The plan moves three other tests to balance
the shards, which take 128.4 and 128.3 s instead of 119.8 and 123.9 s,
so ci.md now gives the latter as the first plan's.

The KVM and MSHV filters select every test whose name contains openvmm
and left out Windows guests only by windows_datacenter_core_2022_x64,
so the renamed test would have joined them. Leave out every Windows
Server Datacenter Core test instead, and test that through the
substring form of nextest's test(), which the filters use.

The protocol vectors and built-in CPU profiles that nvx-rs copies are
unchanged.

Refs #1035

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pedro Henrique Penna (ppenna) added a commit to microsoft/nvx that referenced this pull request Oct 30, 2026
… roadmap

Record the two commits that the previous commit pins as positions 368
and 369 of the microVM chain, and move the NVX pin to 6b409bd10.

Position 368 makes the change of microsoft/openvmm#4803 unchanged: the
KVP IC test boots Windows Server 2025 instead of 2022, whose COM
activation race can fail the guest's answer to the test's IP
information request. Position 369 stages the Server 2025 image for the
check-in gates' x64 Linux KVM job. It excludes the test and its image
from the MSHV job, where Server 2025's required initial reset fails. A
rebase onto an upstream main that includes microsoft/openvmm#4803 drops
position 368 and reconciles position 369 with upstream's changes for
those jobs; say so in the table's remarks. The pin is now 212 commits
past the mapped tip.

Keep the re-checked chain in the scope: microsoft/openvmm#4807 merged
positions 360 and 361, microsoft/openvmm#4804 merged positions 362-365,
and microsoft/openvmm#4818 merged positions 366 and 367. Position 367,
bcfc47cff, is therefore the head of feature/microvm/dev, and
microsoft/openvmm#4816 proposes positions 368 and 369.

Refs #1035

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant