Skip to content

Making mshv3 the default mshv hypervisor in hyperlight_host (instead of mshv2) #703

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

Merged
merged 1 commit into from
Jul 18, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/Benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run Benchmarks
run: just bench-ci main release ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
run: just bench-ci main release ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}

- uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/dep_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
CARGO_TERM_COLOR: always
run: |
# with default features
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}

# with only one driver enabled (driver mshv/kvm feature is ignored on windows) + seccomp
just test ${{ matrix.config }} seccomp,${{ matrix.hypervisor == 'mshv' && 'mshv2' || matrix.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
Expand All @@ -154,20 +154,20 @@ jobs:
env:
CARGO_TERM_COLOR: always
RUST_LOG: debug
run: just run-rust-examples-linux ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
run: just run-rust-examples-linux ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}

- name: Run Rust Gdb tests - linux
if: runner.os == 'Linux'
env:
CARGO_TERM_COLOR: always
RUST_LOG: debug
run: just test-rust-gdb-debugging ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
run: just test-rust-gdb-debugging ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}

- name: Run Rust Crashdump tests
env:
CARGO_TERM_COLOR: always
RUST_LOG: debug
run: just test-rust-crashdump ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
run: just test-rust-crashdump ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}

- name: Download benchmarks from "latest"
run: just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu}} dev-latest # compare to prerelease
Expand All @@ -178,5 +178,5 @@ jobs:

- name: Run benchmarks
run: |
just bench-ci main ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
just bench-ci main ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
if: ${{ matrix.config == 'release' }}
6 changes: 3 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ clean-rust:
# convenience recipe to run all tests with the given target and features (similar to CI)
test-like-ci config=default-target hypervisor="kvm":
@# with default features
just test {{config}} {{ if hypervisor == "mshv3" {"mshv3"} else {""} }}
just test {{config}} {{ if hypervisor == "mshv" {"mshv2"} else {""} }}

@# with only one driver enabled + seccomp + build-metadata + init-paging
just test {{config}} seccomp,build-metadata,init-paging,{{ if hypervisor == "mshv" {"mshv2"} else if hypervisor == "mshv3" {"mshv3"} else {"kvm"} }}
Expand Down Expand Up @@ -119,7 +119,7 @@ test-integration guest target=default-target features="":
test-seccomp target=default-target features="":
@# run seccomp test with feature "seccomp" on and off
cargo test --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host test_violate_seccomp_filters --lib {{ if features =="" {''} else { "--features " + features } }} -- --ignored
cargo test --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host test_violate_seccomp_filters --no-default-features {{ if features =~"mshv3" {"--features init-paging,mshv3"} else {"--features mshv2,init-paging,kvm" } }} --lib -- --ignored
cargo test --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host test_violate_seccomp_filters --no-default-features {{ if features =~"mshv2" {"--features init-paging,mshv2"} else {"--features mshv3,init-paging,kvm" } }} --lib -- --ignored

# tests compilation with no default features on different platforms
test-compilation-no-default-features target=default-target:
Expand Down Expand Up @@ -239,7 +239,7 @@ tar-static-lib: (build-rust-capi "release") (build-rust-capi "debug")
# Downloads the benchmarks result from the given release tag.
# If tag is not given, defaults to latest release
# Options for os: "Windows", or "Linux"
# Options for Linux hypervisor: "kvm", "mshv"
# Options for Linux hypervisor: "kvm", "mshv", "mshv3"
# Options for Windows hypervisor: "hyperv"
# Options for cpu: "amd", "intel"
bench-download os hypervisor cpu tag="":
Expand Down
3 changes: 2 additions & 1 deletion src/hyperlight_host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ cfg_aliases = "0.2.1"
built = { version = "0.8.0", optional = true, features = ["chrono", "git2"] }

[features]
default = ["kvm", "mshv2", "seccomp", "build-metadata", "init-paging"]
default = ["kvm", "mshv3", "seccomp", "build-metadata", "init-paging"]
seccomp = ["dep:seccompiler"]
function_call_metrics = []
executable_heap = []
Expand All @@ -127,6 +127,7 @@ print_debug = []
# Dumps the VM state to a file on unexpected errors or crashes. The path of the file will be printed on stdout and logged.
crashdump = ["dep:chrono"]
kvm = ["dep:kvm-bindings", "dep:kvm-ioctls"]
# This feature is deprecated in favor of mshv3
mshv2 = ["dep:mshv-bindings2", "dep:mshv-ioctls2"]
mshv3 = ["dep:mshv-bindings3", "dep:mshv-ioctls3"]
# This enables easy debug in the guest
Expand Down
8 changes: 4 additions & 4 deletions src/hyperlight_host/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ fn main() -> Result<()> {
crashdump: { all(feature = "crashdump") },
// print_debug feature is aliased with debug_assertions to make it only available in debug-builds.
print_debug: { all(feature = "print_debug", debug_assertions) },
// the following features are mutually exclusive but rather than enforcing that here we are enabling mshv3 to override mshv2 when both are enabled
// because mshv2 is in the default feature set we want to allow users to enable mshv3 without having to set --no-default-features and the re-enable
// the following features are mutually exclusive but rather than enforcing that here we are enabling mshv2 to override mshv3 when both are enabled
// because mshv3 is in the default feature set we want to allow users to enable mshv2 without having to set --no-default-features and the re-enable
// the other features they want.
mshv2: { all(feature = "mshv2", not(feature="mshv3"), target_os = "linux") },
mshv3: { all(feature = "mshv3", target_os = "linux") },
mshv2: { all(feature = "mshv2", target_os = "linux") },
mshv3: { all(feature = "mshv3", not(feature="mshv2"), target_os = "linux") },
}

#[cfg(feature = "build-metadata")]
Expand Down
6 changes: 3 additions & 3 deletions src/hyperlight_host/examples/guest-debugging/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ mod tests {
write_cmds_file(&cmd_file_path, &out_file_path)
.expect("Failed to write gdb commands to file");

#[cfg(mshv3)]
let features = "gdb,mshv3";
#[cfg(not(mshv3))]
#[cfg(mshv2)] // mshv3 is a default feature is mutually exclusive with the mshv2 feature
let features = "gdb,mshv2";
#[cfg(not(mshv2))]
let features = "gdb";

let mut guest_child = Command::new("cargo")
Expand Down
Loading