Commit Graph

9906 Commits

Author SHA1 Message Date
Rob Bradford
92c2cf0103 vmm: config: Switch NetConfig to use PciDeviceCommonConfig
Switch NetConfig over to using the newly extracted struct members as
used by all PCI based devices. The use of #[serde(flatten)] means that
this change has no impact on the JSON format that the data is stored as.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
d2ce7667bc vmm: config: Switch DiskConfig to use PciDeviceCommonConfig
Switch DiskConfig over to using the newly extracted struct members as
used by all PCI based devices. The use of #[serde(flatten)] means that
this change has no impact on the JSON format that the data is stored as.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
a96da9d4bc vmm: Introduce PciDeviceCommonConfig::validate()
Implement some common PCI segment validation. This can be used to reduce
duplication across the different validation methods.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
c66c2b8470 vmm: config: Implement PciDeviceCommonConfig::parse
This parses a subset of the device configuration options used for
devices that are PCI based.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
4f7ff8fe48 vmm: Introduce a PciDeviceCommonConfig struct
Introduce a common struct that can encompass all the config fields
used by devices that are PCI based. The use of `skip_serializing_if`
means that the iommu field will only be included if set (otherwise
falling back to default false). This neatly handles the devices that
don't support an iommu.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
2148f2e0bc option_parser: Fix incorrect unit test
This unit test was trying to test with extra "="s in the input but was
instead testing using an unknown option. Add the option to the parser to
not hit that incorrect error.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
d93770c11d option_parser: Fill out unit testing
Add unit tests generated with Claude Opus 4.6 and reviewed by human
eyes.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
e5496a093d option_parser: Fix incorrect error message
The error message for the InvalidSyntax was copied from UnknownOption.
Correct it to "invalid syntax".

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
d212255073 option_parser: Add documentation strings
Autogenerated with Claude Opus 4.6 and reviewed with human eyes.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
791889cefd option_parser: Add support for adding from a slice
Add an OptionParser::add_all method that takes a slice of option names
and use that to add to the set of parameters that the parser works on.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Rob Bradford
a8ff2c50af option_parser: Introduce parse_subset() tolerating unknown options
Refactor parse() into a version that can control whether to tolerate
unknown options. This can then be used to then parse a subset of the
options.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 14:19:34 +00:00
Nguyen Dinh Phi
1268539b26 main: remove api socket path when start_vmm fails
Previously the UNIX socket file was only removed on the success path
(start_vmm returned Ok(Some(path))). If start_vmm failed after the
HTTP API had bound a path-based socket, the file could be left on disk.
Parse --api-socket in parse_api_socket(), call start_vmm with the
result, then unlink the path in main after start_vmm returns for both
success and failure (fd= mode unchanged: no path to remove).

Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
2026-04-14 14:18:16 +00:00
Shayon Mukherjee
0a32a9ca91 vmm: add compile-time validation for userfaultfd ioctl constants
Cross-check each UFFDIO_* constant against the Linux _IOC(dir, type,
nr, size) encoding formula at compile time so that transposed direction
bits or struct sizes are caught immediately rather than silently
producing wrong ioctl numbers at runtime.

Signed-off-by: Shayon Mukherjee <shayonj@gmail.com>
2026-04-14 14:17:40 +00:00
Rob Bradford
72fc0976f1 virtio-devices: net: Remove "driver_awake" workaround for restore
Now on the generic restore path the worker thread is notified on the
events and also the guest is notified via the interrupt. This avoids the
same "livelock" situation that required this "driver_awake" workaround
when restoring the net device.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 12:29:31 +00:00
Rob Bradford
101c259051 virtio-devices: trigger interrupt into guest on resume
This will wake up the guest and avoid a livelock situation by ensuring
that it will process any pending queues on its side.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-14 12:29:31 +00:00
Leander Kohler
3e3008f365 virtio-devices: signal activated queue eventfds on resume
A restored virtqueue can already contain pending descriptors when the VM
resumes. Before this change, the worker thread was unparked and then
waited for a fresh queue eventfd signal. That is normally fine, but not
when the queue was already non-empty at snapshot time. The virtqueue
state lives in guest memory and is restored, but the original host-side
queue eventfd signal is not persistent snapshot state. If the guest
already notified the queue before the snapshot, it may not notify it
again after resume.

That can leave the worker idle while the guest is still waiting for the
pending request to complete. In one observed case, this stalled a
virtio-blk flush during early boot after snapshot/restore.

We mitigate this in the shared `VirtioCommon` resume path.
`VirtioCommon` retains cloned queue eventfds for activated virtqueues
and signals each of them once on resume after unparking the worker
threads.

Keep virtio-net on its existing special-case path: it resumes worker
threads without signaling queue eventfds so the `driver_awake`
workaround remains intact until the guest performs a real notify.

On-behalf-of: SAP leander.kohler@sap.com
Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
2026-04-14 12:29:31 +00:00
Zhiheng Tao
df58e814eb vmm: fix UFFDIO_WAKE and UFFD_FEATURE_MISSING_HUGETLBFS
UFFDIO_WAKE was 0x4010_aa02 (_IOW) but should be 0x8010_aa02,
causing every wake call to silently fail with -EINVAL.

UFFD_FEATURE_MISSING_HUGETLBFS was (1<<6) but should be (1<<4),
colliding with UFFD_FEATURE_EVENT_UNMAP.

Signed-off-by: Zhiheng Tao <junchuan.tzh@antgroup.com>
2026-04-14 11:20:32 +00:00
Philipp Schuster
d54a7d27a1 tests: Reduce memory usage in integration tests
This reduces pressure on CI and enables to run more tests locally on
developer machines (with 16GB of RAM or less).

No functional changes.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
cd92f65f7b tests: Replace Windows integration sleeps with polling
Replace fixed sleeps in Windows integration tests with polling
helpers that wait for boot, snapshot readiness, and device
enumeration.

This keeps the same test intent while avoiding long fixed delays on
the fast path.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
44ac7c0ba0 tests: Poll snapshot restore readiness in Linux tests
Replace fixed sleeps in Linux snapshot and restore integration tests
with event monitor and API readiness checks.

This updates ivshmem and common_sequential snapshot paths to wait for
concrete restore and snapshot completion signals instead of sleeping
for an assumed amount of time.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
47024e73ce tests: Replace common integration sleeps with polling
Use polling helpers in common integration tests instead of fixed
sleeps where the tests already know the expected ready state.

This updates CPU and memory hotplug checks as well as a few
device- and restore-related waits in common_parallel to stop
oversleeping on the fast path while keeping the same assertions.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
2c395d4ae8 tests: Plumping to retry when event monitor output is not ready
Treat missing or still-short event monitor files as a retryable state
in integration test helpers.

This keeps polling-based restore and snapshot checks from failing early
with file-not-found or short-file assertions while the monitor output
is still being written.

In the following, we can gracefully wait for the corresponding
conditions to become true.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
b26488b1bf test_infra: bound SSH session runtime in wait_for_ssh
Allow one-shot SSH commands to install a libssh2 session timeout and
use that path from wait_for_ssh.

This keeps SSH readiness probes from blocking far beyond their caller
provided timeout when the guest network is slow or broken.

On-behalf-of: SAP philipp.schuster@sap.com

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
a3b4687caa test_infra: split SSH command helpers by retry behavior
Split the SSH helpers into a one-shot execution path and a retrying
wrapper with linear backoff.

This makes it possible to use a single bounded SSH attempt when tests
need a direct readiness probe while preserving the existing retrying
behavior for callers that expect it.

On-behalf-of: SAP philipp.schuster@sap.com

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
c77094bd54 test_infra: add polling helpers for integration tests
Add generic polling helpers for integration tests and build the
SSH wait helpers on top of them.

This lets follow-up test changes replace fixed sleeps with
condition-based waits without duplicating retry logic at each call
site.

On-behalf-of: SAP philipp.schuster@sap.com

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
dependabot[bot]
ff32912615 build(deps): bump crate-ci/typos from 1.45.0 to 1.45.1
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.45.0 to 1.45.1.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.45.0...v1.45.1)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.45.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-14 00:57:48 +00:00
CMGS
0a4be0c1c7 vmm: extend last MMIO64 allocator to cover full range
The MMIO64 allocator size is computed with alignment truncation:
  size = (range / alignment) * alignment
This loses up to one alignment unit (4 GiB) at the top of the
address space. When a guest (Windows with virtio-win 0.1.285)
programs a BAR near the top of the physical address space, the
allocation fails because the address falls in the truncated gap.

Give the last PCI segment allocator all remaining space up to
the end of the device area, so no addresses are lost.

The `end` parameter of create_mmio_allocators() is an inclusive
address (the last valid byte). Fix the 32-bit caller and tests
to pass inclusive values, consistent with the 64-bit caller
which already uses the inclusive end_of_device_area().

Signed-off-by: CMGS <ilskdw@gmail.com>
2026-04-13 10:25:18 +00:00
CMGS
e38c5c4340 pci: rollback BAR address on failed move_bar
When BAR reprogramming is detected, detect_bar_reprogramming()
eagerly updates the BAR address in config space before the actual
MMIO remapping occurs. If the subsequent move_bar() fails (e.g.
the new address falls outside the allocator range), the config
register retains the new address while the MMIO bus still uses
the old one, leaving the device broken.

Add restore_bar_addr() to undo the config space update when
move_bar() fails, so the device remains functional at its
original address.

For 64-bit BARs, restore both the low and high BAR slots as well
as the corresponding config registers, mirroring the two-slot
update logic in detect_bar_reprogramming().

Implement restore_bar_addr() for all PciDevice implementations
(VirtioPciDevice, VfioPciDevice, VfioUserPciDevice, IvshmemDevice,
PvPanicDevice, and PvmemcontrolPciDevice) by delegating to their
respective PciConfiguration::restore_bar_addr().

Signed-off-by: CMGS <ilskdw@gmail.com>
2026-04-13 10:25:18 +00:00
Anirudh Rayabharam
fd2d33e8ab performance-metrics: Add --continue-on-failure flag and status tracking
Add a --continue-on-failure CLI flag that allows the test harness to
continue executing remaining tests after encountering a failure, instead
of aborting immediately. When set, failed tests are recorded with zeroed
metrics and a "FAILED" status, the report file is always generated, and
the process exits with a non-zero code if any test failed.

Without the flag, the existing fail-fast behavior is preserved.

Also add a "status" field ("PASSED"/"FAILED") to PerformanceTestResult
so report consumers can distinguish successful tests from failed ones.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
2026-04-13 09:53:26 +00:00
Philipp Schuster
2515b06f19 vmm: incoming migration: log duration of state receive and VM resume
Instrument the two main downtime-phase operations on the destination
side - receiving state and resuming the VM - so their costs are visible
in logs and can be iterated on.

The new log messages may look like this:

```text
cloud-hypervisor:   7.283424s: <vmm> DEBUG:vmm/src/lib.rs:948 -- Migration (incoming): recv_snapshot:3ms restore:10ms
cloud-hypervisor:   7.284824s: <vmm> DEBUG:vmm/src/lib.rs:967 -- Migration (incoming): resume:1ms
cloud-hypervisor:   7.284842s: <vmm> DEBUG:vmm/src/lib.rs:977 -- Migration (incoming): Receiving final state and resuming the VM took 15ms
```

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Philipp Schuster
f15999823d vmm: outgoing migration: log effective downtime
Use OngoingMigrationContext to measure and log the effective VM downtime
(pause to remote resume) and the cost of each non-trivial step in the
downtime window: snapshotting, sending the snapshot, and awaiting
completion. This makes it straightforward to identify and reduce
downtime as live migration matures.

Example:

```
cloud-hypervisor:   7.703402s: <vmm> INFO:vmm/src/lib.rs:1494 -- Migration completed after 2.2s with a downtime of 298ms (goal was 300ms)
cloud-hypervisor:   7.703453s: <vmm> DEBUG:vmm/src/lib.rs:1500 -- Downtime breakdown: 298ms (final_iter:269ms state:7ms send_state:19ms complete:1ms)
```

Note: downtime is measured on the source only; cross-host clock skew
may cause unreliable results.

# Terminology

At first glance, the use of "state" and "[VM] snapshot" may seem
confusing. As discussed in [0], we use "state" consistently in the
migration code. On the VM side, "snapshotting" is merely the mechanism
used to obtain the VM state.

[0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7979#discussion_r3061359899

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Philipp Schuster
f32506447f vmm: add helper to measure successful operation duration
Add a small helper that returns both the successful result of an
operation and the time it took to complete.

Subsequent migration instrumentation uses this to keep timing code
compact and consistent.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Philipp Schuster
6a3024c13d vm-migration: add MemoryMigrationContext::empty_finalized() helper
This is helpful in the following to properly aggregate statistics for
local migrations.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Philipp Schuster
94f78e5a96 vm-migration: add migration-level context for downtime tracking
Add migration-level context types that extend the existing memory-only
metrics with overall migration duration and downtime breakdown.

OngoingMigrationContext models the sender-side migration progress until
all inputs needed for final downtime accounting are available.
CompletedMigrationContext then stores the finalized migration metrics,
including the final memory iteration, snapshotting, snapshot transfer,
and completion phase.

This provides the data needed to log effective downtime in the VMM and
lays the groundwork for future migration statistics reporting.

# Terminology

At first glance, the use of "state" and "[VM] snapshot" may seem
confusing. As discussed in [0], we use "state" consistently in the
migration code. On the VM side, "snapshotting" is merely the mechanism
used to obtain the VM state.

[0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7979#discussion_r3061359899

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Philipp Schuster
f21184c325 vm-migration: expose memory timing needed by migration metrics
Expose the finalized per-iteration timing fields needed by higher-level
migration metrics and factor the iteration-overhead calculation into a
small helper.

This keeps the existing MemoryMigrationContext behavior intact while
making the timing data easier to consume from migration-level context
in the following commits.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Philipp Schuster
b9c3cfb14d vm-migration: context: move unit tests into sub module
This helps to better separate the unit tests from the new ones in the
following commit.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-13 09:52:23 +00:00
Max Makarov
c99ed77d1a tests: pci: verify per-segment ACPI _UID in DSDT
Extend test_pci_multiple_segments_numa_node to assert that every
PNP0A08 host bridge in the guest DSDT exposes a unique _UID
matching its PCI segment id. Linux surfaces the evaluated _UID
value through /sys/bus/acpi/devices/PNP0A08:*/uid, so the check
is a single additional ssh command on top of the existing test
plumbing.

This test is used (rather than test_pci_multiple_segments) so
that the assertion runs on both x86_64 and aarch64: the numa_node
variant boots through edk2 firmware on aarch64, making ACPI (and
PNP0A08 host bridges) available, whereas the non-firmware variant
uses FDT on aarch64 and exposes no PNP0A08 nodes.

Without a per-segment _UID, two PNP0A08 nodes share _UID=0 which
violates ACPI 6.5 section 6.1.12 and triggers BSOD 0xA5 on
Windows guests. This assertion would catch any future regression
of that kind.

Signed-off-by: Max Makarov <maxpain@linux.com>
2026-04-13 09:39:55 +00:00
Max Makarov
87ba83bb01 vmm: pci_segment: use segment id as ACPI _UID
The ACPI specification requires _UID to be unique across devices
sharing the same _HID (ACPI 6.5 section 6.1.12). Currently every
PciSegment emits _UID=0 for its PNP0A08 host bridge, which violates
the spec when num_pci_segments > 1.

Windows guests detect this during ACPI namespace enumeration and
abort boot with BSOD 0xA5 ACPI_BIOS_ERROR, pointing at the _UID
object of the second PNP0A08 node. Linux guests are lenient and
silently accept the collision, so the issue has gone unnoticed.

Use self.id as _UID, matching what _SEG does on the line above.
For single-segment VMs (id == 0) this is a no-op at runtime.

Signed-off-by: Max Makarov <maxpain@linux.com>
2026-04-13 09:39:55 +00:00
Bo Chen
a3899a9783 tests: Add retries for windows integration tests
Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-13 07:40:02 +00:00
Bo Chen
e48b14dcac scripts: Add retries for vfio integration tests
Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-13 07:40:02 +00:00
Bo Chen
e8b6fe0548 tests: vfio: Capture guest dmesg when nvidia-smi failed
The guest dmesg can provide more context from the guest kernel, say
Nvidia driver errors, IOMMU faults, etc.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-13 07:40:02 +00:00
Bo Chen
6adc4f2c90 tests: vfio: Add more checks on the Nvidia GPU from the guest
Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-13 07:40:02 +00:00
Demi Marie Obenour
8b212aafc0 ci: Escape $ in heredoc in MSHV workflow script
This is a preexisting bug in the MSHV integration tests,
but previously it only caused a warning.  With commit
Fixes: 5b67b8994a ("ci: Use set -eufo pipefail") it becomes an error.

Fixes: 5b67b8994a ("ci: Use set -eufo pipefail")
Fixes: #7996
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2026-04-13 06:44:09 +00:00
Saravanan D
23a980cd54 pci: expand sub-page VFIO BAR mmap to page size
On aarch64 with 64K host pages, VFIO passthrough of devices with
sub-page BARs (e.g. 16K NVMe BAR0) crashes with EINVAL from
KVM_SET_USER_MEMORY_REGION, which requires memory_size to be a
multiple of the host page size.

Expand the mmap to page size instead of rejecting it, matching
QEMU's approach. The kernel's vfio_pci_probe_mmaps() already
verifies that sub-page BARs are page-aligned and reserves the
remainder of the page, so expansion is safe at offset 0. Reject
sub-page sparse areas at non-zero offsets where this guarantee
does not apply.

The expanded mmap region will not overlap with the relocated MSI-X
trap region because fixup_msix_region() ensures MSI-X relocation
at >= page_size offset.

Signed-off-by: Saravanan D <saravanand@crusoe.ai>
2026-04-12 11:12:48 +00:00
Saravanan D
2ddbc5abbb scripts: use arch OVMF downloads and bump fw tag
Rename download_ovmf to download_amd64_ovmf and add a separate
download_aarch64_ovmf for CLOUDHV_EFI.fd

Replace build_edk2 with download_aarch64_ovmf in aarch64 scripts

Update OVMF firmware tag to ch-1e1b96f126

Update CLOUDHV.fd sha1sum in sha1sums-x86_64

Add CLOUDHV_EFI.fd sha1sum in sha1sums-aarch64-common

Fixes: #7622

Signed-off-by: Saravanan D <saravanand@crusoe.ai>
2026-04-12 10:10:09 +00:00
Changyuan Lyu
490e338e16 pci: synchronize VfioMsix::cap and VfioMsix::bar
Currently, when snapshoting a running VFIO device with MSI-X enabled,
we get a snapshot where `msix_config.state.enabled` is not consistent
with `msix_state.cap.msg_ctl`,

```jsonc
{
  "snapshots": {
    "vfio_common": {
      "snapshots": {
        "msix_config": {
          "snapshots": {},
          "state": {
            "enabled": true
            // ...
          }
        },
        // ..
      },
      "state": {
        "msix_state": {
          "cap": {
            "msg_ctl": 3,
            "table": 1,
            "pba": 2049
          },
          // ...
        }
        // ...
      }
    }
  },
  // ...
}
```

The root cause is, after a `MsixCap` is parsed from the device PCI
config space and propagated to a corresponding `MsixConfig`,
`MsixCap::msg_ctl` is never get updated at runtime, only
`MsixConfig::msg_ctl` is updated.

This commit makes `VfioMsix::update` update both `VfioMsix::bar` (of
type `MsixConfig`) and `VfioMsix::cap` (of type `MsixCap`).

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2026-04-11 09:21:50 +00:00
JP Kobryn
bdc7a6947d vmm: add per-zone mergeable option to --memory-zone
Add a `mergeable` field to `MemoryZoneConfig` so that KSM page merging
can be enabled selectively per memory zone rather than globally for all
guest RAM.

Previously, `MADV_MERGEABLE` was only controllable via the top-level
`--memory mergeable=on` flag, which applied uniformly to all regions.
With this change, users can leave boot memory unmerged while enabling
KSM only on hotplug zones:

  --memory size=0,hotplug_method=virtio-mem
  --memory-zone id=boot,size=512M,shared=on,mergeable=off
  --memory-zone id=hotplug,size=256M,hotplug_size=1G,shared=off,mergeable=on

The `MemoryZone` runtime struct now carries the `mergeable` flag so
that both `allocate_address_space` and `add_ram_region` can apply
per-zone `MADV_MERGEABLE` instead of the global `self.mergeable`.
The top-level `--memory mergeable=on` path continues to work unchanged:
the default zone is synthesised from `MemoryConfig` and inherits its
`mergeable` value.

AI/LLM disclosure: this patch was co-authored with
GitHub Copilot and Claude Code (Opus 4.6).

Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
2026-04-11 09:01:57 +00:00
Anirudh Rayabharam
3a23e2f841 ci: fix jq usage in mshv-infra.yaml
Workflow runs fail in the "Get Location" step with:

jq: error (at <stdin>:9): string ("100") and number (0) cannot be added

Use tonumber to explicitly convert string to number instead of the "+ 0"
trick.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
2026-04-11 10:03:20 +01:00
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