From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Date: Mon, 18 Apr 2011 11:12:56 +0200 Message-ID: <4DAC0098.8080002@siemens.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> <20110418080324.GA2192@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , Zachary Amsden , "kvm@vger.kernel.org" To: "Roedel, Joerg" Return-path: Received: from david.siemens.de ([192.35.17.14]:32439 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752673Ab1DRJND (ORCPT ); Mon, 18 Apr 2011 05:13:03 -0400 In-Reply-To: <20110418080324.GA2192@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2011-04-18 10:03, Roedel, Joerg wrote: > 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) > Looks good, behaviour is now fine also after reboot. Thanks, Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux