8000 Trim `Hypervisor` trait by ludfjig · Pull Request #924 · hyperlight-dev/hyperlight · GitHub
[go: up one dir, main page]

Skip to content

Trim Hypervisor trait#924

Merged
ludfjig merged 13 commits intohyperlight-dev:mainfrom
ludfjig:vm_trait_new
Dec 8, 2025
Merged

Trim Hypervisor trait#924
ludfjig merged 13 commits intohyperlight-dev:mainfrom
ludfjig:vm_trait_new

Conversation

@ludfjig
Copy link
Contributor
@ludfjig ludfjig commented Sep 30, 2025

This PR

  • refactors Hypervisor trait. It's now a minimal trait for common functionality of a minimal Vm. It abstracts over differences in kvm, mshv, whp. This traits only knows things like set/get registers, run, but nothing about guest functions or hyperlight specifics.
  • Introduces HyperlightVm struct. This is a new struct that contains the dyn Hypervisor above, as well as things like guest_ptr, rsp, memory-regions, gdb connections, etc. HyperlightVm knows about initialization, dispatching guest calls, gdb-debugging etc, guest-tracing, which Hypervisor trait doesn't. All code that was previously duplicated in kvm/mshv/whp now lives in HyperlightVm.
  • Slighty cleans up the windows whp implementation, unifying files and removing windows_hypervisor_platform.rs

Please review PR commit-by-commit. Because most code changes are just moves, I've done a compromise where I split up work in atomic commits, however each commit may not compile. I think this still useful because it will be easier to review. I plan on squashing this PR when done.

Closes #465, #904

@ludfjig ludfjig force-pushed the vm_trait_new branch 3 times, most recently from 81f0d54 to 62fad87 Compare October 22, 2025 19:44
@ludfjig ludfjig added the kind/refactor For PRs that restructure or remove code without adding new functionality. label Oct 22, 2025
@ludfjig ludfjig force-pushed the vm_trait_new branch 17 times, most recently from 1562f26 to edc7f00 Compare October 24, 2025 20:15
@ludfjig ludfjig force-pushed the vm_trait_new branch 4 times, most recently from f6337f9 to 350b8e0 Compare October 28, 2025 18:05
@ludfjig ludfjig marked this pull request as ready for review October 28, 2025 18:39
Copy link
Contributor
@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

Awesome work! A lot of duplicated code removal and overall clearer design.

I've left some small comments, with questions mostly, but otherwise from my point of view it's good to go.
edit: I've reviewed each commit, some comments might not be up-to-date with the latest version

Copy link
Contributor
@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

I haven't finished yet, but these are my comments so far
Love this refactor, long overdue! :-)

Copy link
Contributor
@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>

impl debuggablevm

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Copy link
Contributor
@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

LGTM! Great work, Ludvig!

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

Labels

kind/refactor For PRs that restructure or remove code without adding new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rethink driver API

6 participants

0