Repository navigation
fix(kvm): do not lose vCPU kicks outside of KVM_RUN - #547
Merged
Merged
Conversation
`stop_vcpu()` kicks a vCPU with SIGRTMIN, which only interrupts a vCPU inside KVM_RUN. A vCPU outside KVM_RUN, e.g. one still initializing or emulating an MMIO access, misses the kick and enters the guest again. If the guest then halts, the vCPU never notices the request to pause, shut down, or reboot the VM. As suggested by the KVM API documentation, let the signal handler set `immediate_exit` of the vCPU of the current thread, so that the next KVM_RUN returns immediately, and clear it when KVM_RUN returns EINTR. The handler finds the vCPU through a thread-local variable, so a vCPU stays on the thread that created it. Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Coverage Report for CI Build 42980979607Coverage decreased (-0.03%) to 43.8%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
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.
stop_vcpu()kicks a vCPU with SIGRTMIN, which only interrupts a vCPU inside KVM_RUN. A vCPU outside KVM_RUN, e.g. one still initializing or emulating an MMIO access, misses the kick and enters the guest again. If the guest then halts, the vCPU never notices the request to pause, shut down, or reboot the VM.As suggested by the KVM API documentation, let the signal handler set
immediate_exitof the vCPU of the current thread, so that the next KVM_RUN returns immediately, and clear it when KVM_RUN returns EINTR. The handler finds the vCPU through a thread-local variable, so a vCPU stays on the thread that created it.