Repository navigation
Conversation
632ead4 to
b6b7862
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The WHP in-place reset and reordered scratch remapping need Windows runtime validation to confirm guest-visible zeroing and backing lifetimes through mapping failures.
No open issues 🎉
What changed in this PR
Adds configurable scratch-memory reset strategies to Hyperlight’s host sandbox API. This provides manual performance tuning for the Windows regression discussed in #1766 while preserving existing backend defaults.
Changes:
- Exposes
PlatformDefault,ZeroInPlace, andDiscardthrough sandbox configuration and the builder. - Coordinates scratch clearing and VM mappings during restore, with backend validation and KVM fallback behavior.
- Documents platform support and adds tests for restore strategies, resizing, recreation, and failures.
| File | Description |
|---|---|
src/hyperlight_host/src/sandbox/uninitialized.rs |
Clarifies configurable settings in a snapshot-construction comment. |
src/hyperlight_host/src/sandbox/uninitialized_evolve.rs |
Validates strategy support during initialization. |
src/hyperlight_host/src/sandbox/snapshot/mod.rs |
Adapts snapshot tests to staged restoration. |
src/hyperlight_host/src/sandbox/mod.rs |
Re-exports MemoryResetStrategy. |
src/hyperlight_host/src/sandbox/initialized.rs |
Applies reset strategies and tests restore behavior and failures. |
src/hyperlight_host/src/sandbox/config.rs |
Defines strategies and configuration accessors. |
src/hyperlight_host/src/sandbox/builder.rs |
Exposes strategy selection and documents platform tradeoffs. |
src/hyperlight_host/src/mem/shared_mem.rs |
Separates zeroing and discard operations, with tests. |
src/hyperlight_host/src/mem/mgr.rs |
Splits restoration around scratch reset and mapping updates. |
src/hyperlight_host/src/lib.rs |
Exposes the strategy type at the crate root. |
src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs |
Resolves backend defaults and rejects unsupported strategies. |
src/hyperlight_host/src/error.rs |
Adds an unsupported-strategy error. |
CHANGELOG.md |
Records the public configuration feature. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
b6b7862 to
6f38ece
Compare
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
6f38ece to
2c579b0
Compare
Benchmark ResultsMeasured commit: kvm / amd (Linux) (❌ 1.67x)Top regressions
Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
kvm / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / amd (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / intel (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
Reported by |
Add
SandboxBuilder::memory_reset_strategyto choose in-place zeroing or discard.This provides a manual workaround for the Windows performance regression discussed in #1766. In-place zeroing can be faster for small sandboxes. Discard can speed up larger restores, but may slow subsequent guest calls through page faults.
Document platform support and keep existing defaults.
Note that mshv supports movable pages in later kernel versions so might consider madvise dont_need in the future (but need to double check kernel version that supporst this first. I know latest 6.6 and 6.18 both work)