Skip to content

Let the native-host backend boot on a host CPU profile - #422

Closed
Enrique Saurez (esaurez) wants to merge 1 commit into
esaurez/nvxhost-edge-denied-aliasesfrom
esaurez/nvxhost-edge-host-cpu-profile
Closed

Enrique Saurez (esaurez) wants to merge 1 commit into
esaurez/nvxhost-edge-denied-aliasesfrom
esaurez/nvxhost-edge-host-cpu-profile

Conversation

@esaurez

Copy link
Copy Markdown
Contributor

Stacked on #421. Lets the opt-in native-host backend boot on a host CPU profile.

Summary

  • OpenVMM boots every microVM on a CPU profile, by default the built-in profile of the host's CPU generation (see CPU profiles). A host that no built-in profile serves, or whose hypervisor does not support its profile, therefore cannot start native sandboxes, while nvx.py run --cpu-profile host opts such development hosts in to a profile that OpenVMM derives from the host.
  • NvxHostConfig::with_host_cpu_profile(true) does the same for the native backend. It sets the native library's additive host-CPU-profile launch flag (16), which adds --cpu-profile host to the RAM-overlay launch. A library that predates the flag rejects it rather than ignoring it.
  • The example takes --cpu-profile auto|host, and NVXHOST_TEST_CPU_PROFILE=host runs the guest tests on a host profile. The README says when to use it, and that OpenVMM derives a host profile from the hypervisor at every cold boot and does not pin it.

Dependencies

  • Requires the matching private host library with the host-CPU-profile launch flag.

Validation

  • Each PR head in this stack passes cargo test --all-features and Clippy with -D warnings on all targets with --all-features, on Windows with Rust 1.93 (135, 137, 139, 139, and 140 unit tests).

  • At the top of the stack (5b0a315), on Windows and on Linux with Rust 1.93: the crate's CI checks, which are fmt, Clippy with --all-features and with --no-default-features, tests with --all-features and with default features, docs with -D warnings, cargo +1.89 check, and, on Linux, the macOS build check. The pinned library test passes against freshly built nvxhost.dll and libnvxhost.so.

  • Guest suite at the top of the stack, 20 tests, --release --test-threads=1, each checking that no OpenVMM process outlives its sandbox, with dev's Linux 6.18.38 kernel:

    • Windows/WHP on an AMD EPYC 7763, which amd.milan.v1 serves: all pass, in about 100 s, and again with a host profile;
    • Linux/MSHV on an AMD EPYC 9V74, which no built-in profile serves: all pass with a host profile, in about 82 s.
  • OpenVMM's --cpu-fingerprint reports E_PROFILE_HOST_UNKNOWN on the AMD EPYC 9V74 MSHV host, so every cold boot with the default profile fails there; with NVXHOST_TEST_CPU_PROFILE=host, all 20 guest tests pass. On the WHP host, all 20 pass both ways.

  • New unit tests cover the launch flags and the example's --cpu-profile parser, and the pinned library test checks that the flag adds --cpu-profile host.

Notes

  • cpu_profile: pin AMD Genoa and Turin CPU profiles nanvix/openvmm#119 proposes a built-in Genoa profile, but OpenVMM rejects it on that host's MSHV (E_PROFILE_UNSUPPORTED): the profile derives from a KVM fingerprint, and that hypervisor presents a different surface, such as its CPUID leaf range, the 0x80000021 bits, and the AVX-512 and CET XSAVE components. A host profile remains the way to run there.

OpenVMM boots every microVM on a CPU profile, by default the built-in
profile of the host's CPU generation. A host that no built-in profile
serves, or whose hypervisor does not support its profile, therefore cannot
start native sandboxes, while `nvx.py run --cpu-profile host` opts such
development hosts in to a profile that OpenVMM derives from the host.

NvxHostConfig::with_host_cpu_profile does the same for the native backend.
It sets the native library's additive host-CPU-profile launch flag, which
adds --cpu-profile host to the RAM-overlay launch; a library that predates
the flag rejects it rather than ignoring it. The example takes
--cpu-profile auto|host, and NVXHOST_TEST_CPU_PROFILE=host runs the guest
tests on a host profile.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@esaurez

Copy link
Copy Markdown
Contributor Author

Folded into #418, which now carries the whole change. The native library implements this feature behind the model types that #418 adds, and its guest tests are part of the end-to-end suite there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant