Skip to content

mshv: use VP register page for RIP/RAX writes in run_vcpu#1366

Open
ludfjig wants to merge 1 commit intohyperlight-dev:mainfrom
ludfjig:mshv_use_vp_page
Open

mshv: use VP register page for RIP/RAX writes in run_vcpu#1366
ludfjig wants to merge 1 commit intohyperlight-dev:mainfrom
ludfjig:mshv_use_vp_page

Conversation

@ludfjig
Copy link
Copy Markdown
Contributor

@ludfjig ludfjig commented Apr 9, 2026

Replace set_reg() hypercalls with direct VP register page writes for the RIP increment on IO exits and the RAX write on IO-in (hw-interrupts). The VP register page is a shared memory page between userspace and the hypervisor that is picked up automatically on the next DISPATCH_VP, eliminating one hypercall per IO exit.

Benchmark Results (MSHV)

Benchmark Before After Change
guest_calls/call/default 51.4 µs 46.0 µs -10.3%
guest_calls/call/small 54.2 µs 38.6 µs -28.5%
guest_calls/call/medium 55.6 µs 39.6 µs -28.7%
guest_calls/call/large 58.8 µs 40.7 µs -30.7%
guest_calls/call_with_restore/default 183.1 µs 157.3 µs -14.0%
guest_calls/call_with_restore/small 193.6 µs 170.6 µs -14.1%
guest_calls/call_with_host_function/default 108.3 µs 67.5 µs -37.6%
guest_calls/call_with_host_function/small 95.8 µs 70.4 µs -26.3%
guest_calls/call_with_host_function/medium 94.9 µs 71.5 µs -24.4%
guest_calls/call_with_host_function/large 99.8 µs 74.3 µs -25.5%

@ludfjig ludfjig added kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. area/performance Addresses performance labels Apr 9, 2026
@ludfjig ludfjig marked this pull request as ready for review April 9, 2026 19:11
Replace set_reg() hypercalls with direct VP register page writes
for the RIP increment on IO exits and the RAX write on IO-in
(hw-interrupts). The VP register page is a shared memory page
between userspace and the hypervisor that is picked up automatically
on the next DISPATCH_VP, eliminating one hypercall per IO exit.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the mshv_use_vp_page branch from e5b2b39 to f665eab Compare April 9, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/performance Addresses performance kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant