Use WHvResetPartition on Windows instead of manual vCPU state reset#1306
Draft
ludfjig wants to merge 2 commits intohyperlight-dev:mainfrom
Draft
Use WHvResetPartition on Windows instead of manual vCPU state reset#1306ludfjig wants to merge 2 commits intohyperlight-dev:mainfrom
ludfjig wants to merge 2 commits intohyperlight-dev:mainfrom
Conversation
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the manual set_regs/set_debug_regs/reset_xsave calls in reset_vcpu on Windows with a single WHvResetPartition API call. This resets a bunch of state that wasn't reset before, including msrs, apic/lapic, interruptrs, vmcs/b internals, etc.
This will clear all guest visible state, at the expense of a little bit performance (rougly +~50 micro seconds compared to before on my local machine).
WHvResetPartitionis an internal API available fromWin11 21H2, but qemu already uses it so I assume it's stable enough.WHvResetPartitionhas been shipped since Windows 11 21H2 (original Windows 11 release, October 2021) and Windows Server 2022 (released August 2021).Our windows 2022 CI can't handle this it seems like, but our windows 2025 works