Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Dec 16, 2025

MSRs will be added in another PR.

  • Removed padding fields from fpu register to simplify comparisons. Not sure why I added them to begin with, we don't need C repr on these. It could possibly allow more efficient into() implementation for kvm/mshv due to single memcyp, but that seems like premature optimization to me
  • Reset vcpu state on snapshot::restore
  • Added bunch of tests
  • MSRs are not included in this PR. Will add MSRs in future PR

Addresses #791 partially

------ After rebase ------

  • Added field onto Snapshot which is SpecialRegisters. These are saved on snapshot() and restored when calling restore(). This is since we can no longer just reset them to default since the guest initializes them

@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Dec 16, 2025
@ludfjig ludfjig force-pushed the reset_vcpu branch 3 times, most recently from 9cfcc9c to 8507c7a Compare December 16, 2025 19:52
@ludfjig ludfjig force-pushed the reset_vcpu branch 11 times, most recently from d09b1fc to 18d4ff9 Compare December 17, 2025 06:46
@ludfjig ludfjig requested a review from Copilot December 17, 2025 06:53

This comment was marked as outdated.

@ludfjig ludfjig marked this pull request as ready for review December 17, 2025 07:26
jsturtevant
jsturtevant previously approved these changes Feb 3, 2026
Copy link
Member

@syntactically syntactically left a comment

Choose a reason for hiding this comment

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

This looks pretty good to me! It's probably a good bit of extra overhead, but perhaps that's unavoidable.

One alternate option would be to require every guest to have some code somewhere that does some/all of this reset work inside the VM, validating that the correct code is in the correct place whenever we make a snapshot. We have talked about doing something similar for TLB flushes as well. That would let you batch most of this into a single hypercall, although the hypercall itself would be a bit more expensive. Do you have any sense of whether that would make sense to investigate?

syntactically
syntactically previously approved these changes Feb 4, 2026
Copy link
Member

@syntactically syntactically left a comment

Choose a reason for hiding this comment

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

Sorry, missed one other comment.

@ludfjig ludfjig dismissed stale reviews from syntactically and jsturtevant via 2b0b5f9 February 4, 2026 19:56
@ludfjig ludfjig force-pushed the reset_vcpu branch 7 times, most recently from e546c3d to 1092dd1 Compare February 6, 2026 18:42
@ludfjig ludfjig requested a review from Copilot February 6, 2026 18:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the reset_vcpu branch 2 times, most recently from 283b7a5 to 1d7a46e Compare February 9, 2026 21:08
@ludfjig ludfjig merged commit 03e6d7c into hyperlight-dev:main Feb 9, 2026
120 of 162 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants