Commit Graph

9858 Commits

Author SHA1 Message Date
Demi Marie Obenour
b8a61da06a ci: Use jq instead of bash arithmetic
jq's arithmetic is much more robust.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-11 00:47:04 +00:00
Demi Marie Obenour
dcdf16b8ff ci: Use bash regex instead of sed
Easier to read and more reliable.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-11 00:47:04 +00:00
Demi Marie Obenour
295a76ea28 ci: Use a variable of type number for the OS disk size
It's better to let GitHub Actions validate this.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-11 00:47:04 +00:00
Demi Marie Obenour
5b67b8994a ci: Use set -eufo pipefail
Most scripts can use it and it is good at catching errors.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-11 00:47:04 +00:00
Demi Marie Obenour
23e139c0f8 ci: Double-quote variables in GitHub Actions
This is best practice for shell scripts.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-11 00:47:04 +00:00
Bo Chen
9d47769bc2 tests: Add iommufd integration tests
Add an `iommufd` flag to existing VFIO integration tests. When false,
tests use the legacy vfio container/group backend (existing behavior).
When true, tests use vfio cdev with iommufd and vfio_p2p_dma=off.

vfio_p2p_dma=off is required because the VFIO test runner uses a stock
Ubuntu 24.04 kernel (v6.8) which does not support mapping device MMIO
pages (VM_PFNMAP) through iommufd, causing IOMMU_IOAS_MAP to fail with
-EFAULT on MMIO BAR regions.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Bo Chen
87992c77c1 vmm: Introduce option --platform vfio_p2p_dma=on|off
Add a user-configurable option to control whether VFIO device MMIO BAR
regions are DMA-mapped into the host IOMMU address space.

This mapping is required for peer-to-peer DMA between devices (e.g.
NVLink, RDMA NIC accessing GPU VRAM). However, iommufd on upstream
kernels does not support mapping device MMIO pages (VM_PFNMAP), causing
IOMMU_IOAS_MAP to fail with -EFAULT. Kernels with the NVIDIA PFNMAP
workaround or future kernels with DMABUF-based mapping
(IOMMU_IOAS_MAP_FILE) handle this correctly.

The option defaults to `on` to preserve existing behavior. Users on
vanilla kernels using iommufd should set `vfio_p2p_dma=off` to skip
MMIO BAR DMA mapping.

A validation check ensures that `x_nv_gpudirect_clique` (which depends
on P2P DMA) cannot be used when `vfio_p2p_dma=off`.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Bo Chen
32c459c3dc virtio-devices, vmm: Add seccomp rules for iommufd and vfio cdev
Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Bo Chen
fe5f991c37 vmm: Support device passthrough with vfio cdev and iommufd
When `--platform iommufd=on` is set, use the vfio cdev interface backed
by iommufd instead of the legacy vfio container/group interface for
device passthrough.

The cdev path opens '/dev/iommu' via IommuFd, allocates an IOAS, and
binds VFIO devices through VfioIommufd. The legacy container/group path
remains the default and is used when iommufd is not enabled.

Add iommufd-ioctls as a workspace dependency and enable the "vfio_cdev"
feature on vfio-ioctls for KVM builds.

Fixes: #6892

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Bo Chen
13972a0edf vmm: Introduce option --platform iommufd=on|off
This option allows user to configure VFIO device pass-through with
iommufd (e.g. vfio cdev mode) or not (e.g. vfio legacy mode).

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Bo Chen
7f377eadd9 vmm: Fix --platform syntax with optional feature flags
The `--platform` help string was hardcoded and did not reflect which
optional features (tdx, sev_snp) were actually enabled in. Build the
syntax string dynamically as `PlatformConfig::syntax()`, conditionally
appending feature-gated options so the CLI help stays accurate.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
dependabot[bot]
de601c5eaa build(deps): bump the non-rust-vmm group across 2 directories with 10 updates
Bumps the non-rust-vmm group with 9 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [libc](https://github.com/rust-lang/libc) | `0.2.183` | `0.2.184` |
| [signal-hook](https://github.com/vorner/signal-hook) | `0.4.3` | `0.4.4` |
| [arc-swap](https://github.com/vorner/arc-swap) | `1.9.0` | `1.9.1` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.58` | `1.2.59` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.13.0` | `2.13.1` |
| [libz-sys](https://github.com/rust-lang/libz-sys) | `1.1.25` | `1.1.28` |
| [semver](https://github.com/dtolnay/semver) | `1.0.27` | `1.0.28` |
| [toml_datetime](https://github.com/toml-rs/toml) | `1.1.0+spec-1.1.0` | `1.1.1+spec-1.1.0` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.25.8+spec-1.1.0` | `0.25.10+spec-1.1.0` |

Bumps the non-rust-vmm group with 8 updates in the /fuzz directory:

| Package | From | To |
| --- | --- | --- |
| [libc](https://github.com/rust-lang/libc) | `0.2.183` | `0.2.184` |
| [signal-hook](https://github.com/vorner/signal-hook) | `0.4.3` | `0.4.4` |
| [arc-swap](https://github.com/vorner/arc-swap) | `1.9.0` | `1.9.1` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.58` | `1.2.59` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.13.0` | `2.13.1` |
| [semver](https://github.com/dtolnay/semver) | `1.0.27` | `1.0.28` |
| [toml_datetime](https://github.com/toml-rs/toml) | `1.1.0+spec-1.1.0` | `1.1.1+spec-1.1.0` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.25.8+spec-1.1.0` | `0.25.10+spec-1.1.0` |



Updates `libc` from 0.2.183 to 0.2.184
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.184/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.183...0.2.184)

Updates `signal-hook` from 0.4.3 to 0.4.4
- [Changelog](https://github.com/vorner/signal-hook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/signal-hook/compare/v0.4.3...v0.4.4)

Updates `arc-swap` from 1.9.0 to 1.9.1
- [Changelog](https://github.com/vorner/arc-swap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/arc-swap/compare/v1.9.0...v1.9.1)

Updates `cc` from 1.2.58 to 1.2.59
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.58...cc-v1.2.59)

Updates `indexmap` from 2.13.0 to 2.13.1
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.13.0...2.13.1)

Updates `libz-sys` from 1.1.25 to 1.1.28
- [Release notes](https://github.com/rust-lang/libz-sys/releases)
- [Commits](https://github.com/rust-lang/libz-sys/compare/1.1.25...1.1.28)

Updates `semver` from 1.0.27 to 1.0.28
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.27...1.0.28)

Updates `toml_datetime` from 1.1.0+spec-1.1.0 to 1.1.1+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v1.1.0...toml_datetime-v1.1.1)

Updates `toml_edit` from 0.25.8+spec-1.1.0 to 0.25.10+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/v0.25.8...v0.25.10)

Updates `toml_parser` from 1.1.0+spec-1.1.0 to 1.1.2+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_parser-v1.1.0...toml_parser-v1.1.2)

Updates `libc` from 0.2.183 to 0.2.184
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.184/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.183...0.2.184)

Updates `signal-hook` from 0.4.3 to 0.4.4
- [Changelog](https://github.com/vorner/signal-hook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/signal-hook/compare/v0.4.3...v0.4.4)

Updates `arc-swap` from 1.9.0 to 1.9.1
- [Changelog](https://github.com/vorner/arc-swap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/arc-swap/compare/v1.9.0...v1.9.1)

Updates `cc` from 1.2.58 to 1.2.59
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.58...cc-v1.2.59)

Updates `indexmap` from 2.13.0 to 2.13.1
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.13.0...2.13.1)

Updates `semver` from 1.0.27 to 1.0.28
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.27...1.0.28)

Updates `toml_datetime` from 1.1.0+spec-1.1.0 to 1.1.1+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v1.1.0...toml_datetime-v1.1.1)

Updates `toml_edit` from 0.25.8+spec-1.1.0 to 0.25.10+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/v0.25.8...v0.25.10)

Updates `toml_parser` from 1.1.0+spec-1.1.0 to 1.1.2+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_parser-v1.1.0...toml_parser-v1.1.2)

---
updated-dependencies:
- dependency-name: libc
  dependency-version: 0.2.184
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: signal-hook
  dependency-version: 0.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: arc-swap
  dependency-version: 1.9.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.2.59
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: indexmap
  dependency-version: 2.13.1
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: libz-sys
  dependency-version: 1.1.28
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: semver
  dependency-version: 1.0.28
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_datetime
  dependency-version: 1.1.1+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_edit
  dependency-version: 0.25.10+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_parser
  dependency-version: 1.1.2+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: libc
  dependency-version: 0.2.184
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: signal-hook
  dependency-version: 0.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: arc-swap
  dependency-version: 1.9.1
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.2.59
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: indexmap
  dependency-version: 2.13.1
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: semver
  dependency-version: 1.0.28
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_datetime
  dependency-version: 1.1.1+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_edit
  dependency-version: 0.25.10+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml_parser
  dependency-version: 1.1.2+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-10 18:12:11 +00:00
JP Kobryn
474106a067 vmm: skip uefi allocation on direct boot
A 4M uefi_region is allocated unconditionally. When directly booting a
kernel, it goes unused. Avoid the allocation in this case by moving the
call to add_uefi_flash() to load_firmware().

Also extended add_uefi_flash() to riscv64 since it shares the
load_firmware() path. It looked like up to this point a firmware boot on
riscv64 would panic with an uninitialized uefi_flash.

Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
2026-04-09 23:18:00 +00:00
Thomas Prescher
84c5e48bdb scripts: use latest ovmf version for x86_64
This commit bumps ovmf to ch-13b4963ec4 [1].

[1] https://github.com/cloud-hypervisor/edk2/releases/tag/ch-13b4963ec4

On-behalf-of: SAP thomas.prescher@sap.com
Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
2026-04-09 17:23:02 +00:00
Anirudh Rayabharam
fa949678d1 scripts: build mshv feature too for dbus, fw_cfg & ivshmem tests
The aarch64 dbus, fw_cfg & ivshmem tests don't build the mshv feature
causing them to fail when run on MSHV. Fix by building the mshv feature
too just like the x86 version of the script does.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
2026-04-07 19:12:48 +00:00
Jared White
77ce3f6cbf vmm: memory_actual_size reflects hotplug state
It is desirable to be able to track the progress of memory hotplug.
Update the memory_actual_size field to query the current plugged size
from virtio-mem to enable this.

Signed-off-by: Jared White <git@jaredwhite.dev>
2026-04-07 01:37:37 +00:00
Max Makarov
aef0a43b52 vdpa: fix RX failure after device reset by always using base 0
After a vDPA device reset, activate_vdpa() read avail_idx from guest
memory to pass as the vring base via VHOST_SET_VRING_BASE. However,
the guest memory still contained the stale avail_idx from the previous
session. For a 256-entry ring, this meant base=256, causing the
hardware to believe the entire RX ring was consumed with no available
buffers — RX silently stopped while TX continued to work.

QEMU handles this correctly by tracking last_avail_idx internally
(reset to 0 in virtio_reset()) and passing that value, rather than
reading from guest memory.

Fix by always passing base=0 to set_vring_base(). After a device
reset, both the guest driver and the vhost backend restart their rings
from index 0. For live migration, the correct base should come from
VHOST_GET_VRING_BASE (saved before the migration), not guest memory.

Tested with mlx5_vdpa (ConnectX-6 Dx) + Windows Server 2025 (netkvm).
Before: RX=0 after 3rd driver activation. After: full connectivity.

Signed-off-by: Max Makarov <maxpain@linux.com>
2026-04-07 00:48:19 +00:00
Peter Oskolkov
f56c8392ea virtio-devices: vsock: RST vsocks on snapshot restore
Otherwise guest connections just hang.

Signed-off-by: Peter Oskolkov <posk@google.com>
2026-04-07 00:36:57 +00:00
Leander Kohler
f7f9895d57 hypervisor: kvm: preserve guest MTRR MSRs
KVM_GET_MSR_INDEX_LIST does not consistently include all
guest-programmable MTRR MSRs.

During save/restore while booting, the VMM initially sets only
MSR_MTRRdefType, then guest firmware or other early boot code can
program additional MTRR state before the snapshot is taken. If those
MSRs are missing from the vCPU MSR buffer, snapshot omits part of the
guest's MTRR configuration and restore resumes with an incomplete
MTRR map.

Add the guest-programmable MTRR MSRs to the KVM MSR index list used
to build the vCPU MSR buffer so the existing snapshot/restore path
preserves the guest's MTRR state.

On-behalf-of: SAP leander.kohler@sap.com
Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
2026-04-07 00:33:40 +00:00
Muminul Islam
676c0d320b build: use latest 0.6.8 mshv crates
Use mshv-{ioctls, bindings) with the latest versions
that fixes a bug on interrupt vector.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-03 22:24:12 +00:00
Damian Barabonkov
8248650e79 pci: Handle dword MSI-X control writes
Some guests update the MSI-X capability through a 32-bit write at
offset 0 instead of a 16-bit write at offset 2. Update the cached
Message Control state for that path as well so MSI-X enablement stays
in sync with the guest configuration.

Add a short comment documenting why the dword write path also updates
the cached MSI-X Message Control state.

This is important for passthrough GPUs, where MSI-X interrupts are used
during NVIDIA Fabric Manager registration. Without updating the cached
state on the dword write path, interrupt delivery can remain stale and
GPU initialization or fabric registration can fail.

Signed-off-by: Damian Barabonkov <dbctl@pm.me>
2026-04-02 23:57:31 +00:00
Sebastian Eydam
17919a7a8c tests: add integration test for migration with multiple TCP connections
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
ecddc6f842 vmm: add upper limit for amount of parallel connections during migration
Check that the amount of parallel connections does not exceed 128 and
update documentation.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
a9a832f392 vmm: validate VmSendMigrationData
Validates that there are no conflicting options set, and that the
destination URL is valid.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
fb19881918 vm-migration: add connections field to API
And wire everything up. From now on the multiple connections feature can
be used.

This commit series is heavily based on Julian Stecklina's work, so kudos
to him!

Co-authored-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
55e6971c47 vmm: funnel VM memory via additional connections abstraction
At this point, we are still only using a single connection.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
07484abd35 vmm: implement functionality to send via multiple connections
Implements the functionality to send VM memory via multiple connections
during a live migration.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
5a2dea8fa6 vmm: implement a gate
This gate behaves like a barrier, but it can be opened, meaning that
threads can be released before all threads arrived at the gate. This
lets us release waiting threads in case of an error, which will be
important for the sender side of a live migration with multiple
TCP connections.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
5e563e7ea3 vm-migration: allow partitioning memory tables
For sending memory over multiple connections, we need a way to split up
the work. With these changes, we can chop a memory table into same-sized
chunks for transmit

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
5c556880dd vmm: implement functionality to accept multiple connections
Adds the functionality to accept multiple connections on the receiver
side of a live migration. A thread listens for incoming connections and
creates a worker for each new connection.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
058954a8c1 vmm: make receive_memory_ranges take the requests directly
This just removes some unnecessary indirections.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
98ece1e347 vmm: add functionality for an abortable accept for sockets
With this, the receiver side of a migration can wait for incoming
connections, while also being able to abort the accept when the
migration is done.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
7311211b38 vmm: allow keeping the socket listener around
This allows accepting multiple connections in the migration receive
path.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
765311085f vmm: keep direct reference to guest memory around
That way we avoid having to grab a lock when receiving a chunk of memory
over the migration socket. This is a necessary prerequisite for having
multiple memory receiving threads.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
ec42ee8004 vmm: extract receive_memory_regions from memory manager
The memory manager is guarded by a mutex, thus parallel accesses to it
and its members are not possible. But we have to execute this function
in parallel when we introduce multiple TCP connections. Otherwise, the
workers who receive the data and write it into guest memory will block
on each other, and thus slow down the migration.

Also rename the function to receive_memory_ranges for better naming
consistency.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
e175ad64f2 vmm: move SocketStream into the migration_transport module
This is mainly to clean up the lib.rs a bit more.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
9248143e18 vmm: extract send_memory_regions from vm
And rename it for better naming consistency.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
e03c0f7708 vmm: move function to send dirty pages into transport module
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
693cdccbb0 vmm: extract a helper to send the VM state
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
196e48af30 vmm: extract a helper to send the VM config
This further decreases boilerplate code in lib.rs while keeping the
behavior.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
d4a8d55074 vmm: extract small request/response helpers to reduce boilerplate
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
bb3e1b4073 vmm: stop removing the UNIX socket file
When doing a local migration using a UNIX socket, we removed the UNIX
socket file after accepting the connection. The VMM does not own this
socket file, which makes this an unsafe operation. Thus, we stop doing
that.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
d2f6476149 vmm: move migration socket helpers into transport module
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Muminul Islam
1b479e40ea performance-metrics: Remove duplicate remote_command
Remove the local remote_command() function from
performance_tests.rs. The identical function is now
available from test_infra via the existing glob import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
c8bfac66f4 test_infra: Move remote_command to test_infra
Move remote_command() and remote_command_w_output() from
tests/common/utils.rs into test_infra/src/lib.rs to allow
reuse across crates.

The cloud-hypervisor integration tests already use
'use test_infra::*', so the functions are available
without any caller changes.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
1400e614cb performance-metrics: Remove duplicate x86_64 FOCAL_IMAGE_NAME
Remove the local x86_64 FOCAL_IMAGE_NAME constant from
performance_tests.rs. The identical public constant from
test_infra is already available via wildcard import.

The aarch64 definition is kept as it differs from test_infra:
performance-metrics uses a specific image with the
'-update-tool' suffix.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
4cf10737e4 performance-metrics: Remove duplicate DIRECT_KERNEL_BOOT_CMDLINE
Remove the local DIRECT_KERNEL_BOOT_CMDLINE constant from
performance_tests.rs. The identical public constant from
test_infra is already available via wildcard import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
488927a5ea performance-metrics: Remove duplicate direct_kernel_boot_path()
Remove the local direct_kernel_boot_path() function and unused
PathBuf import from performance_tests.rs. The identical public
function from test_infra is already available via wildcard
import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Anatol Belski
5ae329305a virtio-devices: block: Fix writeback mode update flow
Virtio v1.2 says that if CONFIG_WCE is negotiated
but FLUSH is not, the device must initialize writeback to 0.
It also says that if CONFIG_WCE was not negotiated but FLUSH
was, the driver should assume presence of a writeback cache.

Introduce a pure is_writeback_enabled helper and a
set_writeback_mode helper. This makes the two call flows
explicit:

* write_config resolves the guest requested mode against the
  negotiated features before storing it back
* activate starts from the default writeback preference and then
  resolves it against the negotiated features
* reset restores the initial writeback state

This keeps the config space value and the runtime writeback flag
in sync and makes the spec driven fallback easier to follow.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-02 13:04:17 +00:00
Chinmoy
d0b253472d pci, devices, virtio-devices, vmm: Refactor allocate_bars
Refactor PciDevice::allocate_bars trait and all implementations
to take &mut SystemAllocator instead of &Arc<Mutex<SystemAllocator>>,
removing double indirection.

The caller in device_manager.rs now acquires the lock before
calling allocate_bars.

Signed-off-by: Chinmoy <daschinmoyy21@gmail.com>
2026-04-02 11:52:04 +00:00