From 42b1ae7e63507ddc3e025a72fc5d9c2392ca34cc Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Wed, 1 Oct 2025 09:49:08 +0100 Subject: [PATCH 1/5] chore: update rust-vmm-ci submodule Pick up the test changes to enable cargo-all-features Signed-off-by: Patrick Roy --- rust-vmm-ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-vmm-ci b/rust-vmm-ci index c0f5d4c3..58dab8b1 160000 --- a/rust-vmm-ci +++ b/rust-vmm-ci @@ -1 +1 @@ -Subproject commit c0f5d4c3f58094c90ea12200f513b21e457983bd +Subproject commit 58dab8b1433c15e507edef64970a428c719ceda0 From 2d30b40eb3f1c47949692fa1fa40e424288baff3 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Wed, 1 Oct 2025 09:50:13 +0100 Subject: [PATCH 2/5] ci: drop build and unittest steps from custom-tests.json Now that the normal CI does cargo all-features [test|build], there is no longer a need to have separate buildkite steps just for the xen-disabled usecase. Signed-off-by: Patrick Roy --- .buildkite/custom-tests.json | 44 ------------------------------------ 1 file changed, 44 deletions(-) diff --git a/.buildkite/custom-tests.json b/.buildkite/custom-tests.json index 6f581a4c..e28c9cd4 100644 --- a/.buildkite/custom-tests.json +++ b/.buildkite/custom-tests.json @@ -1,46 +1,10 @@ { "tests": [ - { - "test_name": "build-gnu-mmap", - "command": "cargo build --release --features=xen", - "platform": ["x86_64", "aarch64"] - }, - { - "test_name": "build-gnu-mmap-no-xen", - "command": "cargo build --release --features=backend-mmap", - "platform": ["x86_64", "aarch64"] - }, - { - "test_name": "build-musl-mmap", - "command": "cargo build --release --features=xen --target {target_platform}-unknown-linux-musl", - "platform": ["x86_64", "aarch64"] - }, - { - "test_name": "build-musl-mmap-no-xen", - "command": "cargo build --release --features=backend-mmap --target {target_platform}-unknown-linux-musl", - "platform": ["x86_64", "aarch64"] - }, { "test_name": "miri", "command": "RUST_BACKTRACE=1 MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-backtrace=full' cargo +nightly miri test --features backend-mmap,backend-bitmap", "platform": ["x86_64", "aarch64"] }, - { - "test_name": "unittests-gnu-no-xen", - "command": "cargo test --features 'backend-bitmap backend-mmap backend-atomic' --workspace", - "platform": [ - "x86_64", - "aarch64" - ] - }, - { - "test_name": "unittests-musl-no-xen", - "command": "cargo test --features 'backend-bitmap backend-mmap backend-atomic' --workspace --target {target_platform}-unknown-linux-musl", - "platform": [ - "x86_64", - "aarch64" - ] - }, { "test_name": "clippy-no-xen", "command": "cargo clippy --workspace --bins --examples --benches --features 'backend-bitmap backend-mmap backend-atomic' --all-targets -- -D warnings -D clippy::undocumented_unsafe_blocks", @@ -48,14 +12,6 @@ "x86_64", "aarch64" ] - }, - { - "test_name": "check-warnings-no-xen", - "command": "RUSTFLAGS=\"-D warnings\" cargo check --all-targets --features 'backend-bitmap backend-mmap backend-atomic' --workspace", - "platform": [ - "x86_64", - "aarch64" - ] } ] } From e29f79f8bda9ca9f6d45f780e42959184dd68869 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Wed, 1 Oct 2025 09:52:26 +0100 Subject: [PATCH 3/5] ci: configure cargo-all-features Skip explicitly adding optional dependencies to the permutation matrix (e.g. for example testing with --no-default-features, but the vmm-sys-util optional dependency enabled anyway), as this does not seem very useful (there is no way for a downstream to ever actually use this configuration). Signed-off-by: Patrick Roy --- .buildkite/custom-tests.json | 8 -------- Cargo.toml | 3 +++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.buildkite/custom-tests.json b/.buildkite/custom-tests.json index e28c9cd4..6f5415eb 100644 --- a/.buildkite/custom-tests.json +++ b/.buildkite/custom-tests.json @@ -4,14 +4,6 @@ "test_name": "miri", "command": "RUST_BACKTRACE=1 MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-backtrace=full' cargo +nightly miri test --features backend-mmap,backend-bitmap", "platform": ["x86_64", "aarch64"] - }, - { - "test_name": "clippy-no-xen", - "command": "cargo clippy --workspace --bins --examples --benches --features 'backend-bitmap backend-mmap backend-atomic' --all-targets -- -D warnings -D clippy::undocumented_unsafe_blocks", - "platform": [ - "x86_64", - "aarch64" - ] } ] } diff --git a/Cargo.toml b/Cargo.toml index ace634a6..f26ed37c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,3 +47,6 @@ codegen-units = 1 [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.cargo-all-features] +skip_optional_dependencies = true \ No newline at end of file From 2bd338a08dd796d4df25f989d2ba05c71d34e9a1 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Sat, 27 Sep 2025 19:50:53 +0100 Subject: [PATCH 4/5] fix: only try file-based benches if rawfd feature is enabled Without that feature, we do not have ReadVolatile/WriteVolatile impls for File, which the benches depend on. Signed-off-by: Patrick Roy --- benches/mmap/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/benches/mmap/mod.rs b/benches/mmap/mod.rs index f5f67335..4fdb8001 100644 --- a/benches/mmap/mod.rs +++ b/benches/mmap/mod.rs @@ -7,8 +7,11 @@ extern crate criterion; extern crate vm_memory; +#[cfg(feature = "rawfd")] use std::fs::{File, OpenOptions}; use std::mem::size_of; + +#[cfg(feature = "rawfd")] use std::path::Path; use core::hint::black_box; @@ -84,7 +87,10 @@ pub fn benchmark_for_mmap(c: &mut Criterion) { let mut image = make_image(ACCESS_SIZE); let buf = &mut [0u8; ACCESS_SIZE]; + + #[cfg(feature = "rawfd")] let mut file = File::open(Path::new("/dev/zero")).expect("Could not open /dev/zero"); + #[cfg(feature = "rawfd")] let mut file_to_write = OpenOptions::new() .write(true) .open("/dev/null") @@ -110,6 +116,7 @@ pub fn benchmark_for_mmap(c: &mut Criterion) { }) }); + #[cfg(feature = "rawfd")] c.bench_function(format!("read_from_file_{:#0X}", offset).as_str(), |b| { b.iter(|| { black_box(&memory) @@ -159,6 +166,7 @@ pub fn benchmark_for_mmap(c: &mut Criterion) { }) }); + #[cfg(feature = "rawfd")] c.bench_function(format!("write_to_file_{:#0X}", offset).as_str(), |b| { b.iter(|| { black_box(&memory) From 629cde93628a2254469c798713c632086a9a8b87 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Wed, 1 Oct 2025 10:01:49 +0100 Subject: [PATCH 5/5] fix(doc): Fix broken intra-doc link Signed-off-by: Patrick Roy --- src/mmap/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmap/mod.rs b/src/mmap/mod.rs index 1ba59f54..286ded60 100644 --- a/src/mmap/mod.rs +++ b/src/mmap/mod.rs @@ -171,7 +171,7 @@ impl GuestMemoryRegionBytes for GuestRegionMmap {} /// virtual address space of the calling process. pub type GuestMemoryMmap = GuestRegionCollection>; -/// Errors that can happen during [`GuestMemoryMap::from_ranges`] and related functions. +/// Errors that can happen during [`GuestMemoryMmap::from_ranges`] and related functions. #[derive(Debug, thiserror::Error)] pub enum FromRangesError { /// Error during construction of [`GuestMemoryMmap`]