Skip to content

openvmm: pin the PCI slots that failed chipset device adds leave free - #2061

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-1904-pci-slot-rollback
Nov 23, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-1904-pci-slot-rollback

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1904

What does this pull request change?

It pins microsoft/openvmm#5249, which makes OpenVMM's chipset device builder in vmotherboard place a PCI chipset device on its bus only once the device's add can no longer fail. ArcMutexChipsetDeviceBuilder::inner_add registered the device's place with the builder's bus resolver before ArcMutexChipsetServices::finalize, which can still fail, as with NameInUse when another state unit has the device's name. The place is its bus, device, and function on a PCI bus, its PCIe downstream port, or its devfn as an RCiEP of a root complex. Now register_static_pci, register_static_pcie, and register_static_pcie_rciep only record the places that the add asks for, and finalize registers them with the resolver after the spawn of the device's state unit, its last step that can fail, under the builder's lock, where it already makes the device the chipset's EOI handler, PIC, and line target. A failed add leaves no place behind and touches no other device's; a successful add registers the same places as before, which the resolver attaches to the buses as the chipset is built. The resolver's three registration methods move from ChipsetBuilder, whose methods take the builder's lock, to BusResolver, which finalize reaches under the lock that it holds.

No version is created or bumped: no ABI, machine-contract, time-ABI, snapshot, manifest, saved-state, or protocol version changes, in NVX or in OpenVMM, and no saved-state, snapshot, or on-disk format changes.

Commits:

Start with finalize and the register_static_pci* methods in microsoft/openvmm#5249's vmm_core/vmotherboard/src/chipset/backing/arc_mutex/services.rs, then the BusResolver methods in vmm_core/vmotherboard/src/chipset/builder/mod.rs, then the two tests at the end of services.rs.

Left out: an add's static MMIO and port I/O regions, which register_static_mmio and register_static_pio map as the add asks for them, before finalize. A failed add's regions unmap when they drop, but a conflict that one of their mappings met stays in the ranges' list of static registration conflicts, so the chipset's build still reports it, for a device that no longer exists. That is a separate latent defect, which this pull request leaves as it is. NVX's microVMs reject PCI and PCIe (doc/design/2.1-machine-model-and-configuration.md, section 2.1.1), so no NVX documentation describes this path, and none changes.

Why is this change needed?

Nothing took a failed add's registration back. The resolver kept the dropped device's Weak in its place, and ChipsetBuilder::build attached it to the bus, where configuration accesses found no device. A device added in the same place afterwards failed the chipset's build with a PciConflict, or a PcieConflict for a downstream port or an RCiEP, that named the dropped device. No caller goes on after a failed add: each, such as the base chipset and the microVM's device loader, returns its error. So this is a latent lifecycle hazard of the builder, which #1904 found by reading the code, rather than a failure that NVX can reach.

The registration before finalize is upstream OpenVMM's: upstream main, 5d6ab1cfa, registers the place the same way. The chain's vmotherboard: wire a chipset device only once its unit spawns (microsoft/openvmm#5170, roadmap position 316) already moved the rest of the device's wiring after the spawn for the same reason, and this change extends that ordering of finalize.

Rejected: taking the registration back when finalize fails, which needs an undo for each of the resolver's three lists, kept in step with every step of finalize that can fail; registering the places only once the add can no longer fail needs no undo, as for the rest of the device's wiring.

How was this change validated?

Checks and results:

  • OpenVMM, cargo nextest run --profile agent -p vmotherboard, with the fix reverted (the production code of 899dcd63f, whose vmotherboard equals that of b73db6676, [DO NOT REVIEW] fuse: adopt a FUSE_INIT negotiation only once its reply is sent openvmm#5248's head, which changes only fuse) and with it:

    Host Revision Result
    Windows 11, local without the fix 17 pass, 2 fail as the chipset is built: failed_add_leaves_the_pci_slot_free with PciConflict { bdf: (0, 5, 0), conflict_dev: "replacement", reason: ExistingDev("device") }; failed_add_leaves_the_pcie_port_and_rciep_free with PcieConflict { conflict_dev: "rciep replacement", reason: ExistingDev("rciep") } and PcieConflict { conflict_dev: "endpoint replacement", reason: ExistingDev("endpoint") }
    Windows 11, local e8324ea31 all 19 pass
    OpenVMM CI, unit tests [x64-linux] e8324ea31 passed: 7018 pass, among them the four failed_add_leaves_* tests of vmotherboard
    OpenVMM CI, unit tests [x64-windows] e8324ea31 passed
  • At the pin, on Windows, cargo check, cargo clippy --all-targets, and cargo doc --no-deps for vmotherboard are clean, apart from the LNK4199 linker message that every linked artifact gets on this machine, and cargo xtask fmt --fix changes nothing.

  • python scripts/local_gates.py --base origin/agents/issue-1898-init-reply-failure selects test-changes, markdown-links, test-layout, openvmm-vectors, openvmm-cpu-profiles, nvx-cli, and openvmm-ci. On Windows: python scripts/check_test_changes.py --base origin/agents/issue-1898-init-reply-failure lists no change; python scripts/check_markdown_links.py and python scripts/check_test_layout.py pass; cargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignored passes, 4 tests, and --test openvmm_cpu_profiles -- --ignored passes, 1 test.

  • python scripts/openvmm_pin.py check-branch --target origin/agents/issue-1898-init-reply-failure, standalone and with --topic, against be79b3fb52b, openvmm: pin the discard of FUSE_INIT negotiations whose reply fails #2060's head, and python scripts/openvmm_pin.py check-roadmap, of HEAD and with --worktree, pass. python scripts/openvmm_pin.py source e8324ea31864e90e3486ec89d11f28d15e2c7b67 --pr 5249 reports a good signature and the pull request's head. python scripts/nvx.py verify passes.

  • python scripts/nvx.py check-openvmm-ci --revision e8324ea31864e90e3486ec89d11f28d15e2c7b67 passes: OpenVMM's run 45261953268 passed all six jobs that NVX requires. Its run vmm-tests [x64-linux-amd-kvm] job failed once. The failing test was multiarch::pcie::openvmm_uefi_x64_windows_datacenter_core_2025_x64_virtio_net_kdnet_windows, which timed out at the guest's power-off after virtio_net logged descriptor 0 is already outstanding. That is the intermittent upstream failure that virtio: defer reused outstanding descriptors instead of stopping the queue openvmm#5161 describes: the guest's KDNET transport reuses an outstanding transmit descriptor during shutdown, and the VM never halts. Before that, the test had found the virtio-net device at the PCI address that the chipset gave it, rebooted, and got its DHCP address through it. The job passed on its one rerun, with all 150 tests, the KDNET test among them in 47 s. The run's SNP job fails as well; NVX does not require it.

  • python scripts/openvmm_pin.py land e8324ea31864e90e3486ec89d11f28d15e2c7b67 --remote origin, a dry run, finds a fast-forward of feature/microvm/dev.

  • A review of this branch's whole diff, git diff --submodule=diff origin/agents/issue-1898-init-reply-failure HEAD, which includes the OpenVMM commit, found nothing. Copilot's review of 03b36867167 reports no issues.

  • NVX CI, run 45270261718, of 03b36867167, passed. Its first attempt passed every job but OpenVMM CI of the pinned revision, which failed at once on OpenVMM's failed KVM job, and the Required status check that depends on it. The jobs that passed include the microVM tests, the guests and sandboxes, the packages, and the platform tests on KVM, MSHV, and WHP, the NVX CLI on Linux and Windows, and the performance gate. Both failed jobs passed on their rerun, once OpenVMM's KVM job had passed.

  • Runtime: none locally. NVX's microVMs reject PCI and PCIe, so a microVM's chipset gets no PCI place through this path, and a successful add registers the same places as before. The Linux test hosts, nvx-kvm-test and nvx-mshv-test, accepted no SSH connection at 13:28 or at 13:57 PST, so NVX CI's matrix stands in for them.

Backend, host OS, host type, and guest: the unit tests ran on Windows 11, local, and in OpenVMM's CI on x64 Linux and Windows runners; OpenVMM's VMM tests ran on its KVM, MSHV, and Windows runners; NVX's microVM scenarios ran in NVX CI on KVM, MSHV, and WHP virtual machines, with the guests that CI builds.

Left to CI: the merge group's run.

Checklist

  • Tests cover the new or fixed behavior, in the layout that
    python3 scripts/check_test_layout.py checks.
  • python3 scripts/check_test_changes.py --base origin/dev lists no change
    to an existing test, or a Changes to existing tests section below
    explains each one.
  • The documentation that the change affects is updated, including
    .github/copilot-instructions.md and the skills when a convention or
    workflow changes.
  • A change to the public API of nvx updates nvx/public-api/ with
    python3 scripts/public_api.py --update.
  • Snapshots, protocols, and on-disk formats stay compatible, or the
    description says how the change versions or migrates them.

OpenVMM pin

OpenVMM's chipset device builder registered a PCI chipset device's
place, its bus, device, and function, its PCIe downstream port, or its
devfn as an RCiEP, with its bus resolver before it finalized the add,
which can still fail, as with NameInUse when another state unit has
the device's name (#1904). A failed add thus left the
dropped device in that place when the chipset was built, where it
answered no configuration access, and a device added there instead
failed the build with a PciConflict or PcieConflict that named the
dropped device.

Pin microsoft/openvmm e8324ea31864e90e3486ec89d11f28d15e2c7b67, one
commit on b73db6676, the head of microsoft/openvmm#5248, which NVX
pinned before this commit:

- vmotherboard: claim a device's PCI slot only once its unit spawns.
  The builder's services only record the places that an add asks for,
  and finalize registers them with the resolver after the spawn of the
  device's unit, its last step that can fail, under the builder's
  lock, so a failed add leaves no place behind and touches no other
  device's. Its tests pass with the fix; without it, the chipset build
  fails with a conflict that names the failed device, on Windows.

Every caller of the add, the microVM loader among them, returns its
error, and NVX's microVMs have no PCI bus or device, so they build and
run as before. No saved-state, protocol, or ABI format, and no version
of any of them, changes. The protocol vectors and CPU profiles that
nvx copies are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…the OpenVMM roadmap

Map position 357, the commit of microsoft/openvmm#5249, which NVX now
pins at e8324ea31, 231 commits past the mapped tip:

- 357, vmotherboard: claim a device's PCI slot only once its unit
  spawns. ArcMutexChipsetServices::finalize registers a chipset
  device's places, on its PCI bus, on its PCIe downstream port, or at
  its devfn as an RCiEP, with the builder's bus resolver only once the
  device's state unit has spawned, the last step of the add that can
  fail. The add registered them before finalize, so an add that failed
  there, as with NameInUse when another unit had the device's name,
  left the dropped device's weak reference in its places, where the
  built chipset attached it, and a device added in its place failed
  the build with a PciConflict or a PcieConflict that named the
  dropped device.

Position 357 is not yet assigned to a PR. In services.rs, it extends
the order of finalize, and the tests module, that position 316 adds,
and PR10's position 015 and position 315 also change the file; in
builder/mod.rs, it moves the resolver's three registration methods
from ChipsetBuilder to BusResolver, and position 015 also changes the
file. It changes none of the code that a mapped PR adds, so it is no
fixup, and it follows position 316. Upstream main, 5d6ab1cfa,
registers the places before finalize the same way; replaying the
commit there conflicts in services.rs, whose code of position 316 it
changes, so it cannot go upstream on its own.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Base automatically changed from agents/issue-1898-init-reply-failure to dev November 23, 2026 21:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the roadmap update documenting the OpenVMM PCI slot registration fix.

No open issues 🎉

What changed in this PR

This PR pins the OpenVMM fix for #1904, which delays PCI slot registration until device construction succeeds so failed adds leave slots available. The reviewed roadmap update records that pin and its place in NVX’s OpenVMM chain.

Changes:

  • Updates the documented pin to e8324ea31, position 357, and adjusts chain counts and ranges.
  • Documents the fix’s behavior, dependency on position 316, and upstream applicability.
File Description
doc/​openvmm-upstream-roadmap.md Updates the pin, chain diagram, commit mapping, and analysis for position 357.

Review effort: Balanced

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.

openvmm: failed PCI device construction leaves the bus slot registered

2 participants