kvmclock_offset is negative, it should be timespec64_add intead of timespec64_sub. kvm->arch.kvmclock_offset = -ktime_get_boot_ns() Signed-off-by: Huaitong Han <huaitong.han@xxxxxxxxx> --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2f22810..7668a0e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1208,7 +1208,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock) if (kvm->arch.kvmclock_offset) { struct timespec64 ts = ns_to_timespec64(kvm->arch.kvmclock_offset); - boot = timespec64_sub(boot, ts); + boot = timespec64_add(boot, ts); } wc.sec = (u32)boot.tv_sec; /* overflow in 2106 guest time */ wc.nsec = boot.tv_nsec; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html