diff mbox

[lucid] fix smp kvm guests on AMD

Message ID 20110309133149.GA20735@peq.hallyn.com
State New
Headers show

Commit Message

Serge Hallyn March 9, 2011, 1:31 p.m. UTC
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

Comments

Stefan Bader March 15, 2011, 8:49 a.m. UTC | #1
Reminder to my fellow kernel-cdevs that we wait for one more good review here.

-Stefan
Tim Gardner March 16, 2011, 2:32 p.m. UTC | #2
On 03/09/2011 06:31 AM, Serge E. Hallyn wrote:
> 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

applied and pushed
diff mbox

Patch

From bbe6a104e5f02364d973ec6dd27667890573bf45 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serge.hallyn@canonical.com>
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 <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
---
 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