All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Stefan Lippers-Hollmann <s.L-H@gmx.de>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	mtosatti@redhat.com, stable@kernel.org
Subject: Re: patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree
Date: Mon, 12 Oct 2009 11:41:51 +0200	[thread overview]
Message-ID: <20091012094151.GA32228@amd.com> (raw)
In-Reply-To: <200910101540.06686.s.L-H@gmx.de>

All the nested stuff was moved into its own sub-struct in 2.6.32. Here
is a version that works with 2.6.31.3:

>From 4505a73070f341674e0d22a8c9ee51b2beeb843e Mon Sep 17 00:00:00 2001
From: Joerg Roedel <joerg.roedel@amd.com>
Date: Mon, 12 Oct 2009 11:19:07 +0200
Subject: [PATCH 1/2] KVM: SVM: Fix tsc offset adjustment when running nested

When svm_vcpu_load is called while the vcpu is running in
guest mode the tsc adjustment made there is lost on the next
emulated #vmexit. This causes the tsc running backwards in
the guest. This patch fixes the issue by also adjusting the
tsc_offset in the emulated hsave area so that it will not
get lost.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kvm/svm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index b1f658a..aafd8bf 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -709,6 +709,8 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 		rdtscll(tsc_this);
 		delta = vcpu->arch.host_tsc - tsc_this;
 		svm->vmcb->control.tsc_offset += delta;
+		if (is_nested(svm))
+			svm->hsave->control.tsc_offset += delta;
 		vcpu->cpu = cpu;
 		kvm_migrate_timers(vcpu);
 		svm->asid_generation = 0;
-- 
1.6.4.3



  parent reply	other threads:[~2009-10-12  9:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091009223815.20569488DB@coco.kroah.org>
2009-10-10 13:40 ` patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree Stefan Lippers-Hollmann
2009-10-10 15:32   ` Marcelo Tosatti
2009-10-12  9:41   ` Joerg Roedel [this message]
2009-10-12 14:55     ` [stable] " Greg KH
2009-10-12 19:13     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091012094151.GA32228@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=s.L-H@gmx.de \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.