Skip to content

Implement MSHV aarch64 backend - #1626

Open
cshung wants to merge 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/mshv-aarch64
Open

cshung wants to merge 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/mshv-aarch64

Conversation

@cshung

@cshung cshung commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

ARM64 Linux MSHV

The backend provides partition creation, memory mappings, MMIO dispatch,
general and FPU registers, batched special-register access, and replacement-VM
reset. MMIO PC advancement wraps at the address boundary.

Native ARM64 MSHV CI uses hierarchical-virtualization runners and bounded test
scheduling for the platform's partition limit. Stress tests retain their
iteration counts.

Commit layers

This PR is D, one signed commit directly above main. It is independent of
GDB support. The MSHV debugger branch has a cherry-pick of shared support A as
E, followed by one MSHV-specific debugger commit F in #2052.

The complete graph and update rules are in
docs/gdb-commit-layers.md.

Validation

  • Formatting and ARM64 MSHV-only cross-Clippy pass after consolidation.
  • Backend Rust source matches the natively validated implementation.
  • Native ARM64 MSHV CI before consolidation passed debug and release, with
    1,076 passed execution records per profile.
  • The dedicated ARM64 MSHV debugger VM also passed the five backend tests.

@cshung cshung added the C-enhancement For PRs adding features, improving functionality, docs, tests, etc. label Jul 7, 2026
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from b34cc5d to fb92ede Compare July 31, 2026 16:13
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from fb92ede to 3736e16 Compare August 12, 2026 14:55
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch 2 times, most recently from b440e24 to 4ada969 Compare August 20, 2026 17:42
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from 4ada969 to 7f2289d Compare September 2, 2026 22:47
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from a70dcfa to 1b275f2 Compare September 29, 2026 05:30
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from 1b275f2 to 2f42d32 Compare November 2, 2026 17:10
@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from 2f42d32 to 0e44f0a Compare November 5, 2026 17:24
@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from e039b60 to 747ee00 Compare November 10, 2026 16:59
@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung marked this pull request as ready for review November 10, 2026 18:22
Copilot AI balanced review requested due to automatic review settings November 10, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A guest-controlled MMIO store can overflow the PC increment and panic the host, while snapshot capture and restore also issue unnecessary separate register requests.

3 open issues
What changed in this PR

This PR implements the Linux aarch64 MSHV backend, allowing Hyperlight to run ARM64 sandboxes through MSHV.

Changes:

  • Implements VM creation, memory mapping, MMIO dispatch, register access, and vCPU reset.
  • Connects MSHV to ARM64 backend selection and memory-access decoding.
  • Adds ARM64 MSHV CI coverage and adjusts test concurrency and platform expectations.
File Description
typos.toml Allows an identifier spelling required by MSHV bindings.
src/​hyperlight_host/​tests/​sandbox_host_tests.rs Limits parallel callbacks for ARM64 MSHV.
src/​hyperlight_host/​tests/​integration_test.rs Limits ARM64 MSHV stress-test concurrency.
src/​hyperlight_host/​src/​sandbox/​snapshot/​file/​config.rs Accepts Arm CPU implementers in Linux snapshot tests.
src/​hyperlight_host/​src/​mem/​memory_region.rs Decodes ARM64 MSHV memory-access flags.
src/​hyperlight_host/​src/​hypervisor/​virtual_machine/​mshv/​aarch64.rs Implements the ARM64 MSHV virtual machine backend.
src/​hyperlight_host/​src/​hypervisor/​hyperlight_vm/​aarch64.rs Instantiates MSHV when selected on ARM64.
.github/​workflows/​ValidatePullRequest.yml Adds debug and release ARM64 MSHV jobs.
.github/​workflows/​dep_build_test.yml Configures runners, test limits, and snapshot-golden exclusions for ARM64 MSHV.

Review effort: Balanced

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from bcd0df1 to 938f7e1 Compare November 11, 2026 19:52
@hyperlight-gh-bot

This comment has been minimized.

@simongdavies simongdavies left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSHV provides partition creation, memory mappings, MMIO dispatch, batched register access and replacement-VM reset on ARM64. Native CI uses tagged hierarchical-virtualization runners and bounded scheduling for the partition limit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
@cshung
cshung force-pushed the cshung/mshv-aarch64 branch from fb09873 to 93e0ffa Compare November 12, 2026 18:15
@cshung

cshung commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

The README platform-support table lists ARM64 Linux/MSHV general support in 93e0ffa. Guest debugging remains in the separate PR #2052.

@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: 93e0ffa5b941
Baseline commit: 01df99173865

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 777.28 ns (➖ 1.00x slower)
vec_bytes 598.31 ns (➖ 1.01x slower)
374.18 µs (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
262144 534.65 ns (➖ 1.02x slower)
65536 142.00 ns (➖ 1.02x faster)

sandboxes

create_initialized_and_drop
medium 13.35 ms (➖ 1.00x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
7.69 ns (➖ 1.00x faster) 7.68 ns (➖ 1.00x faster) 7.69 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 104.44 µs (➖ 1.06x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.18 µs (➖ 1.01x faster) 7.18 µs (➖ 1.03x faster)
65536 1.94 µs (➖ 1.07x faster) 2.06 µs (➖ 1.08x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 26.97 µs (➖ 1.00x faster)
65536 6.25 µs (➖ 1.01x faster) 6.18 µs (➖ 1.03x faster)
8192 1.04 µs (➖ 1.01x slower) 1.03 µs (➖ 1.00x faster)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 699.86 ns (➖ 1.01x slower)
vec_bytes 518.70 ns (➖ 1.02x faster)
682.48 µs (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
262144 497.63 ns (➖ 1.09x faster)
65536 170.78 ns (➖ 1.08x faster)

sandboxes

create_initialized_and_drop
medium 14.90 ms (➖ 1.05x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
6.79 ns (➖ 1.10x faster) 6.80 ns (➖ 1.09x faster) 6.81 ns (➖ 1.10x faster)

snapshot_files

load_snapshot_unverified
small 50.63 µs (➖ 1.06x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.61 µs (➖ 1.07x faster) 7.57 µs (➖ 1.08x faster)
65536 2.15 µs (➖ 1.08x faster) 2.13 µs (➖ 1.09x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 29.20 µs (➖ 1.12x faster)
65536 7.08 µs (➖ 1.09x faster) 7.20 µs (➖ 1.08x faster)
8192 726.34 ns (➖ 1.04x faster) 731.23 ns (➖ 1.09x faster)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 934.14 ns (➖ 1.00x faster)
vec_bytes 716.81 ns (➖ 1.01x slower)
268.94 µs (➖ 1.32x faster)

payload_allocation

slot_pool_segmented
262144 730.76 ns (➖ 1.04x faster)
65536 192.97 ns (➖ 1.01x faster)

sandboxes

create_initialized_and_drop
medium 64.68 ms (➖ 1.08x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.52 ns (➖ 1.01x faster) 9.56 ns (➖ 1.00x faster) 9.76 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 105.15 µs (➖ 1.04x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 9.83 µs (➖ 1.00x faster) 10.14 µs (➖ 1.03x faster)
65536 2.25 µs (➖ 1.00x slower) 2.39 µs (➖ 1.03x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 36.33 µs (➖ 1.04x faster)
65536 8.21 µs (➖ 1.16x faster) 8.02 µs (➖ 1.22x faster)
8192 1.25 µs (➖ 1.04x slower) 1.25 µs (➖ 1.10x faster)
mshv3 / intel (Linux) (❌ 1.73x)

Top regressions

  • function_call_codec/decode_vec_bytes_copy — ❌ 1.73x slower
  • sandboxes/create_initialized_and_drop/medium — ❌ 1.63x slower

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 950.90 ns (➖ 1.00x slower)
vec_bytes 667.32 ns (➖ 1.01x slower)
1.26 ms (❌ 1.73x slower)

payload_allocation

slot_pool_segmented
262144 790.88 ns (➖ 1.02x faster)
65536 255.21 ns (➖ 1.04x faster)

sandboxes

create_initialized_and_drop
medium 85.20 ms (❌ 1.63x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
8.74 ns (➖ 1.07x faster) 8.71 ns (➖ 1.00x slower) 8.84 ns (➖ 1.01x slower)

snapshot_files

load_snapshot_unverified
small 60.21 µs (➖ 1.04x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.01 µs (➖ 1.00x slower) 8.06 µs (➖ 1.00x slower)
65536 2.31 µs (➖ 1.00x slower) 2.30 µs (➖ 1.01x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 38.24 µs (➖ 1.01x faster)
65536 7.63 µs (➖ 1.01x slower) 7.71 µs (➖ 1.03x slower)
8192 914.73 ns (➖ 1.00x faster) 923.99 ns (➖ 1.00x slower)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.17 µs (➖ 1.02x faster)
vec_bytes 762.32 ns (➖ 1.02x faster)
1.94 ms (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
262144 788.73 ns (➖ 1.01x slower)
65536 237.38 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 13.74 ms (➖ 1.02x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.97 ns (➖ 1.07x faster) 9.98 ns (➖ 1.03x faster) 9.92 ns (➖ 1.06x faster)

snapshot_files

load_snapshot_unverified
small 783.10 µs (➖ 1.02x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 9.12 µs (➖ 1.03x faster) 9.12 µs (➖ 1.04x faster)
65536 2.35 µs (➖ 1.01x slower) 2.32 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 40.05 µs (➖ 1.02x slower)
65536 8.87 µs (➖ 1.02x slower) 8.93 µs (➖ 1.02x faster)
8192 1.25 µs (➖ 1.08x faster) 1.26 µs (➖ 1.06x faster)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.23 µs (➖ 1.03x faster)
vec_bytes 803.94 ns (➖ 1.00x faster)
3.13 ms (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
262144 735.43 ns (➖ 1.03x faster)
65536 209.48 ns (➖ 1.00x slower)

sandboxes

create_initialized_and_drop
medium 14.53 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.85 ns (➖ 1.01x slower) 10.06 ns (➖ 1.00x slower) 9.81 ns (➖ 1.09x faster)

snapshot_files

load_snapshot_unverified
small 692.64 µs (➖ 1.00x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.67 µs (➖ 1.00x slower) 7.69 µs (➖ 1.00x slower)
65536 2.32 µs (➖ 1.00x slower) 2.31 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 50.93 µs (➖ 1.00x faster)
65536 8.50 µs (➖ 1.02x slower) 8.40 µs (➖ 1.08x faster)
8192 1.06 µs (➖ 1.11x faster) 1.06 µs (➖ 1.00x slower)

Reported by cargo ci bench-report --candidate run:43277990563 --config-file bench_report.toml.

This branch has not been deployed

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

Labels

C-enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants