From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: Fwd: [KVM TSC emulation 6/9] Allow adjust_tsc_offset to be in host or guest cycles Date: Wed, 6 Jul 2011 12:00:11 +0200 Message-ID: <20110706100010.GL29299@8bytes.org> References: <4E008D05.8080705@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm To: Zachary Amsden Return-path: Received: from 8bytes.org ([88.198.83.132]:35160 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977Ab1GFKAM (ORCPT ); Wed, 6 Jul 2011 06:00:12 -0400 Content-Disposition: inline In-Reply-To: <4E008D05.8080705@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jun 21, 2011 at 05:22:29AM -0700, Zachary Amsden wrote: > -static void svm_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment) > +static void svm_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment, bool host) > { > struct vcpu_svm *svm = to_svm(vcpu); > > + WARN_ON(adjustment< 0); > + if (host) > + adjustment = svm_scale_tsc(vcpu, adjustment); > + This is not going to work out with tsc-scaling. The tsc-offset is applied _after_ the hardware-tsc. Just scaling the offset with the same factor will not give you the hardware tsc-value you expect. Joerg