From patchwork Mon Apr 18 08:03:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 714431 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3I83gYE024574 for ; Mon, 18 Apr 2011 08:03:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347Ab1DRIDj (ORCPT ); Mon, 18 Apr 2011 04:03:39 -0400 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 Received: from mail37-va3-R.bigfish.com (10.7.14.253) by VA3EHSOBE006.bigfish.com (10.7.40.26) with Microsoft SMTP Server id 14.1.225.8; Mon, 18 Apr 2011 08:03:34 +0000 Received: from mail37-va3 (localhost.localdomain [127.0.0.1]) by mail37-va3-R.bigfish.com (Postfix) with ESMTP id 011E6102834D; Mon, 18 Apr 2011 08:03:34 +0000 (UTC) X-SpamScore: -12 X-BigFish: VPS-12(zz98dKzz1202hzz15d4Rz32i637h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail37-va3 (localhost.localdomain [127.0.0.1]) by mail37-va3 (MessageSwitch) id 1303113813489488_11834; Mon, 18 Apr 2011 08:03:33 +0000 (UTC) Received: from VA3EHSMHS032.bigfish.com (unknown [10.7.14.248]) by mail37-va3.bigfish.com (Postfix) with ESMTP id 656561BA8050; Mon, 18 Apr 2011 08:03:33 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by VA3EHSMHS032.bigfish.com (10.7.99.42) with Microsoft SMTP Server id 14.1.225.8; Mon, 18 Apr 2011 08:03:32 +0000 X-WSS-ID: 0LJU91U-01-2NL-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 2D4E61028361; Mon, 18 Apr 2011 03:03:29 -0500 (CDT) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Mon, 18 Apr 2011 03:04:30 -0500 Received: from storexhtp01.amd.com (172.24.4.3) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 18 Apr 2011 03:03:30 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp01.amd.com (172.24.4.3) with Microsoft SMTP Server id 8.3.83.0; Mon, 18 Apr 2011 04:03:28 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id 112F149C1F7; Mon, 18 Apr 2011 09:03:25 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id DC0C7FFCF7; Mon, 18 Apr 2011 10:03:24 +0200 (CEST) Date: Mon, 18 Apr 2011 10:03:24 +0200 From: "Roedel, Joerg" To: Jan Kiszka CC: Avi Kivity , Marcelo Tosatti , Zachary Amsden , "kvm@vger.kernel.org" Subject: Re: [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc 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-Disposition: inline In-Reply-To: <4DA9BF2D.7010804@web.de> User-Agent: Mutt/1.5.20 (2009-06-14) X-OriginatorOrg: amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 18 Apr 2011 08:03:42 +0000 (UTC) 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)