mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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: #8383 Signed-off-by: Rob Bradford <rbradford@meta.com> Assisted-by: Claude <claude-opus-4-8>