From: Mukesh Rathor Subject: Re: [V0 PATCH 5/6] AMD-PVH: Support TSC_MODE_NEVER_EMULATE for PVH Date: Mon, 18 Aug 2014 18:43:37 -0700 Message-ID: <20140818184337.78248e74@mantra.us.oracle.com> References: <1408153996-16425-1-git-send-email-mukesh.rathor@oracle.com> <1408153996-16425-6-git-send-email-mukesh.rathor@oracle.com> <53F2AA9B.40200@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XJYSi-00058l-1r for xen-devel@lists.xenproject.org; Tue, 19 Aug 2014 01:43:48 +0000 In-Reply-To: <53F2AA9B.40200@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: xen-devel@lists.xenproject.org, keir@xen.org, Aravind.Gopalakrishnan@amd.com, jbeulich@suse.com, suravee.suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org On Mon, 18 Aug 2014 21:38:35 -0400 Boris Ostrovsky wrote: > On 08/15/2014 09:53 PM, Mukesh Rathor wrote: > > On AMD, MSR_AMD64_TSC_RATIO must be set for rdtsc instruction in > > guest to properly read the cpu tsc. To that end, set tsc_khz in > > struct domain. > > > > Signed-off-by: Mukesh Rathor > > --- > > xen/arch/x86/time.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c > > index bd89219..7512aa4 100644 > > --- a/xen/arch/x86/time.c > > +++ b/xen/arch/x86/time.c > > @@ -1908,6 +1908,7 @@ void tsc_set_info(struct domain *d, > > * but "always_emulate" does not for some reason. Figure > > out > > * why. > > */ > > + d->arch.tsc_khz = cpu_khz; > > switch ( tsc_mode ) > > { > > case TSC_MODE_NEVER_EMULATE: > > I suspect that TSC_MODE DEFAULT may actually work for PVH: since we > don't support migration it should be equivalent to NEVER_EMULATE. > > If you replace in tsc_set_info() is_hvm_domain() with > is_hvm_container_domain() and allow TSC_MODE_DEFAULT along with > TSC_MODE_NEVER_EMULATE under 'if (is_pvh_domain())' then it seems to > me that things should be fine. Nope, already tried that. Something is not being set properly in terms of scaling or offset, and the first timer gets set years in future! Since you are already going to look into it, I'll let you :).. thanks, Mukesh