vmm: Synchronize vCPU TSC on restore#8437
Open
rbradford wants to merge 2 commits into
Open
Conversation
rbradford
commented
Jun 19, 2026
Member
- hypervisor: kvm: Reduce fully qualified paths
- vmm: cpu: Re-sync vCPU TSC offsets after restore
Reduce, but don't fully eliminate the fully qualified std:: paths. Signed-off-by: Rob Bradford <rbradford@meta.com>
Restoring a snapshot (snapshot restore or live-migration receive) sets each vCPU's TSC by writing MSR_IA32_TSC as the vCPU is created. However because CpuManager creates and restores vCPUs one at a time, the host TSC advances between the per-vCPU writes and KVM derives a slightly different TSC offset for each vCPU. KVM only engages its masterclock when every offset matches. This has a side effect of breaking the HyperV TSC reference clock page resulting in significantly reduced performance on Windows. After restore synchronise all vCPU's TSC offset to the boot vCPU's via the KVM_VCPU_TSC_CTRL device attribute group (Linux 5.16+) this allows the KVM TSC masterclock to engage and mitigates performance issues with the KVM HyperV emulation. See: cloud-hypervisor#8383 Signed-off-by: Rob Bradford <rbradford@meta.com> Assisted-by: Claude <claude-opus-4-8>
aa36397 to
eac6f77
Compare
Member
Author
|
@tonicmuroq I think this should also mitigate the issue that you were trying to fix in #8383 |
sboeuf
approved these changes
Jun 19, 2026
|
|
||
| #[cfg(target_arch = "x86_64")] | ||
| ioctl_io_nr!(KVM_NMI, kvm_bindings::KVMIO, 0x9a); | ||
| // kvm-ioctls only exposes the vCPU device-attribute ioctls for aarch64. |
Member
There was a problem hiding this comment.
Can't we fix this in kvm-ioctls?
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.