Skip to content

Support opt-in Raspberry Pi 4 guest builds - #2092

Merged
cshung merged 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/raspberry-pi-support
Nov 24, 2026
Merged

cshung merged 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/raspberry-pi-support

Conversation

@cshung

@cshung cshung commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Purpose

Opt-in guest builds for Raspberry Pi 4 on 64-bit Linux/KVM. The Pi 4's Cortex-A72 lacks LSE atomics.

This is a niche configuration intended for testing. There is no Raspberry Pi 4 CI coverage, and this PR does not add any. Manual hardware validation is sufficient for this use case.

Configuration

RUSTFLAGS="-C target-feature=-lse" just guests
just test

Default ARM64 builds retain LSE. Disabling LSE selects an atomic exclusive load/store retry loop for the physical-page allocator. The loop may cost more under contention. Non-PIE guest builds preserve incoming RUSTFLAGS.

Validation

  • Raspberry Pi 4, native Linux/KVM: host build and Clippy passed. 558 debug tests passed, with 16 ignored. All seven focused release allocation tests passed. These guests were built on Windows with LSE disabled.
  • Windows ARM64/WHP: just fmt-apply, just clippy, just build, just guests, and just test passed. Guest Clippy passed with LSE enabled and disabled.
  • Disassembly: default guests retain LDADD. All ten opt-in guest binaries contain no LSE instructions.

Select the exclusive load/store allocator when LSE is disabled. Preserve guest target flags in non-PIE builds and document the opt-in configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
@cshung cshung added the C-enhancement For PRs adding features, improving functionality, docs, tests, etc. label Nov 23, 2026
@cshung
cshung requested a review from andreiltd as a code owner November 23, 2026 22:04
@cshung cshung added S-needs-review PR is ready for (re-)review O-aarch64 Specific to 64-bit Arm processors labels Nov 23, 2026
@cshung
cshung requested a review from squillace as a code owner November 23, 2026 22:04
@cshung cshung added O-kvm Linux KVM backend O-linux Linux host support labels Nov 23, 2026
Copilot AI balanced review requested due to automatic review settings November 23, 2026 22:04

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.

🟢 Approval recommended

No active review issues block the opt-in Raspberry Pi 4 guest-build changes.

No open issues 🎉

What changed in this PR

This PR enables opt-in Raspberry Pi 4 guest builds for Hyperlight on 64-bit Linux/KVM while keeping LSE atomics enabled by default.

Changes:

  • Adds an exclusive load/store retry loop for physical-page allocation when LSE is disabled.
  • Preserves incoming RUSTFLAGS in non-PIE guest builds.
  • Documents build commands and platform requirements. Hardware validation remains manual, without Raspberry Pi CI coverage.
File Description
src/​hyperlight_guest/​src/​arch/​aarch64/​prim_alloc.rs Selects LSE or exclusive load/store atomics at compile time.
Justfile Preserves caller-supplied flags for non-PIE Rust guests.
docs/​how-to-build-a-hyperlight-guest-binary.md Explains opt-in builds and Raspberry Pi 4 requirements.
CHANGELOG.md Records guest support for ARM64 CPUs without LSE.

Review effort: Balanced

@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: 59386a9bea4f
Baseline commit: f297a91406e0

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 272.10 ns (➖ 1.03x slower)
vec_bytes 81.98 ns (➖ 1.01x slower)
371.97 µs (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
65536 145.42 ns (➖ 1.02x slower)
262144 521.20 ns (➖ 1.01x faster)

sandboxes

create_initialized_and_drop
medium 13.38 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
7.70 ns (➖ 1.00x faster) 7.70 ns (➖ 1.00x faster) 7.70 ns (➖ 1.02x faster)

snapshot_files

load_snapshot_unverified
small 117.40 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 1.95 µs (➖ 1.08x faster) 2.03 µs (➖ 1.06x slower)
262144 7.64 µs (➖ 1.10x slower) 7.02 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 6.17 µs (➖ 1.04x faster) 6.20 µs (➖ 1.03x faster)
262144 27.18 µs (➖ 1.01x faster)
8192 1.01 µs (➖ 1.05x faster) 1.03 µs (➖ 1.03x slower)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 287.65 ns (➖ 1.02x faster)
vec_bytes 96.05 ns (➖ 1.00x slower)
767.17 µs (➖ 1.03x slower)

payload_allocation

slot_pool_segmented
65536 203.28 ns (➖ 1.00x faster)
262144 589.76 ns (➖ 1.02x faster)

sandboxes

create_initialized_and_drop
medium 16.13 ms (➖ 1.04x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
8.01 ns (➖ 1.00x faster) 7.98 ns (➖ 1.00x faster) 8.00 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 66.33 µs (➖ 1.06x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.53 µs (➖ 1.01x slower) 2.50 µs (➖ 1.01x faster)
262144 8.89 µs (➖ 1.01x faster) 8.92 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.34 µs (➖ 1.02x faster) 8.32 µs (➖ 1.01x faster)
262144 34.98 µs (➖ 1.02x faster)
8192 831.36 ns (➖ 1.00x slower) 869.84 ns (➖ 1.02x slower)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 351.03 ns (➖ 1.08x faster)
vec_bytes 103.76 ns (➖ 1.00x slower)
272.02 µs (➖ 1.02x slower)

payload_allocation

slot_pool_segmented
65536 193.88 ns (➖ 1.01x slower)
262144 728.78 ns (➖ 1.00x slower)

sandboxes

create_initialized_and_drop
medium 65.44 ms (➖ 1.02x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
9.57 ns (➖ 1.00x faster) 9.61 ns (➖ 1.00x faster) 9.51 ns (➖ 1.02x faster)

snapshot_files

load_snapshot_unverified
small 102.61 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.22 µs (➖ 1.00x faster) 2.44 µs (➖ 1.01x faster)
262144 9.84 µs (➖ 1.02x slower) 9.93 µs (➖ 1.08x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.30 µs (➖ 1.17x faster) 8.41 µs (➖ 1.16x faster)
262144 36.23 µs (➖ 1.09x faster)
8192 1.22 µs (➖ 1.00x slower) 1.23 µs (➖ 1.02x faster)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 378.27 ns (➖ 1.03x faster)
vec_bytes 94.50 ns (➖ 1.01x slower)
790.92 µs (➖ 1.03x slower)

payload_allocation

slot_pool_segmented
65536 226.67 ns (➖ 1.16x faster)
262144 666.95 ns (➖ 1.04x faster)

sandboxes

create_initialized_and_drop
medium 84.76 ms (➖ 1.16x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
9.67 ns (➖ 1.10x faster) 10.04 ns (➖ 1.15x slower) 8.73 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 55.13 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.29 µs (➖ 1.03x faster) 2.41 µs (➖ 1.04x slower)
262144 8.17 µs (➖ 1.04x slower) 7.94 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 7.36 µs (➖ 1.10x faster) 7.53 µs (➖ 1.00x faster)
262144 41.46 µs (➖ 1.10x slower)
8192 984.06 ns (➖ 1.07x slower) 899.25 ns (➖ 1.01x faster)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 553.10 ns (➖ 1.01x faster)
vec_bytes 169.34 ns (➖ 1.03x slower)
1.99 ms (➖ 1.00x faster)

payload_allocation

slot_pool_segmented
65536 229.82 ns (➖ 1.00x faster)
262144 791.76 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 12.54 ms (➖ 1.03x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
10.30 ns (➖ 1.03x slower) 10.02 ns (➖ 1.01x slower) 10.16 ns (➖ 1.02x slower)

snapshot_files

load_snapshot_unverified
small 831.33 µs (➖ 1.08x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.31 µs (➖ 1.00x faster) 2.31 µs (➖ 1.03x faster)
262144 9.46 µs (➖ 1.00x faster) 9.22 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.98 µs (➖ 1.02x slower) 9.05 µs (➖ 1.00x slower)
262144 39.89 µs (➖ 1.10x faster)
8192 1.28 µs (➖ 1.00x slower) 1.28 µs (➖ 1.00x slower)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 600.36 ns (➖ 1.02x slower)
vec_bytes 177.04 ns (➖ 1.06x slower)
3.00 ms (➖ 1.04x faster)

payload_allocation

slot_pool_segmented
65536 209.25 ns (➖ 1.03x faster)
262144 741.57 ns (➖ 1.32x faster)

sandboxes

create_initialized_and_drop
medium 14.71 ms (➖ 1.02x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
10.07 ns (➖ 1.00x faster) 9.64 ns (➖ 1.02x faster) 9.76 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 684.21 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.30 µs (➖ 1.02x slower) 2.25 µs (➖ 1.02x faster)
262144 7.74 µs (➖ 1.01x slower) 7.53 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.27 µs (➖ 1.02x faster) 8.32 µs (➖ 1.00x slower)
262144 50.51 µs (➖ 1.16x slower)
8192 1.06 µs (➖ 1.12x faster) 1.13 µs (➖ 1.05x slower)

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

@ludfjig ludfjig 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.

cool!

@cshung
cshung merged commit 81848a9 into hyperlight-dev:main Nov 24, 2026
70 checks passed
@cshung
cshung deleted the cshung/raspberry-pi-support branch November 24, 2026 19:23
@github-actions github-actions Bot removed the S-needs-review PR is ready for (re-)review label Nov 24, 2026
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. O-aarch64 Specific to 64-bit Arm processors O-kvm Linux KVM backend O-linux Linux host support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants