Skip to content

Commit 86b25b6

Browse files
authored
Remove mshv2 feature (#973)
* Remove mshv2 feature from Hyperlight - This removes CI builds and tests for mshv2 feature - Removes mshv2 special handling of VMs Signed-off-by: Doru Blânzeanu <[email protected]> * Remove mshv internal feature and use only mshv3 Signed-off-by: Doru Blânzeanu <[email protected]> * Rename to mshv_ioctls and mshv_bindings Signed-off-by: Doru Blânzeanu <[email protected]> --------- Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent fe74003 commit 86b25b6

File tree

21 files changed

+103
-224
lines changed

21 files changed

+103
-224
lines changed

.github/workflows/Benchmarks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: true
2020
matrix:
21-
hypervisor: [hyperv, 'hyperv-ws2025', mshv, mshv3, kvm] # hyperv,hyperv-ws2025 are windows, mshv, mshv3 and kvm are linux
21+
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm] # hyperv,hyperv-ws2025 are windows, mshv3 and kvm are linux
2222
cpu: [amd, intel]
2323
config: [release]
2424
runs-on: ${{ fromJson(
@@ -66,7 +66,7 @@ jobs:
6666
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6767

6868
- name: Run Benchmarks
69-
run: just bench-ci main ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
69+
run: just bench-ci main
7070

7171
- uses: actions/upload-artifact@v5
7272
with:

.github/workflows/CreateRelease.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ jobs:
146146
# kvm
147147
tar -zcvf benchmarks_Linux_kvm_amd.tar.gz benchmarks_Linux_kvm_amd
148148
tar -zcvf benchmarks_Linux_kvm_intel.tar.gz benchmarks_Linux_kvm_intel
149-
# mshv2
150-
tar -zcvf benchmarks_Linux_mshv_intel.tar.gz benchmarks_Linux_mshv_intel
151-
tar -zcvf benchmarks_Linux_mshv_amd.tar.gz benchmarks_Linux_mshv_amd
152149
# mshv3
153150
tar -zcvf benchmarks_Linux_mshv3_amd.tar.gz benchmarks_Linux_mshv3_amd
154151
tar -zcvf benchmarks_Linux_mshv3_intel.tar.gz benchmarks_Linux_mshv3_intel
@@ -173,8 +170,6 @@ jobs:
173170
benchmarks_Windows_hyperv_intel.tar.gz \
174171
benchmarks_Linux_kvm_amd.tar.gz \
175172
benchmarks_Linux_kvm_intel.tar.gz \
176-
benchmarks_Linux_mshv_intel.tar.gz \
177-
benchmarks_Linux_mshv_amd.tar.gz \
178173
benchmarks_Linux_mshv3_amd.tar.gz \
179174
benchmarks_Linux_mshv3_intel.tar.gz \
180175
hyperlight-guest-c-api-linux.tar.gz \
@@ -191,8 +186,6 @@ jobs:
191186
benchmarks_Windows_hyperv_intel.tar.gz \
192187
benchmarks_Linux_kvm_amd.tar.gz \
193188
benchmarks_Linux_kvm_intel.tar.gz \
194-
benchmarks_Linux_mshv_intel.tar.gz \
195-
benchmarks_Linux_mshv_amd.tar.gz \
196189
benchmarks_Linux_mshv3_amd.tar.gz \
197190
benchmarks_Linux_mshv3_intel.tar.gz \
198191
hyperlight-guest-c-api-linux.tar.gz \

.github/workflows/ValidatePullRequest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
fail-fast: true
4949
matrix:
50-
hypervisor: [hyperv, 'hyperv-ws2025', mshv, mshv3, kvm]
50+
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
5151
cpu: [amd, intel]
5252
config: [debug, release]
5353
uses: ./.github/workflows/dep_rust.yml

.github/workflows/dep_rust.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
# use these commands in favor of build-and-move-c-guests to avoid building both configs
133133
just build-c-guests ${{ inputs.config }}
134134
just move-c-guests ${{ inputs.config }}
135-
135+
136136
- name: Build
137137
run: just build ${{ inputs.config }}
138138
env:
@@ -144,10 +144,10 @@ jobs:
144144
TARGET_TRIPLE: ${{ inputs.target_triple }}
145145
run: |
146146
# with default features
147-
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
147+
just test ${{ inputs.config }}
148148
149149
# with only one driver enabled (driver mshv/kvm feature is ignored on windows)
150-
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
150+
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
151151
152152
# make sure certain cargo features compile
153153
just check
@@ -171,29 +171,29 @@ jobs:
171171
CARGO_TERM_COLOR: always
172172
RUST_LOG: debug
173173
TARGET_TRIPLE: ${{ inputs.target_triple }}
174-
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
174+
run: just run-rust-examples-linux ${{ inputs.config }}
175175

176176
- name: Run Rust Gdb tests
177177
env:
178178
CARGO_TERM_COLOR: always
179179
RUST_LOG: debug
180180
TARGET_TRIPLE: ${{ inputs.target_triple }}
181-
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
181+
run: just test-rust-gdb-debugging ${{ inputs.config }}
182182

183183
- name: Run Rust Crashdump tests
184184
env:
185185
CARGO_TERM_COLOR: always
186186
RUST_LOG: debug
187187
TARGET_TRIPLE: ${{ inputs.target_triple }}
188-
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
188+
run: just test-rust-crashdump ${{ inputs.config }}
189189

190190
- name: Run Rust Tracing tests - linux
191191
if: runner.os == 'Linux'
192192
env:
193193
CARGO_TERM_COLOR: always
194194
RUST_LOG: debug
195195
TARGET_TRIPLE: ${{ inputs.target_triple }}
196-
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
196+
run: just test-rust-tracing ${{ inputs.config }}
197197

198198
- name: Download benchmarks from "latest"
199199
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu}} dev-latest # compare to prerelease
@@ -204,5 +204,5 @@ jobs:
204204

205205
- name: Run benchmarks
206206
run: |
207-
just bench-ci main ${{ inputs.hypervisor == 'mshv' && 'mshv2' || ''}}
207+
just bench-ci main
208208
if: ${{ inputs.config == 'release' && inputs.target_triple == '' }}

Cargo.lock

Lines changed: 3 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Justfile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ clean-rust:
7878
# convenience recipe to run all tests with the given target and features (similar to CI)
7979
test-like-ci config=default-target hypervisor="kvm":
8080
@# with default features
81-
just test {{config}} {{ if hypervisor == "mshv" {"mshv2"} else {""} }}
81+
just test {{config}}
8282

8383
@# with only one driver enabled + build-metadata + init-paging
84-
just test {{config}} build-metadata,init-paging,{{ if hypervisor == "mshv" {"mshv2"} else if hypervisor == "mshv3" {"mshv3"} else {"kvm"} }}
84+
just test {{config}} build-metadata,init-paging,{{ if hypervisor == "mshv3" {"mshv3"} else {"kvm"} }}
8585

8686
@# make sure certain cargo features compile
8787
just check
@@ -93,7 +93,7 @@ test-like-ci config=default-target hypervisor="kvm":
9393
just test-rust-crashdump {{config}}
9494

9595
@# test the tracing related features
96-
{{ if os() == "linux" { "just test-rust-tracing " + config + " " + if hypervisor == "mshv" { "mshv2" } else if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
96+
{{ if os() == "linux" { "just test-rust-tracing " + config + " " + if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
9797

9898
like-ci config=default-target hypervisor="kvm":
9999
@# Ensure up-to-date Cargo.lock
@@ -130,19 +130,19 @@ like-ci config=default-target hypervisor="kvm":
130130
{{ if os() == "windows" { "just run-rust-examples " + config } else { "" } }}
131131

132132
@# Run Rust examples - linux
133-
{{ if os() == "linux" { "just run-rust-examples-linux " + config + " " + if hypervisor == "mshv" { "mshv2" } else if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
133+
{{ if os() == "linux" { "just run-rust-examples-linux " + config + " " + if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
134134

135135
@# Run Rust Gdb tests
136-
just test-rust-gdb-debugging {{ config }} {{ if hypervisor == "mshv" { "mshv2" } else if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }}
136+
just test-rust-gdb-debugging {{ config }} {{ if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }}
137137

138138
@# Run Rust Crashdump tests
139-
just test-rust-crashdump {{config}} {{ if hypervisor == "mshv" { "mshv2" } else if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }}
139+
just test-rust-crashdump {{config}} {{ if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }}
140140

141141
@# Run Rust Tracing tests - linux
142-
{{ if os() == "linux" { "just test-rust-tracing " + config + " " + if hypervisor == "mshv" { "mshv2" } else if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
142+
{{ if os() == "linux" { "just test-rust-tracing " + config + " " + if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
143143

144144
@# Run benchmarks
145-
{{ if config == "release" { "just bench-ci main " + if hypervisor == "mshv" { "mshv2" } else if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
145+
{{ if config == "release" { "just bench-ci main " + if hypervisor == "mshv3" { "mshv3" } else { "kvm" } } else { "" } }}
146146

147147
# runs all tests
148148
test target=default-target features="": (test-unit target features) (test-isolated target features) (test-integration "rust" target features) (test-integration "c" target features) (test-doc target features)
@@ -174,13 +174,12 @@ test-integration guest target=default-target features="":
174174

175175
# tests compilation with no default features on different platforms
176176
test-compilation-no-default-features target=default-target:
177-
@# Linux should fail without a hypervisor feature (kvm, mshv, or mshv3)
177+
@# Linux should fail without a hypervisor feature (kvm or mshv3)
178178
{{ if os() == "linux" { "! " + cargo-cmd + " check -p hyperlight-host --no-default-features "+target-triple-flag+" 2> /dev/null" } else { "" } }}
179179
@# Windows should succeed even without default features
180180
{{ if os() == "windows" { cargo-cmd + " check -p hyperlight-host --no-default-features" } else { "" } }}
181181
@# Linux should succeed with a hypervisor driver but without init-paging
182182
{{ if os() == "linux" { cargo-cmd + " check -p hyperlight-host --no-default-features --features kvm" } else { "" } }} {{ target-triple-flag }}
183-
{{ if os() == "linux" { cargo-cmd + " check -p hyperlight-host --no-default-features --features mshv2" } else { "" } }} {{ target-triple-flag }}
184183
{{ if os() == "linux" { cargo-cmd + " check -p hyperlight-host --no-default-features --features mshv3" } else { "" } }} {{ target-triple-flag }}
185184

186185
# runs tests that exercise gdb debugging
@@ -310,7 +309,7 @@ tar-static-lib: (build-rust-capi "release") (build-rust-capi "debug")
310309
# Downloads the benchmarks result from the given release tag.
311310
# If tag is not given, defaults to latest release
312311
# Options for os: "Windows", or "Linux"
313-
# Options for Linux hypervisor: "kvm", "mshv", "mshv3"
312+
# Options for Linux hypervisor: "kvm", "mshv3"
314313
# Options for Windows hypervisor: "hyperv"
315314
# Options for cpu: "amd", "intel"
316315
bench-download os hypervisor cpu tag="":

src/hyperlight_host/Cargo.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ lazy_static = "1.4.0"
7777
[target.'cfg(unix)'.dependencies]
7878
kvm-bindings = { version = "0.14", features = ["fam-wrappers"], optional = true }
7979
kvm-ioctls = { version = "0.24", optional = true }
80-
mshv-bindings2 = { package="mshv-bindings", version = "=0.2.1", optional = true }
81-
mshv-ioctls2 = { package="mshv-ioctls", version = "=0.2.1", optional = true}
82-
mshv-bindings3 = { package="mshv-bindings", version = "0.6.1", optional = true }
83-
mshv-ioctls3 = { package="mshv-ioctls", version = "0.6.1", optional = true}
80+
mshv-bindings = { version = "0.6.1", optional = true }
81+
mshv-ioctls = { version = "0.6.1", optional = true}
8482

8583
[dev-dependencies]
8684
uuid = { version = "1.18.1", features = ["v4"] }
@@ -135,9 +133,7 @@ crashdump = ["dep:chrono"]
135133
trace_guest = ["dep:opentelemetry", "dep:tracing-opentelemetry", "dep:hyperlight-guest-tracing", "hyperlight-common/trace_guest"]
136134
mem_profile = [ "trace_guest", "dep:framehop", "dep:fallible-iterator", "hyperlight-common/mem_profile" ]
137135
kvm = ["dep:kvm-bindings", "dep:kvm-ioctls"]
138-
# This feature is deprecated in favor of mshv3
139-
mshv2 = ["dep:mshv-bindings2", "dep:mshv-ioctls2"]
140-
mshv3 = ["dep:mshv-bindings3", "dep:mshv-ioctls3"]
136+
mshv3 = ["dep:mshv-bindings", "dep:mshv-ioctls"]
141137
# This enables easy debug in the guest
142138
gdb = ["dep:gdbstub", "dep:gdbstub_arch"]
143139
fuzzing = ["hyperlight-common/fuzzing"]

src/hyperlight_host/build.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,15 @@ fn main() -> Result<()> {
8686
}
8787

8888
// Makes #[cfg(kvm)] == #[cfg(all(feature = "kvm", target_os = "linux"))]
89-
// and #[cfg(mshv)] == #[cfg(all(any(feature = "mshv2", feature = "mshv3"), target_os = "linux"))].
90-
// Essentially the kvm and mshv features are ignored on windows as long as you use #[cfg(kvm)] and not #[cfg(feature = "kvm")].
91-
// You should never use #[cfg(feature = "kvm")] or #[cfg(feature = "mshv")] in the codebase.
89+
// Essentially the kvm and mshv3 features are ignored on windows as long as you use #[cfg(kvm)] and not #[cfg(feature = "kvm")].
90+
// You should never use #[cfg(feature = "kvm")] or #[cfg(feature = "mshv3")] in the codebase.
9291
cfg_aliases::cfg_aliases! {
9392
gdb: { all(feature = "gdb", debug_assertions) },
9493
kvm: { all(feature = "kvm", target_os = "linux") },
95-
mshv: { all(any(feature = "mshv2", feature = "mshv3"), target_os = "linux") },
94+
mshv3: { all(feature = "mshv3", target_os = "linux") },
9695
crashdump: { all(feature = "crashdump") },
9796
// print_debug feature is aliased with debug_assertions to make it only available in debug-builds.
9897
print_debug: { all(feature = "print_debug", debug_assertions) },
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
101-
// the other features they want.
102-
mshv2: { all(feature = "mshv2", target_os = "linux") },
103-
mshv3: { all(feature = "mshv3", not(feature="mshv2"), target_os = "linux") },
10498
}
10599

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

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ mod tests {
136136

137137
write_cmds_file(&cmd_file_path, cmd).expect("Failed to write gdb commands to file");
138138

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

144141
// build it before running to avoid a race condition below

src/hyperlight_host/src/error.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
#[cfg(mshv2)]
18-
extern crate mshv_ioctls2 as mshv_ioctls;
19-
2017
#[cfg(mshv3)]
21-
extern crate mshv_ioctls3 as mshv_ioctls;
18+
extern crate mshv_ioctls;
2219

2320
use std::array::TryFromSliceError;
2421
use std::cell::{BorrowError, BorrowMutError};
@@ -172,7 +169,7 @@ pub enum HyperlightError {
172169

173170
/// mshv Error Occurred
174171
#[error("mshv Error {0:?}")]
175-
#[cfg(mshv)]
172+
#[cfg(mshv3)]
176173
MSHVError(#[from] mshv_ioctls::MshvError),
177174

178175
/// No Hypervisor was found for Sandbox.
@@ -382,7 +379,7 @@ impl HyperlightError {
382379
HyperlightError::VmmSysError(_) => false,
383380
#[cfg(kvm)]
384381
HyperlightError::KVMError(_) => false,
385-
#[cfg(mshv)]
382+
#[cfg(mshv3)]
386383
HyperlightError::MSHVError(_) => false,
387384
#[cfg(gdb)]
388385
HyperlightError::TranslateGuestAddress(_) => false,

0 commit comments

Comments
 (0)