Re: [PATCH 1/1] KVM: selftests: add kvmclock drift test
From: David Woodhouse
Date: Thu Apr 04 2024 - 10:35:17 EST
On Sat, 2024-01-06 at 00:33 -0800, Dongli Zhang wrote:
> There is kvmclock drift issue during the vCPU hotplug. It has been fixed by
> the commit c52ffadc65e2 ("KVM: x86: Don't unnecessarily force masterclock
> update on vCPU hotplug").
>
> This is to add the test to verify if the master clock is updated when we
> write 0 to MSR_IA32_TSC from the host side.
>
> Here is the usage example on the KVM with the bugfix reverted.
>
> $ ./kvm_clock_drift -v -p 5
> kvmclock based on old pvclock_vcpu_time_info: 5012221999
> version: 2
> tsc_timestamp: 3277968
> system_time: 11849519
> tsc_to_system_mul: 2152530255
> tsc_shift: 0
> flags: 1
>
> kvmclock based on new pvclock_vcpu_time_info: 5012222411
> version: 4
> tsc_timestamp: 9980576184
> system_time: 5012222411
> tsc_to_system_mul: 2152530255
> tsc_shift: 0
> flags: 1
>
> ==== Test Assertion Failure ====
> x86_64/kvm_clock_drift.c:216: clock_old == clock_new
> pid=14257 tid=14257 errno=4 - Interrupted system call
> 1 0x000000000040277b: main at kvm_clock_drift.c:216
> 2 0x00007f7766fa7e44: ?? ??:0
> 3 0x000000000040286d: _start at ??:?
> kvmclock drift detected, old=5012221999, new=5012222411
>
> Signed-off-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
We should extend this to cover live update — it should create a
*second* KVM, migrate the guest including its clock information to
that, and validate that the kvmclock information still doesn't change.
Ideally during a leap second.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature