From patchwork Wed Mar 2 21:57:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [lucid] fix smp kvm guests on AMD Date: Wed, 02 Mar 2011 11:57:13 -0000 From: Serge Hallyn X-Patchwork-Id: 85284 Message-Id: <20110302215713.GA27999@peq.hallyn.com> To: Tim Gardner Cc: "Serge E. Hallyn" , kernel-team@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