linux_dsm_epyc7002/arch/x86
Paolo Bonzini 8171cd6880 KVM: x86: use raw clock values consistently
Commit 53fafdbb8b ("KVM: x86: switch KVMCLOCK base to monotonic raw
clock") changed kvmclock to use tkr_raw instead of tkr_mono.  However,
the default kvmclock_offset for the VM was still based on the monotonic
clock and, if the raw clock drifted enough from the monotonic clock,
this could cause a negative system_time to be written to the guest's
struct pvclock.  RHEL5 does not like it and (if it boots fast enough to
observe a negative time value) it hangs.

There is another thing to be careful about: getboottime64 returns the
host boot time with tkr_mono frequency, and subtracting the tkr_raw-based
kvmclock value will cause the wallclock to be off if tkr_raw drifts
from tkr_mono.  To avoid this, compute the wallclock delta from the
current time instead of being clever and using getboottime64.

Fixes: 53fafdbb8b ("KVM: x86: switch KVMCLOCK base to monotonic raw clock")
Cc: stable@vger.kernel.org
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-02-05 15:17:45 +01:00
..
boot Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-01-28 12:46:42 -08:00
configs
crypto
entry threads-v5.6 2020-01-29 19:38:34 -08:00
events Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-01-28 09:44:15 -08:00
hyperv
ia32
include kvm: i8254: Deactivate APICv when using in-kernel PIT re-injection mode. 2020-02-05 15:17:44 +01:00
kernel MPX requires recompiling applications, which requires compiler support. 2020-01-30 16:11:50 -08:00
kvm KVM: x86: use raw clock values consistently 2020-02-05 15:17:45 +01:00
lib Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-01-28 12:28:06 -08:00
math-emu
mm ARM: Cleanups and corner case fixes 2020-01-31 09:30:41 -08:00
net
oprofile
pci Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-01-28 09:03:40 -08:00
platform drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
power
purgatory
ras
realmode
tools
um
video
xen Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-01-28 12:11:23 -08:00
.gitignore
Kbuild
Kconfig MPX requires recompiling applications, which requires compiler support. 2020-01-30 16:11:50 -08:00
Kconfig.cpu
Kconfig.debug
Makefile
Makefile_32.cpu
Makefile.um