From c362295a51410b5a1784342b910beabbfc383a52 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Sat, 14 Nov 2026 04:26:34 -0800 Subject: [PATCH 1/2] openvmm: pin the SYSENTER MSRs held in the fields that name them On KVM, MSHV, and WHP, a VP's saved VirtualMsrs held IA32_SYSENTER_ESP in sysenter_eip and IA32_SYSENTER_EIP in sysenter_esp, since get_values and set_values paired the registers with the fields in the opposite order of names(). A save and a restore round-tripped, because the two swaps cancel, but anything that read the fields by name saw the wrong register, and OpenHCL's TDX and SNP processors, which fill the fields by name, disagreed with these backends (#1367). Pin c5509cde20d624fa49b90722c34ad292ab7672cb, the head of microsoft/openvmm#5100, one commit on 5d2a71027, the head of feature/microvm/dev: - c5509cde2 virt: hold each SYSENTER MSR in the field that names it get_values, set_values, and at_reset now pair the registers with the fields in the order that names() lists them, and the two fields swap their declaration order and their numbers, so that field 3 holds IA32_SYSENTER_ESP and field 4 holds IA32_SYSENTER_EIP, as KVM, MSHV, and WHP have always saved them. The bytes that a VirtualMsrs encodes do not change, so every snapshot of the current format restores with the right SYSENTER_EIP and SYSENTER_ESP, and a snapshot that the pin saves restores the same way in a build from before it. No OpenHCL saved state holds VirtualMsrs, so none is misread. No version is created or bumped, and no snapshot or wire format changes. Tests: the revision's three tests of virt fail at 5d2a71027 and pass with it, and its 108 tests of virt pass on Windows and on Azure Linux 3.0. On nvx-kvm-test its 77 tests of virt_kvm and kvm, the ignored /dev/kvm ones included, pass as well. A guest on nvx-kvm-test, nvx-mshv-test, and nvx-whp-test read the IA32_SYSENTER_ESP and IA32_SYSENTER_EIP of each of its one or two CPUs and requested a snapshot: OpenVMM built from 157866605 and OpenVMM built from the pin's tree saved the same bytes, and a snapshot that either build captured, restored with the other build, kept each CPU's two MSRs. With OpenVMM built from the pin's tree and the artifacts of v0.1.0-dev.0b1029a5c372, the microVM scenarios smp, smp-snapshot, snapshot-core, snapshot-rollback, restore-downtime, restore-processors, snapshot-tiers, and time-abi-conformance pass at 1 and 2 processors on all three hosts. NVX needs no coordinated change: the control-session vectors, the source excerpts, the contract versions, the activation bound, and the CPU profiles that nvx-rs copies from OpenVMM match the revision's, and nothing of NVX names the fields of VirtualMsrs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- openvmm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvmm b/openvmm index 5d2a71027..c5509cde2 160000 --- a/openvmm +++ b/openvmm @@ -1 +1 @@ -Subproject commit 5d2a71027101d6e9f861d7c29dfbf59ed0eb20c5 +Subproject commit c5509cde20d624fa49b90722c34ad292ab7672cb From 4c6f1a161c9d4f66117df7d5bdaeca363ed4c33a Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Sat, 14 Nov 2026 04:26:34 -0800 Subject: [PATCH 2/2] doc: map the SYSENTER MSR fields in the OpenVMM roadmap The NVX pin moves to c5509cde2, position 280, 156 commits past the mapped tip. Position 280, the one commit of microsoft/openvmm#5100 on 5d2a71027, the head of feature/microvm/dev, is not yet assigned to a PR. Position 280 makes VirtualMsrs, the virtual MSRs of a VP, hold IA32_SYSENTER_ESP in sysenter_esp and IA32_SYSENTER_EIP in sysenter_eip, which KVM, MSHV, and WHP held in the other's field, since get_values and set_values paired the registers with the fields in the opposite order of names. It swaps the fields and their numbers, so that the type encodes the same bytes as before, and documents on HvRegisterState that its three methods list the same registers in the same order. It changes code that upstream main has and no commit of the chain changes, adds three tests to the tests module that position 132 adds and position 251 extends, and changes nothing that a mapped PR adds. Replaying it on upstream main, 7d90c4104, conflicts only where its tests extend that module, which upstream main lacks, so they follow positions 132 and 251 upstream, and the rest of the commit applies there without conflicts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- doc/openvmm-upstream-roadmap.md | 38 ++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/doc/openvmm-upstream-roadmap.md b/doc/openvmm-upstream-roadmap.md index a5bfba8ce..180261ba7 100644 --- a/doc/openvmm-upstream-roadmap.md +++ b/doc/openvmm-upstream-roadmap.md @@ -11,10 +11,11 @@ summary, and commit mapping below cover positions 001-124, the PR09 fixups at positions 234-236, the PR13 fixup at position 240, the PR18 fixup at position 241, the PR20 fixup at position 242, the PR19 fixup at position 243, and the PR10 fixups at positions 271 and 273. -- NVX's pinned OpenVMM revision: `5d2a71027101d6e9f861d7c29dfbf59ed0eb20c5`, position 279, the - head of microsoft/openvmm#5097, whose one commit follows position 278, `157866605`, the head of - `feature/microvm/dev`, to which microsoft/openvmm#5095 added positions 277-278 after position - 276, `7b205c0a0`, microsoft/openvmm#5094 added position 276 after position 275, `efe6bc267`, +- NVX's pinned OpenVMM revision: `c5509cde20d624fa49b90722c34ad292ab7672cb`, position 280, the + head of microsoft/openvmm#5100, whose one commit follows position 279, `5d2a71027`, the head of + `feature/microvm/dev`, to which microsoft/openvmm#5097 added position 279 after position 278, + `157866605`, microsoft/openvmm#5095 added positions 277-278 after position 276, `7b205c0a0`, + microsoft/openvmm#5094 added position 276 after position 275, `efe6bc267`, microsoft/openvmm#5087 added position 275 after position 274, `e2458a6ce`, microsoft/openvmm#5084 added position 274 after position 273, `09cd771c0`, microsoft/openvmm#5083 added position 273 after position 272, `fb2c8b75c`, and @@ -25,9 +26,9 @@ changes upstream had landed, and added eight fixups at its tip, positions 262-269. A commit's position is its v6.0 position less the number of dropped commits before it: v6.0 positions 003-007 are positions 002-006, 010-013 are 007-010, 015-050 are 011-046, and 054-268 are - 047-261; see [Conflicts of the v6.1 rebase](#conflicts-of-the-v61-rebase). The pin is 155 + 047-261; see [Conflicts of the v6.1 rebase](#conflicts-of-the-v61-rebase). The pin is 156 commits past the mapped tip on the same first-parent chain. Positions 125-233, 237-239, - 244-270, 272, and 274-279 are not yet assigned to PRs, positions 234-236 are PR09 fixups, + 244-270, 272, and 274-280 are not yet assigned to PRs, positions 234-236 are PR09 fixups, position 240 is a PR13 fixup, position 241 is a PR18 fixup, position 242 is a PR20 fixup, position 243 is a PR19 fixup, and positions 271 and 273 are PR10 fixups; see [Commits after the mapped tip](#commits-after-the-mapped-tip). @@ -1168,7 +1169,8 @@ The physical branch is one first-parent chain: -> XSAVE lengths that overflow saturated [277] -> KVM's XSAVE buffer checked against a restored profile's layout [278] -> restored EFER's SVME checked against the guest's CPUID [279] - -> 5d2a71027 (NVX pin) + -> SYSENTER MSRs held in the fields that name them [280] + -> c5509cde2 (NVX pin) ``` For upstream review, PR01-PR03, PR05, PR06, and PR14 can be rebased independently onto current @@ -1219,7 +1221,7 @@ restore and time advance set in the RTC's clock source, which overflowed near ei ## Commits after the mapped tip -The NVX pin extends the chain past position 124 without merges. Of the 155 later commits, +The NVX pin extends the chain past position 124 without merges. Of the 156 later commits, positions 234-236 are PR09 fixups, position 240 is a PR13 fixup, position 241 is a PR18 fixup, position 242 is a PR20 fixup, position 243 is a PR19 fixup, positions 262-269 are the fixups of the v6.1 rebase, positions 271 and 273 are PR10 fixups, and the others are not yet classified or @@ -1229,7 +1231,7 @@ and 162-200 did, which developed one concept; "(part)" marks a v2.4 fixup that s commits. Positions 180-184 followed the v3.0 reorganization, positions 185-198 are the ABI restart of the v4.0 reorganization, positions 199-204 followed it, positions 205-211 followed the v5.0 reorganization, positions 212 and 213 followed the v5.1 rebase, positions 214-261 followed the -v6.0 reorganization, positions 262-269 are the v6.1 rebase's fixups, and positions 270-279 +v6.0 reorganization, positions 262-269 are the v6.1 rebase's fixups, and positions 270-280 followed the v6.1 rebase, so they combine none, apart from position 213, which combines v5.1 positions 222 and 223. Each commit's position is its v6.0 position less seven, the number of commits that the v6.1 rebase dropped before it, and its v6.0 position is its v5.1 position @@ -1397,10 +1399,11 @@ through 147 and one less from v5.1 position 149 on; see | 277 | `6a1131a00` | - | - | - | - | - | virt: saturate the XSAVE lengths that overflow (microsoft/openvmm#5095) | | 278 | `157866605` | - | - | - | - | - | virt_kvm: refuse an XSAVE layout that KVM cannot hold (microsoft/openvmm#5095) | | 279 | `5d2a71027` | - | - | - | - | - | virt_kvm: refuse a restored EFER.SVME for a guest whose CPUID has no SVM (microsoft/openvmm#5097) | +| 280 | `c5509cde2` | - | - | - | - | - | virt: hold each SYSENTER MSR in the field that names it (microsoft/openvmm#5100) | The remarks that say whether commits apply to upstream main record what was found on upstream main when each commit was mapped: the v3.0 reorganization's base, `b2676222b`, for the commits -that it regrouped, and later fork bases, up to `7d90c4104` for positions 270-279, for later +that it regrouped, and later fork bases, up to `7d90c4104` for positions 270-280, for later commits. They name the positions that the commits have now, but the v6.1 rebase did not check the earlier ones again on `7d90c4104`. @@ -2245,6 +2248,21 @@ conflicts only at the end of the VP state module, where its unit test extends th that position 250 adds, so that test follows position 250 upstream, and the rest of the commit applies there without conflicts. +Position 280 makes `VirtualMsrs`, the virtual MSRs of a VP, hold IA32_SYSENTER_ESP in +`sysenter_esp` and IA32_SYSENTER_EIP in `sysenter_eip`. Its `get_values` and `set_values` paired +the registers with the fields in the opposite order of `names`, so that on KVM, MSHV, and WHP, +which save the type through them, each field held the other's register, while OpenHCL's TDX and +SNP processors fill the fields by name. It pairs them in the order of `names` and swaps the two +fields and their numbers, 3 and 4, so that the type encodes the same bytes as before, and it +documents on `HvRegisterState` that `names`, `get_values`, and `set_values` list the same +registers in the same order, in code that upstream main has and no commit of the chain changes. It +adds three tests at the end of the VP state module's `tests` module, which position 132 adds and +position 251 extends. It changes the VP state module, which PR10's positions 020 and 022 and +positions 132, 140, and 251 also change, none of them in `VirtualMsrs`, and nothing that a mapped +PR adds. Replaying it on upstream main conflicts only where its tests extend that `tests` module, +which upstream main lacks, so they follow positions 132 and 251 upstream, and the rest of the +commit applies there without conflicts. + ## PR summary Each count is of v6.1 commits, which include the fixups that the v3.0, v4.0, v5.0, and v6.0