Skip to content

[RFC] Make mmap_unix and mmap_xen compatible #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .buildkite/custom-tests.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,9 @@
{
"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",
"platform": [
"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"
]
}
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
and `GuestRegionMmap::from_range` to be separate from the error type returned by `GuestRegionCollection` functions.
Change return type of `GuestRegionMmap::new` from `Result` to `Option`.
- \[#324](https:////github.com/rust-vmm/vm-memory/pull/324)\] `GuestMemoryRegion::bitmap()` now returns a `BitmapSlice`. Accessing the full bitmap is now possible only if the type of the memory region is know, for example with `MmapRegion::bitmap()`.
- \[[#317](https://github.com/rust-vmm/vm-memory/pull/317)\]: Make `xen` feature additive, meaning enabling it
no longer disables the `mmap_unix` module at compile time. For this, various Xen-related structs had to be
renamed due to naming conflicts.

### Removed

Expand Down
2 changes: 1 addition & 1 deletion coverage_config_x86_64.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coverage_score": 91.78,
"exclude_path": "mmap_windows.rs",
"crate_features": "backend-mmap,backend-atomic,backend-bitmap"
"crate_features": "backend-mmap,backend-atomic,backend-bitmap,xen"
}
4 changes: 2 additions & 2 deletions src/bitmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub(crate) mod tests {
// them to test the mmap-based backend implementations for now. Going forward, the generic
// test functions defined here can be placed in a separate module (i.e. `test_utilities`)
// which is gated by a feature and can be used for testing purposes by other crates as well.
#[cfg(feature = "backend-mmap")]
#[cfg(all(feature = "backend-mmap", target_family = "unix"))]
fn test_guest_memory_region<R: GuestMemoryRegion>(region: &R) {
let dirty_addr = MemoryRegionAddress(0x0);
let val = 123u64;
Expand Down Expand Up @@ -253,7 +253,7 @@ pub(crate) mod tests {
);
}

#[cfg(feature = "backend-mmap")]
#[cfg(all(feature = "backend-mmap", target_family = "unix"))]
// Assumptions about M generated by f ...
pub fn test_guest_memory_and_region<M, F>(f: F)
where
Expand Down
2 changes: 1 addition & 1 deletion src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub trait Bytes<A> {
/// * Read bytes from /dev/urandom (uses the `backend-mmap` feature)
///
/// ```
/// # #[cfg(all(feature = "backend-mmap", feature = "rawfd"))]
/// # #[cfg(all(feature = "backend-mmap", feature = "rawfd", target_family = "unix"))]
/// # {
/// # use vm_memory::{Address, GuestMemory, Bytes, GuestAddress, GuestMemoryMmap};
/// # use std::fs::File;
Expand Down
Loading