public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree
       [not found] <20091009223815.20569488DB@coco.kroah.org>
@ 2009-10-10 13:40 ` Stefan Lippers-Hollmann
  2009-10-10 15:32   ` Marcelo Tosatti
  2009-10-12  9:41   ` Joerg Roedel
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Lippers-Hollmann @ 2009-10-10 13:40 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, joerg.roedel, mtosatti, stable

Hi

On Saturday 10 October 2009, gregkh@suse.de wrote:
> This is a note to let you know that we have just queued up the patch titled
> 
>     Subject: KVM: SVM: Fix tsc offset adjustment when running nested
> 
> to the 2.6.31-stable tree.  Its filename is
> 
>     kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch

This patch breaks compilation of 2.6.31.4-rc1 and 2.6.31.4-rc2, as it 
seems to depend on several prior optimisations to kvm's/ svm's nested 
behaviour:

[...]
  CC [M]  arch/x86/kvm/svm.o
arch/x86/kvm/svm.c: In function 'svm_vcpu_load':
arch/x86/kvm/svm.c:713: error: 'struct vcpu_svm' has no member named 'nested'
make[2]: *** [arch/x86/kvm/svm.o] Error 1
make[1]: *** [arch/x86/kvm] Error 2
make: *** [arch/x86] Error 2

Regards
	Stefan Lippers-Hollmann

-- 
> A git repo of this tree can be found at 
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> 
> From 77b1ab1732feb5e3dcbaf31d2f7547c5229f5f3a Mon Sep 17 00:00:00 2001
> From: Joerg Roedel <joerg.roedel@amd.com>
> Date: Wed, 16 Sep 2009 15:24:17 +0200
> Subject: KVM: SVM: Fix tsc offset adjustment when running nested
> 
> From: Joerg Roedel <joerg.roedel@amd.com>
> 
> commit 77b1ab1732feb5e3dcbaf31d2f7547c5229f5f3a upstream.
> 
> 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>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> ---
>  arch/x86/kvm/svm.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -709,6 +709,8 @@ static void svm_vcpu_load(struct kvm_vcp
>  		rdtscll(tsc_this);
>  		delta = vcpu->arch.host_tsc - tsc_this;
>  		svm->vmcb->control.tsc_offset += delta;
> +		if (is_nested(svm))
> +			svm->nested.hsave->control.tsc_offset += delta;
>  		vcpu->cpu = cpu;
>  		kvm_migrate_timers(vcpu);
>  		svm->asid_generation = 0;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2009-10-10 15:32 UTC (permalink / raw)
  To: Stefan Lippers-Hollmann
  Cc: gregkh, linux-kernel, joerg.roedel, stable, Avi Kivity

On Sat, Oct 10, 2009 at 03:40:05PM +0200, Stefan Lippers-Hollmann wrote:
> Hi
> 
> On Saturday 10 October 2009, gregkh@suse.de wrote:
> > This is a note to let you know that we have just queued up the patch titled
> > 
> >     Subject: KVM: SVM: Fix tsc offset adjustment when running nested
> > 
> > to the 2.6.31-stable tree.  Its filename is
> > 
> >     kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch
> 
> This patch breaks compilation of 2.6.31.4-rc1 and 2.6.31.4-rc2, as it 
> seems to depend on several prior optimisations to kvm's/ svm's nested 
> behaviour:
> 
> [...]
>   CC [M]  arch/x86/kvm/svm.o
> arch/x86/kvm/svm.c: In function 'svm_vcpu_load':
> arch/x86/kvm/svm.c:713: error: 'struct vcpu_svm' has no member named 'nested'
> make[2]: *** [arch/x86/kvm/svm.o] Error 1
> make[1]: *** [arch/x86/kvm] Error 2
> make: *** [arch/x86] Error 2
> 
> Regards
> 	Stefan Lippers-Hollmann

Greg,

Please drop the patch.

Thanks


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree
  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
  2009-10-12 14:55     ` [stable] " Greg KH
  2009-10-12 19:13     ` Greg KH
  1 sibling, 2 replies; 5+ messages in thread
From: Joerg Roedel @ 2009-10-12  9:41 UTC (permalink / raw)
  To: Stefan Lippers-Hollmann; +Cc: gregkh, linux-kernel, mtosatti, stable

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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [stable] patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree
  2009-10-12  9:41   ` Joerg Roedel
@ 2009-10-12 14:55     ` Greg KH
  2009-10-12 19:13     ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2009-10-12 14:55 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Stefan Lippers-Hollmann, stable, gregkh, linux-kernel, mtosatti

On Mon, Oct 12, 2009 at 11:41:51AM +0200, Joerg Roedel wrote:
> 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>

Thanks, but Marcelo just said we should drop the original patch.

Marcelo, if you want this one in instead, please let me know.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [stable] patch kvm-svm-fix-tsc-offset-adjustment-when-running-nested.patch added to 2.6.31-stable tree
  2009-10-12  9:41   ` Joerg Roedel
  2009-10-12 14:55     ` [stable] " Greg KH
@ 2009-10-12 19:13     ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2009-10-12 19:13 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Stefan Lippers-Hollmann, stable, gregkh, linux-kernel, mtosatti

On Mon, Oct 12, 2009 at 11:41:51AM +0200, Joerg Roedel wrote:
> 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

Thanks, I've replaced the original patch with this version.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-12 20:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2009-10-12 14:55     ` [stable] " Greg KH
2009-10-12 19:13     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox