From patchwork Wed Mar 2 21:57:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Hallyn X-Patchwork-Id: 85284 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 DCF57B70B8 for ; Fri, 4 Mar 2011 00:25:25 +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 1Pv8Wo-0006Cx-Dc; Thu, 03 Mar 2011 13:25:14 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Puu2n-0006N9-KX for kernel-team@lists.ubuntu.com; Wed, 02 Mar 2011 21:57:17 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Puu2m-0007ss-PI; Wed, 02 Mar 2011 21:57:16 +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 1Puu2m-0002Kv-En; Wed, 02 Mar 2011 21:57:16 +0000 Received: by peq (Postfix, from userid 1000) id E43A881272DA; Wed, 2 Mar 2011 15:57:13 -0600 (CST) Date: Wed, 2 Mar 2011 15:57:13 -0600 From: "Serge E. Hallyn" To: Tim Gardner Subject: Re: [lucid PATCH] fix smp kvm guests on AMD Message-ID: <20110302215713.GA27999@peq.hallyn.com> References: <20110301162500.GA14959@peq.hallyn.com> <4D6E4E6F.9050208@canonical.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4D6E4E6F.9050208@canonical.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Mailman-Approved-At: Thu, 03 Mar 2011 13:25:12 +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 > Serge - Can we get this as 3 different patches, each with an > appropriate 'backported from' or 'cherry-picked from' SHA1 ID. Attached to this email. (If you prefer 3 separate inline emails pls let me know - I'm still getting familiar with the preferences here). The result compiled fine. thanks, -serge Acked-by: Stefan Bader From 00a79dd53bf86de570e7449a5839da10e5b4be45 Mon Sep 17 00:00:00 2001 From: Serge E. Hallyn Date: Wed, 2 Mar 2011 20:07:48 +0000 Subject: [PATCH 3/3] 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. 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 ffd70eb..205d977 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -654,6 +654,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v) monotonic_to_bootbased(&ts); local_irq_restore(flags); kernel_ns = timespec_to_ns(&ts); + vcpu->last_guest_tsc = tsc_timestamp; /* * Time as measured by the TSC may go backwards when resetting the base -- 1.7.0.4