From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Roedel, Joerg" Subject: Re: [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Date: Mon, 18 Apr 2011 10:03:24 +0200 Message-ID: <20110418080324.GA2192@amd.com> References: <1301042691-22929-1-git-send-email-joerg.roedel@amd.com> <1301042691-22929-4-git-send-email-joerg.roedel@amd.com> <4DA9BF2D.7010804@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: Avi Kivity , Marcelo Tosatti , Zachary Amsden , "kvm@vger.kernel.org" To: Jan Kiszka Return-path: Received: from va3ehsobe006.messaging.microsoft.com ([216.32.180.16]:14798 "EHLO VA3EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753211Ab1DRIDg (ORCPT ); Mon, 18 Apr 2011 04:03:36 -0400 Content-Disposition: inline In-Reply-To: <4DA9BF2D.7010804@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On Sat, Apr 16, 2011 at 12:09:17PM -0400, Jan Kiszka wrote: > This patch appears to cause troubles to Linux guests on TSC clocksource > and APIC highres timer. The first boot after qemu start is always fine, > but after a reboot the guest timer appears to fire incorrectly or even > not at all. Hi Jan, can you please test if this patch fixes the problem? diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index bd57639..d7282ef 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -391,7 +391,6 @@ struct kvm_vcpu_arch { unsigned int hw_tsc_khz; unsigned int time_offset; struct page *time_page; - u64 last_host_tsc; u64 last_guest_tsc; u64 last_kernel_ns; u64 last_tsc_nsec; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1d5a7f4..d8277aa 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2146,7 +2146,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { kvm_x86_ops->vcpu_put(vcpu); kvm_put_guest_fpu(vcpu); - vcpu->arch.last_host_tsc = native_read_tsc(); + kvm_get_msr(vcpu, MSR_IA32_TSC, &vcpu->arch.last_guest_tsc); } static int is_efer_nx(void) -- AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632