]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Update vCPU's hv_clock before back to guest when tsc_offset is adjusted
authorZelin Deng <zelin.deng@linux.alibaba.com>
Wed, 28 Apr 2021 02:22:01 +0000 (10:22 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Sep 2021 11:07:03 +0000 (07:07 -0400)
commit76df7b6d4dcfd9cccdc4838713e5b94f1233aedf
treeccefffafbd89e8eab9ee525e9b12fef527258da1
parent6d4a50acd875a16958fccdb7504390049aec7ed9
KVM: x86: Update vCPU's hv_clock before back to guest when tsc_offset is adjusted

When MSR_IA32_TSC_ADJUST is written by guest due to TSC ADJUST feature
especially there's a big tsc warp (like a new vCPU is hot-added into VM
which has been up for a long time), tsc_offset is added by a large value
then go back to guest. This causes system time jump as tsc_timestamp is
not adjusted in the meantime and pvclock monotonic character.
To fix this, just notify kvm to update vCPU's guest time before back to
guest.

Cc: stable@vger.kernel.org
Signed-off-by: Zelin Deng <zelin.deng@linux.alibaba.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1619576521-81399-2-git-send-email-zelin.deng@linux.alibaba.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c