Skip to content

[DO NOT REVIEW] virtio: test PCI re-save before start and missing queue progress - #5016

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
feature/microvm/devfrom
copilot/nvx-issue-1232-pci-restore-tests
Nov 10, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
feature/microvm/devfrom
copilot/nvx-issue-1232-pci-restore-tests

Conversation

@ppenna

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

Copy link
Copy Markdown
Contributor

Tests the virtio restore contract on the PCI transport as on the MMIO transport, for microsoft/nvx#1232. A restore validates the queues and the device-private state that it restores before it applies them, and requires the progress of every enabled queue of a DRIVER_OK device; it then hands the private state to the stopped device, and a save before the first start returns the restored state. Only the MMIO transport tested either for an active device, although microsoft/nvx#1232 requires the restore contract on both transports.

One commit on a8a0e3517, the head of feature/microvm/dev. microsoft/nvx#1451 pins this head.

Test PCI re-save before start and missing queue progress (cd5cd3814)

  • Gap. mmio_restore_rejects_missing_active_queue_progress and mmio_resave_before_first_start_keeps_restored_state had no PCI counterparts. The PCI transport restores through the same core (restore_common and restore_device_state), but its own save, restore, and stop around that core, which restore its config space first, were untested on both points for an active device.
  • Change. pci_restore_rejects_missing_active_queue_progress: the saved state of an active PCI device whose enabled queue lacks its progress fails the restore with the core's missing progress state error, before the device sees any state, and no queue starts. pci_resave_before_first_start_keeps_restored_state: a restored active PCI device that is stopped and saved before its first start returns the restored queue progress and private state, and starts no queue. The module documentation of the virtio-net saved-state tests no longer says that an inactive transport defers the device-private state until the device is activated, which the transports stopped doing when they began to restore it into the stopped device: its inactive_transport_restore_applies_net_private_state checks that the restore gives the device its state before any queue starts.
  • Tests. Only tests and a test module's documentation change. The new tests pass, and fail as their MMIO counterparts do when validate_restored_state no longer requires the progress of an enabled queue of a DRIVER_OK device, or when capture_stop drops the restored progress of a queue that never started.

Validation

  • Windows: cargo check, cargo clippy --all-targets, cargo doc --no-deps (RUSTDOCFLAGS=-D warnings), and cargo nextest run --profile agent for -p virtio -p virtio_net, 226 passed and 1 skipped, without warnings; cargo xtask fmt --fix changed nothing.
  • Linux (Azure Linux 3, x86_64): cargo nextest run --profile agent -p virtio -p virtio_net, 226 passed and 1 skipped; at the base, neither PCI test exists.

A restore validates the queues and the device-private state that it
restores before it applies them, and an enabled queue of a DRIVER_OK
device must carry its progress. It then hands the private state to the
stopped device, and a save before the first start returns the restored
state: queues that never started keep their restored progress, and the
device its restored private state. The MMIO transport had tests of both
for an active device. The PCI transport, which restores through the
same core, had neither, although microsoft/nvx#1232 requires the
restore contract on both transports.

Add the PCI counterparts. A restore whose active queue lacks its
progress fails before the device sees any state. A restored active
device that is stopped and saved before its first start returns the
restored queue progress and private state, and starts no queue.

The module documentation of the virtio-net saved-state tests still said
that an inactive transport defers the device-private state until the
device is activated, as the transports did before they restored it into
the stopped device. Its test checks that the restore gives the device
its state before any queue starts, so say that.

Tests: the new tests pass, and fail as their MMIO counterparts do when
the restore no longer requires the progress of an active queue, or when
a stop before the first start drops the restored progress.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the release-nvx Targets a branch under feature/microvm/. label Nov 10, 2026
@ppenna
Pedro Henrique Penna (ppenna) merged commit cd5cd38 into feature/microvm/dev Nov 10, 2026
73 of 74 checks passed
@github-actions

Copy link
Copy Markdown

syeedali pushed a commit to syeedali/nvx that referenced this pull request Nov 11, 2026
microsoft#1232 requires the virtio restore contract on both
transports: a restore rejects an active queue that lacks its progress
before the device sees any state, and a save before the first start
returns the restored queue progress and private state. Only the MMIO
transport tested either for an active device.

Pin cd5cd3814, which microsoft/openvmm#5016 proposes for
feature/microvm/dev: one commit on a8a0e3517, the head of that branch.
It adds the PCI counterparts of those two tests, and corrects the
module documentation of the virtio-net saved-state tests, which still
said that an inactive transport defers the device-private state until
the device is activated. It changes no product code.

The control-session vectors, the source excerpts, the contract
versions, and the CPU profiles that nvx-rs copies from OpenVMM match
the revision's.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
syeedali pushed a commit to syeedali/nvx that referenced this pull request Nov 11, 2026
The NVX pin moves to cd5cd3814, position 246, 115 commits past the
mapped tip. Position 246, which microsoft/openvmm#5016 proposes for
feature/microvm/dev on its head, a8a0e3517, is unassigned. It adds the
PCI counterparts of two MMIO tests of the virtio restore: a restore
whose active queue lacks its progress fails before the device sees any
state, and a save before the first start returns the restored queue
progress and private state. It also corrects the module documentation
of the virtio-net saved-state tests, which still described the
deferred restore of device-private state. The Scope also says that
microsoft/openvmm#5013 merged positions 243-245.

Position 246 changes only the test modules of PR13's positions 039 and
048, the first of which positions 213 and 218 also extend. On upstream
main, both of its files conflict, since upstream main lacks both test
modules, so it follows PR13 upstream.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
syeedali pushed a commit to syeedali/nvx that referenced this pull request Nov 11, 2026
Maps NVX's new pin, 61cdd6397, the head of microsoft/openvmm#5022, at
position 247, after position 246, cd5cd3814, the head of
feature/microvm/dev, which microsoft/openvmm#5016 merged. The pin is
116 commits past the mapped tip.

Position 247 is a PR13 fixup. It changes the input gates that PR13's
positions 043 and 048 and PR18's position 088 give the console,
virtio-net, and virtio-fs with their saved state: each device's reset
cleared its gate, and now keeps it. It states that rule on the gate's
methods of VirtioDevice and ChangeDeviceState, which PR13's position
040 and PR09's position 018 add, extends the snapshot guide's
paragraph on the post-restore gate that PR20's position 095 adds, and
adds tests beside those of the devices, which extend the broker's test
harness of PR23's position 113 and the gated-queue tests of position
172. It folds into positions 043 and 048, its virtio-fs change into
PR18's position 088, and its other parts into the positions that add
what they change, as the fold sentences after the DAG and the commit
mapping say; the Scope, the DAG, the dependency graph, the PR summary,
and the commit mapping record it with PR13. Replaying it on upstream
main conflicts in 13 of its 15 files, all but a new module of console
tests and the development dependency that virtio-fs takes for its
transport tests.

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

release-nvx Targets a branch under feature/microvm/.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant