Skip to content

Commit 5a8bcef

Browse files
authored
Making mshv3 the default mshv hypervisor in hyperlight_host (instead of mshv2) (#703)
Signed-off-by: Mark Rossett <[email protected]>
1 parent e4a661a commit 5a8bcef

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

.github/workflows/Benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858

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

6262
- uses: actions/upload-artifact@v4
6363
with:

.github/workflows/dep_rust.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
CARGO_TERM_COLOR: always
129129
run: |
130130
# with default features
131-
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
131+
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
132132
133133
# with only one driver enabled (driver mshv/kvm feature is ignored on windows) + seccomp
134134
just test ${{ matrix.config }} seccomp,${{ matrix.hypervisor == 'mshv' && 'mshv2' || matrix.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
@@ -154,20 +154,20 @@ jobs:
154154
env:
155155
CARGO_TERM_COLOR: always
156156
RUST_LOG: debug
157-
run: just run-rust-examples-linux ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
157+
run: just run-rust-examples-linux ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
158158

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

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

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

179179
- name: Run benchmarks
180180
run: |
181-
just bench-ci main ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
181+
just bench-ci main ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
182182
if: ${{ matrix.config == 'release' }}

Justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ clean-rust:
7373
# convenience recipe to run all tests with the given target and features (similar to CI)
7474
test-like-ci config=default-target hypervisor="kvm":
7575
@# with default features
76-
just test {{config}} {{ if hypervisor == "mshv3" {"mshv3"} else {""} }}
76+
just test {{config}} {{ if hypervisor == "mshv" {"mshv2"} else {""} }}
7777

7878
@# with only one driver enabled + seccomp + build-metadata + init-paging
7979
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="":
119119
test-seccomp target=default-target features="":
120120
@# run seccomp test with feature "seccomp" on and off
121121
cargo test --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host test_violate_seccomp_filters --lib {{ if features =="" {''} else { "--features " + features } }} -- --ignored
122-
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
122+
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
123123

124124
# tests compilation with no default features on different platforms
125125
test-compilation-no-default-features target=default-target:
@@ -239,7 +239,7 @@ tar-static-lib: (build-rust-capi "release") (build-rust-capi "debug")
239239
# Downloads the benchmarks result from the given release tag.
240240
# If tag is not given, defaults to latest release
241241
# Options for os: "Windows", or "Linux"
242-
# Options for Linux hypervisor: "kvm", "mshv"
242+
# Options for Linux hypervisor: "kvm", "mshv", "mshv3"
243243
# Options for Windows hypervisor: "hyperv"
244244
# Options for cpu: "amd", "intel"
245245
bench-download os hypervisor cpu tag="":

src/hyperlight_host/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ cfg_aliases = "0.2.1"
118118
built = { version = "0.8.0", optional = true, features = ["chrono", "git2"] }
119119

120120
[features]
121-
default = ["kvm", "mshv2", "seccomp", "build-metadata", "init-paging"]
121+
default = ["kvm", "mshv3", "seccomp", "build-metadata", "init-paging"]
122122
seccomp = ["dep:seccompiler"]
123123
function_call_metrics = []
124124
executable_heap = []
@@ -127,6 +127,7 @@ print_debug = []
127127
# Dumps the VM state to a file on unexpected errors or crashes. The path of the file will be printed on stdout and logged.
128128
crashdump = ["dep:chrono"]
129129
kvm = ["dep:kvm-bindings", "dep:kvm-ioctls"]
130+
# This feature is deprecated in favor of mshv3
130131
mshv2 = ["dep:mshv-bindings2", "dep:mshv-ioctls2"]
131132
mshv3 = ["dep:mshv-bindings3", "dep:mshv-ioctls3"]
132133
# This enables easy debug in the guest

src/hyperlight_host/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ fn main() -> Result<()> {
9696
crashdump: { all(feature = "crashdump") },
9797
// print_debug feature is aliased with debug_assertions to make it only available in debug-builds.
9898
print_debug: { all(feature = "print_debug", debug_assertions) },
99-
// the following features are mutually exclusive but rather than enforcing that here we are enabling mshv3 to override mshv2 when both are enabled
100-
// 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
99+
// the following features are mutually exclusive but rather than enforcing that here we are enabling mshv2 to override mshv3 when both are enabled
100+
// 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
101101
// the other features they want.
102-
mshv2: { all(feature = "mshv2", not(feature="mshv3"), target_os = "linux") },
103-
mshv3: { all(feature = "mshv3", target_os = "linux") },
102+
mshv2: { all(feature = "mshv2", target_os = "linux") },
103+
mshv3: { all(feature = "mshv3", not(feature="mshv2"), target_os = "linux") },
104104
}
105105

106106
#[cfg(feature = "build-metadata")]

src/hyperlight_host/examples/guest-debugging/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ mod tests {
146146
write_cmds_file(&cmd_file_path, &out_file_path)
147147
.expect("Failed to write gdb commands to file");
148148

149-
#[cfg(mshv3)]
150-
let features = "gdb,mshv3";
151-
#[cfg(not(mshv3))]
149+
#[cfg(mshv2)] // mshv3 is a default feature is mutually exclusive with the mshv2 feature
150+
let features = "gdb,mshv2";
151+
#[cfg(not(mshv2))]
152152
let features = "gdb";
153153

154154
let mut guest_child = Command::new("cargo")

0 commit comments

Comments
 (0)