x86/tsc: update vcpu time info on guest TSC adjustments
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 25 Nov 2019 15:16:18 +0000 (16:16 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Nov 2019 15:16:18 +0000 (16:16 +0100)
commit41d85cbeaff2bcb6ba1a28fcc322f91c4930b98b
treeef259d9a5711bd33ce27987840ba4669e42e49b5
parent64d6137c17eb684112fc3a8c9fef70add0f12a98
x86/tsc: update vcpu time info on guest TSC adjustments

If a HVM/PVH guest writes to MSR_IA32_TSC{_ADJUST} and thus changes
the value of the time stamp counter the vcpu time info must also be
updated, or the time calculated by the guest using the Xen PV clock
interface will be skewed.

Update the vcpu time info when the guest writes to either MSR_IA32_TSC
or MSR_IA32_TSC_ADJUST. This fixes lockups seen when running the
pv-shim on AMD hardware, since the shim will aggressively try to keep
TSCs in sync by periodically writing to MSR_IA32_TSC if the TSC is not
reliable.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wl@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 7eee9c16d6405a1a1f2e8c6472923db842c90cfb
master date: 2019-10-23 17:01:56 +0100
xen/arch/x86/hvm/hvm.c