From patchwork Wed Mar 9 13:31:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Hallyn X-Patchwork-Id: 86202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 90D80B6F9C for ; Thu, 10 Mar 2011 19:31:37 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1PxbH5-0006Ua-R5; Thu, 10 Mar 2011 08:31:11 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1PxJUX-0005gF-Fv for kernel-team@lists.ubuntu.com; Wed, 09 Mar 2011 13:31:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1PxJUW-0007bi-L3; Wed, 09 Mar 2011 13:31:53 +0000 Received: from cpe-70-123-141-2.austin.res.rr.com ([70.123.141.2] helo=peq) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1PxJUW-0005PF-70; Wed, 09 Mar 2011 13:31:52 +0000 Received: by peq (Postfix, from userid 1000) id 03AA4804EB1E; Wed, 9 Mar 2011 07:31:49 -0600 (CST) Date: Wed, 9 Mar 2011 07:31:49 -0600 From: "Serge E. Hallyn" To: Stefan Bader Subject: Re: [lucid PATCH] fix smp kvm guests on AMD Message-ID: <20110309133149.GA20735@peq.hallyn.com> References: <20110301162500.GA14959@peq.hallyn.com> <4D6E4E6F.9050208@canonical.com> <20110302215713.GA27999@peq.hallyn.com> <4D751E2E.1060005@canonical.com> <20110307195739.GA24597@peq.hallyn.com> <4D763BAA.1000200@canonical.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4D763BAA.1000200@canonical.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Mailman-Approved-At: Thu, 10 Mar 2011 08:31:10 +0000 Cc: "Serge E. Hallyn" , kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Quoting Stefan Bader (stefan.bader@canonical.com): > I would appreciate if you could update the patchset and re-submit it to this thread. attached. -serge From bbe6a104e5f02364d973ec6dd27667890573bf45 Mon Sep 17 00:00:00 2001 From: Serge E. Hallyn Date: Wed, 2 Mar 2011 20:07:48 +0000 Subject: [PATCH 3/4] KVM: x86: Fix kvmclock bug Backport of commit 28e4639adf0c9f26f6bb56149b7ab547bf33bb95 If preempted after kvmclock values are updated, but before hardware virtualization is entered, the last tsc time as read by the guest is never set. It underflows the next time kvmclock is updated if there has not yet been a successful entry / exit into hardware virt. Fix this by simply setting last_tsc to the newly read tsc value so that any computed nsec advance of kvmclock is nulled. Changelog: Mar 8: Address feedback from Stefan: Move back setting of vcpu->last_guest_tsc. Signed-off-by: Zachary Amsden Signed-off-by: Marcelo Tosatti Signed-off-by: Serge E. Hallyn --- arch/x86/kvm/x86.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8a10f27..df1cefb 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -694,6 +694,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v) vcpu->hv_clock.tsc_timestamp = tsc_timestamp; vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; vcpu->last_kernel_ns = kernel_ns; + vcpu->last_guest_tsc = tsc_timestamp; /* * The interface expects us to write an even number signaling that the -- 1.7.0.4