diff --git a/.github/workflows/Benchmarks.yml b/.github/workflows/Benchmarks.yml index 64df29bb2..5fd12f922 100644 --- a/.github/workflows/Benchmarks.yml +++ b/.github/workflows/Benchmarks.yml @@ -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: diff --git a/.github/workflows/dep_rust.yml b/.github/workflows/dep_rust.yml index fe7d0f203..f08958515 100644 --- a/.github/workflows/dep_rust.yml +++ b/.github/workflows/dep_rust.yml @@ -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' }} @@ -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 @@ -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' }} diff --git a/Justfile b/Justfile index ffd7f7c39..276c7985d 100644 --- a/Justfile +++ b/Justfile @@ -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"} }} @@ -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: @@ -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="": diff --git a/src/hyperlight_host/Cargo.toml b/src/hyperlight_host/Cargo.toml index bc744c05c..ac56a57b0 100644 --- a/src/hyperlight_host/Cargo.toml +++ b/src/hyperlight_host/Cargo.toml @@ -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 = [] @@ -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 diff --git a/src/hyperlight_host/build.rs b/src/hyperlight_host/build.rs index ca2fd8bf2..6c90a485f 100644 --- a/src/hyperlight_host/build.rs +++ b/src/hyperlight_host/build.rs @@ -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")] diff --git a/src/hyperlight_host/examples/guest-debugging/main.rs b/src/hyperlight_host/examples/guest-debugging/main.rs index 6b1f46677..cc39b1705 100644 --- a/src/hyperlight_host/examples/guest-debugging/main.rs +++ b/src/hyperlight_host/examples/guest-debugging/main.rs @@ -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")