From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zachary Amsden Subject: [KVM timekeeping 10/35] Fix deep C-state TSC desynchronization Date: Thu, 19 Aug 2010 22:07:24 -1000 Message-ID: <1282291669-25709-11-git-send-email-zamsden@redhat.com> References: <1282291669-25709-1-git-send-email-zamsden@redhat.com> Cc: Zachary Amsden , Avi Kivity , Marcelo Tosatti , Glauber Costa , Thomas Gleixner , John Stultz , linux-kernel@vger.kernel.org To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55341 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751191Ab0HTIIZ (ORCPT ); Fri, 20 Aug 2010 04:08:25 -0400 In-Reply-To: <1282291669-25709-1-git-send-email-zamsden@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: When CPUs with unstable TSCs enter deep C-state, TSC may stop running. This causes us to require resynchronization. Since we can't tell when this may potentially happen, we assume the worst by forcing re-compensation for it at every point the VCPU task is descheduled. Signed-off-by: Zachary Amsden --- arch/x86/kvm/x86.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7fc4a55..52b6c21 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1866,7 +1866,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) } kvm_x86_ops->vcpu_load(vcpu, cpu); - if (unlikely(vcpu->cpu != cpu)) { + if (unlikely(vcpu->cpu != cpu) || check_tsc_unstable()) { /* Make sure TSC doesn't go backwards */ s64 tsc_delta = !vcpu->arch.last_host_tsc ? 0 : native_read_tsc() - vcpu->arch.last_host_tsc; -- 1.7.1